Using RStudio: This time we again consider the data set Boston. Again, use libra
ID: 3374817 • Letter: U
Question
Using RStudio:
This time we again consider the data set Boston. Again, use library (MASS) to load the library and ?Boston for the description of the data set. Again, answer the following questions in a Word document. Use lm (crim~. ,data-Boston) to fit a linear model, where crim as the dependent variables and all other variable as independent variables. Notice that "." is a shortcut to include all variables (except crim) in the model. Name the returned object by lm.fit1. Retrieve the summary table by summaryO a, Again, the summary table does hypothesis tests for each of the dependent variable, where the null hypothesis begin each of the coefficient is zero. Does a low p-value still indicates correlation between the dependent variable and the independent variable? What can we learn from the p-value and significant codes? b, The summary table also reports a F-test, testing whether there is a connection between the dependent variable and independent variables. What exactly is the null hypothesis for the test? What can we conclude from the p-value? c, Comment on the residue versus fitted value plot (use plot(lm.fit1) to retrieve the plot) Do you find any patterns?Explanation / Answer
> d=Boston
> reg=lm(crim~.,data=d)
> summary(reg)
Call:
lm(formula = crim ~ ., data = d)
Residuals:
Min 1Q Median 3Q Max
-9.924 -2.120 -0.353 1.019 75.051
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 17.033228 7.234903 2.354 0.018949 *
zn 0.044855 0.018734 2.394 0.017025 *
indus -0.063855 0.083407 -0.766 0.444294
chas -0.749134 1.180147 -0.635 0.525867
nox -10.313535 5.275536 -1.955 0.051152 .
rm 0.430131 0.612830 0.702 0.483089
age 0.001452 0.017925 0.081 0.935488
dis -0.987176 0.281817 -3.503 0.000502 ***
rad 0.588209 0.088049 6.680 6.46e-11 ***
tax -0.003780 0.005156 -0.733 0.463793
ptratio -0.271081 0.186450 -1.454 0.146611
black -0.007538 0.003673 -2.052 0.040702 *
lstat 0.126211 0.075725 1.667 0.096208 .
medv -0.198887 0.060516 -3.287 0.001087 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 6.439 on 492 degrees of freedom
Multiple R-squared: 0.454, Adjusted R-squared: 0.4396
F-statistic: 31.47 on 13 and 492 DF, p-value: < 2.2e-16
(a)
Here p values which less than 0.05 which indicate that coefficient are statistically significant.
(all the p values with *,***,** this sign )
P values does not tell you about correlation here.
(b)
The "F value'' statistics test the overall significance of the regression model.
they test the null hypothesis that all of the regression coefficients are equal to zero.
This tests the full model against a model with no variables and with the estimate of the dependent variable being the mean of the values of the dependent variable.
here p value is 2.2e-16 which less than 0.05.this tells you that overall regression is significant.
(c)
> res=reg$residuals
> plot(crim,res,main="residual plot")
>
Here we can see some pattern.> d=Boston
> reg=lm(crim~.,data=d)
> summary(reg)
Call:
lm(formula = crim ~ ., data = d)
Residuals:
Min 1Q Median 3Q Max
-9.924 -2.120 -0.353 1.019 75.051
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 17.033228 7.234903 2.354 0.018949 *
zn 0.044855 0.018734 2.394 0.017025 *
indus -0.063855 0.083407 -0.766 0.444294
chas -0.749134 1.180147 -0.635 0.525867
nox -10.313535 5.275536 -1.955 0.051152 .
rm 0.430131 0.612830 0.702 0.483089
age 0.001452 0.017925 0.081 0.935488
dis -0.987176 0.281817 -3.503 0.000502 ***
rad 0.588209 0.088049 6.680 6.46e-11 ***
tax -0.003780 0.005156 -0.733 0.463793
ptratio -0.271081 0.186450 -1.454 0.146611
black -0.007538 0.003673 -2.052 0.040702 *
lstat 0.126211 0.075725 1.667 0.096208 .
medv -0.198887 0.060516 -3.287 0.001087 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 6.439 on 492 degrees of freedom
Multiple R-squared: 0.454, Adjusted R-squared: 0.4396
F-statistic: 31.47 on 13 and 492 DF, p-value: < 2.2e-16
(a)
Here p values which less than 0.05 which indicate that coefficient are statistically significant.
(all the p values with *,***,** this sign )
P values does not tell you about correlation here.
(b)
The "F value'' statistics test the overall significance of the regression model.
they test the null hypothesis that all of the regression coefficients are equal to zero.
This tests the full model against a model with no variables and with the estimate of the dependent variable being the mean of the values of the dependent variable.
here p value is 2.2e-16 which less than 0.05.this tells you that overall regression is significant.
(c)
> res=reg$residuals
> plot(crim,res,main="residual plot")
>
Here we can see some pattern.
> res=reg$residuals
> plot(crim,res,main="residual plot")
>
Here we can see some pattern.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.