0
$\begingroup$

I'm really super new to R and am doing the most basic stuff for a beginner's statistics class. I've been staring at this question for a while and can't work out what I'm meant to do.

Here's the question:

  1. Using the data Anscombe, included in the car package, perform a regression to examine whether the number of people living in an urban area has an effect on income. Perform all necessary steps, including a scatter plot, then answer the following questions. Hint: load data from the package with the following command A<-Anscombe a. Interpret the coefficient for urban.

b. Interpret the model’s R squared.

c. For the variance that is not explained by the model, what is the explanation?

d. Can we say that there is a linear relationship between the two variables?

The code and output I've used is: A<-Anscombe

shapiro.test(A$income)
shapiro.test(A$urban)

A1<-lm(urban~income,data=Anscombe)
summary(A1)
scatterplot(urban~income,data=Anscombe,smooth=F)

Call:
lm(formula = urban ~ income, data = Anscombe)

Residuals:
    Min      1Q  Median      3Q     Max 
-351.06  -51.07   -4.37   81.75  220.13 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 67.04877   91.99292   0.729     0.47    
income       0.18524    0.02811   6.590 2.87e-08 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 111.3 on 49 degrees of freedom
Multiple R-squared:  0.4699,    Adjusted R-squared:  0.459 
F-statistic: 43.43 on 1 and 49 DF,  p-value: 2.866e-08

I'm not sure if I've put urban and income in the right order in my functions for this question? And I'm not sure how to interpret the coefficient results, or how to interpret the model's R squared.

Can someone please help me understand these results and how to answer this question?

$\endgroup$

closed as off-topic by Michael Chernick, mdewey, Peter Flom Jul 19 '18 at 10:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Self-study questions (including textbook exercises, old exam papers, and homework) that seek to understand the concepts are welcome, but those that demand a solution need to indicate clearly at what step help or advice are needed. For help writing a good self-study question, please visit the meta pages." – mdewey, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ They're asking you to fit a model with income as the dependent variable, so the correct order in lm is income ~ urban $\endgroup$ – NatWH Jul 18 '18 at 20:58
  • $\begingroup$ blog.yhat.com/posts/r-lm-summary.html $\endgroup$ – Nishad Jul 18 '18 at 22:10
  • 1
    $\begingroup$ Please see stats.stackexchange.com/search?q=lm+interpret for posts on interpreting the lm output. All the answers to the question are staring at you in the scatterplot output--you don't even need to run lm. $\endgroup$ – whuber Jul 19 '18 at 1:03
  • 1
    $\begingroup$ Why do you test for deviations from a normal distribution of those variables? $\endgroup$ – Frans Rodenburg Jul 19 '18 at 5:45
1
$\begingroup$

This is quite a broad question, since interpreting regression output is something that is generally taught within a full course on regression modelling, where the method and outputs are introduced and studied over many lessons. Detailed interpretations of these statistics can be obtained by looking at the mathematics behind them, but for an introductory course it is more likely that your teacher is looking for an interpretation that does not require detailed knowledge of the maths.

Regression models are a commonly used form of statistical model, so understanding regression output is a core skill of statistical modelling. There are a number of good online resources that explain regression output (see e.g., here, here, here, here, here, and here), so I won't give a long explanation of the output in this answer. Nevertheless, it might be useful to you for me to point out what each part of this output is giving you, so you can look it up in more detail.


Call: This part of the output is telling you the input call you used to get this regression output. It includes the data frame you are using and the formula for the regression.

Residuals: This part of the output is giving you some basic descriptive statistics for the residuals from your regression model. These descriptive statistics tell you the minimum, first quartile, median (second quartile), third quartile, and maximum. This is to give you a rough sense of the spread of the residuals generated by your fitted model.

Coefficients: This part of the output is the coefficient estimates table for the regression model. For each explanatory variable in your model (including the implicit intercept term), this table shows you the estimate for the regression coefficient for that term, the standard-error of that estimate, and the corresponding T statistic and p-value used to test whether the true coefficient is equal to zero (i.e., whether the term can be removed from the model). To understand this part you will need to learn about classical hypothesis testing in statistics.

Residual standard error This is the estimate of the standard deviation of the 'error terms' in your regression model.

Multiple R-squared: and Adjusted R-squared: This part gives the raw and adjusted 'coefficient-of-variation' in your regression model. Broadly speaking, the raw coefficient-of-variation is interpreted as explaining the proportion of the variation in the response variable that is 'explained' by the presence of the explanatory variables (and the adjusted version is making an adjustment to this to penalise additional explanatory variables).

F-statistic: and p-value: This part of the output is giving you the test statistic and p-value for a goodness-of-fit test for the regression model, which tests whether there is any (linear) relationship between the explanatory variables and the response variable. To understand this part you will need to learn about classical hypothesis testing in statistics.


$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.