# 625e 09 signif codes 0001 001 005 01 1 residual

• Homework Help
• 12
• 100% (4) 4 out of 4 people found this document helpful

This preview shows page 3 - 7 out of 12 pages.

1.248e-05 -8.098 6.25e-09 *** ## --- ## Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 ## ## Residual standard error: 0.08373 on 29 degrees of freedom ## Multiple R-squared: 0.9899, Adjusted R-squared: 0.9888 ## F-statistic: 944.6 on 3 and 29 DF, p-value: < 2.2e-16 Now we see all three terms are significant at 5% level and we are done. Problem 2 data (chickwts) (a) fit = lm (weight~ factor (feed), data = chickwts) summary (fit) ## ## Call: 3
## lm(formula = weight ~ factor(feed), data = chickwts) ## ## Residuals: ## Min 1Q Median 3Q Max ## -123.909 -34.413 1.571 38.170 103.091 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 323.583 15.834 20.436 < 2e-16 *** ## factor(feed)horsebean -163.383 23.485 -6.957 2.07e-09 *** ## factor(feed)linseed -104.833 22.393 -4.682 1.49e-05 *** ## factor(feed)meatmeal -46.674 22.896 -2.039 0.045567 * ## factor(feed)soybean -77.155 21.578 -3.576 0.000665 *** ## factor(feed)sunflower 5.333 22.393 0.238 0.812495 ## --- ## Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 ## ## Residual standard error: 54.85 on 65 degrees of freedom ## Multiple R-squared: 0.5417, Adjusted R-squared: 0.5064 ## F-statistic: 15.36 on 5 and 65 DF, p-value: 5.936e-10 (b) par ( mfrow = c ( 2 , 2 )) plot (fit) 200 250 300 -150 0 Fitted values Residuals Residuals vs Fitted 54 68 53 -2 -1 0 1 2 -2 0 2 Theoretical Quantiles Standardized residuals Normal Q-Q 54 68 53 200 250 300 0.0 1.0 Fitted values Standardized residuals Scale-Location 54 68 53 0.00 0.02 0.04 0.06 0.08 0.10 -2 0 2 Leverage Standardized residuals Cook's distance Residuals vs Leverage 54 53 68 There is no unusual or outlying valus for residuals. Constant variance seems to be satisfied. Normal Q-Q plot seems to be good. (c) 4
anova (fit) ## Analysis of Variance Table ## ## Response: weight ## Df Sum Sq Mean Sq F value Pr(>F) ## factor(feed) 5 231129 46226 15.365 5.936e-10 *** ## Residuals 65 195556 3009 ## --- ## Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 (d) The p-value for feed is less than 5%. Therefore we can conclude that there are differences among the mean wights of the groups. (e) TukeyHSD ( aov (weight~ factor (feed), data = chickwts)) ## Tukey multiple comparisons of means ## 95% family-wise confidence level ## ## Fit: aov(formula = weight ~ factor(feed), data = chickwts) ## ## \$ factor(feed) ## diff lwr upr p adj ## horsebean-casein -163.383333 -232.346876 -94.41979 0.0000000 ## linseed-casein -104.833333 -170.587491 -39.07918 0.0002100 ## meatmeal-casein -46.674242 -113.906207 20.55772 0.3324584 ## soybean-casein -77.154762 -140.517054 -13.79247 0.0083653 ## sunflower-casein 5.333333 -60.420825 71.08749 0.9998902 ## linseed-horsebean 58.550000 -10.413543 127.51354 0.1413329 ## meatmeal-horsebean 116.709091 46.335105 187.08308 0.0001062 ## soybean-horsebean 86.228571 19.541684 152.91546 0.0042167 ## sunflower-horsebean 168.716667 99.753124 237.68021 0.0000000 ## meatmeal-linseed 58.159091 -9.072873 125.39106 0.1276965 ## soybean-linseed 27.678571 -35.683721 91.04086 0.7932853 ## sunflower-linseed 110.166667 44.412509 175.92082 0.0000884 ## soybean-meatmeal -30.480519 -95.375109 34.41407 0.7391356 ## sunflower-meatmeal 52.007576 -15.224388 119.23954 0.2206962 ## sunflower-soybean 82.488095 19.125803 145.85039 0.0038845 (f) horsebean-casein linseed-casein soybean-casein meatmeal-horsebean soybean-horsebean sunflower-horsebean 5
sunflower-linseed sunflower-soybean Problem 3 mydata1 = read.table ( pine.dat , head = TRUE ) (a) There are 4*2 = 8 treatment groups. Each treatment group has 3 experimental units. unique (mydata1\$shape) ## [1] 1 2 3 4 unique (mydata1\$trt) ## [1] 1 2 (b) fit = lm (y~ factor (shape)* factor (trt), data = mydata1) summary (fit) ## ## Call: ## lm(formula = y ~ factor(shape) * factor(trt), data = mydata1) ## ## Residuals: ## Min 1Q Median 3Q Max ## -9.333 -3.333 -1.167 4.250 11.667 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) 11.333 3.877 2.924 0.00994 ** ## factor(shape)2 38.000 5.482 6.931 3.38e-06 *** ## factor(shape)3 53.667 5.482 9.789 3.69e-08 *** ## factor(shape)4 68.000 5.482 12.404 1.27e-09 *** ## factor(trt)2 4.667 5.482 0.851 0.40720 ## factor(shape)2:factor(trt)2 11.667 7.753 1.505 0.15187 ## factor(shape)3:factor(trt)2 11.333 7.753 1.462 0.16317 ## factor(shape)4:factor(trt)2 17.333 7.753 2.236 0.03998 * ## --- ## Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 ## ## Residual standard error: 6.714 on 16 degrees of freedom