Summarize diffrent simple regression in a table

I have a problem with creating a table with 13 different simple linear regression. it says that I should do like this "For each of the 13 predictors in the dataset, fit a simple linear regression model to predict the response (i.e. 13 simple linear regressions). Summarize your results in a table. In which of the models is there a statistically significant association between the predictor and the response? Create some plots to back up your conclusions."

How can I create one table with all of these 13 different predictors?

It seems that you recently asked a question that originated from a class or workshop, and I wanted to make sure you were seeking help here in a way that maximizes the chances of getting good help (without violating our homework policies).

Our homework guide is here: FAQ: Homework Policy

How should one ask a homework question?

  1. Never copy-paste instructions from an assignment (even for online courses).
  2. Explicitly mention the course you are taking and use the #homework tag.
  3. Ask your question as a reproducible example (reprex), preferably prepared for posting using the reprex package.

What's the best way to ask a specific homework-related question?

We made a short guide for helping folks pose their R-coding questions here.

Assign your regression output to an object, say model <- lm(y ~ age + sex + marital).
Then summary(model) gives you a summary of the regression.
Then str(model) will give you variable names of various pieces of the regression output.
Then create a data frame with pieces of the output you select that ought to be summarized.

but doesn't that give me a multiple regression model, I want 13 different simple linear regression models

you can conveniently iterate by using purrr's map family of functions.
use fcas80 advice to make a parameterised function that can do the task for any one model.
Than iterate your function over the data for as many applications of it as might be needed ( i.e. 13)

https://jennybc.github.io/purrr-tutorial/

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.