HW3 - HW3 Lujia Wang library(alr4 Loading required package...

This preview shows page 1 - 6 out of 14 pages.

HW3 Lujia Wang library (alr4) ## Loading required package: car ## Loading required package: effects ## ## Attaching package: 'effects' ## ## The following object is masked from 'package:car': ## ## Prestige 2.6 2.6.1 plot (winter ~ fall, data= ftcollinstemp)
There is might be a positive liner relationship between temperature in fall and winter 2.6.2 m2= lm (winter ~ fall, data= ftcollinstemp) summary (m2) ## ## Call: ## lm(formula = winter ~ fall, data = ftcollinstemp) ## ## Residuals: ## Min 1Q Median 3Q Max ## -7.8186 -1.7837 -0.0873 2.1300 7.5896 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 13.7843 7.5549 1.825 0.0708 . ## fall 0.3132 0.1528 2.049 0.0428 *
## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 3.179 on 109 degrees of freedom ## Multiple R-squared: 0.0371, Adjusted R-squared: 0.02826 ## F-statistic: 4.2 on 1 and 109 DF, p-value: 0.04284 plot (winter ~ fall, data= ftcollinstemp) abline (m2, col= "red" ) Hypothesis: H 0 : β 1 = 0 versus H 1 : β 1 0 . As the results shown above, the t- statisitc is 2.049 and p-value is 0.0428,which is smaller than 0.05. Then we have enough evidence to reject the null hypothesis. 2.6.3 Based on the Multiple R-squared, about 3.71% variability in winter is explained by fall. It means that it winter has very little correlationship with fall.
2.6.4 library (lattice) period <- ifelse (ftcollinstemp$year <= 1989 , "early" , "late" ) print ( xyplot (winter ~ fall|period, ftcollinstemp, type= c ( "p" , "g" , "r" ))) m2.early <- update (m2, subset= (period == "early" )) summary (m2.early)$coef ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 22.7079122 8.2600078 2.7491393 0.007250303 ## fall 0.1208925 0.1681116 0.7191207 0.473971879 m2.late <- update (m2, subset= (period == "late" )) summary (m2.late)$coef ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 24.8259649 17.7972619 1.3949317 0.1791311 ## fall 0.1390029 0.3509374 0.3960904 0.6964512
I think the results in the two time are not similar. The slopes are similar and p-value are very large.So we can't use temperature in fall to predict winter temperature. 2.16 2.16.1 m3= lm ( log (fertility)~ log (ppgdp), data= UN11) summary (m3) ## ## Call: ## lm(formula = log(fertility) ~ log(ppgdp), data = UN11) ## ## Residuals: ## Min 1Q Median 3Q Max ## -0.79828 -0.21639 0.02669 0.23424 0.95596 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|)

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture