实验设计与分析(第6版,Montgomery)第5章析因设计引导5.7节思考题5.8 R语言解题

本文是实验设计与分析(第6版,Montgomery著,傅珏生译) 第5章析因设计引导5.7节思考题5.8 R语言解题。主要涉及方差分析,正态假设检验,残差分析,交互作用图。

(a)

dataframe<-data.frame(

Light=c(580,568,570,550,530,579,546,575,599,1090,1087,1085,1070,1035,1000,1045,1053,1066,1392,1380,1386,1328,1312,1299,867,904,889),

Temperature=gl(3,9,27),

Material=gl(3,3,27))

summary (dataframe)

dataframe.aov2 <- aov(Light~Material*Temperature,data=dataframe)

summary (dataframe.aov2)

> summary (dataframe.aov2)

Df Sum Sq Mean Sq F value Pr(>F)

Material 2 150865 75432 206.4 3.89e-13 ***

Temperature 2 1970335 985167 2695.3 < 2e-16 ***

Material:Temperature 4 290552 72638 198.7 1.25e-14 ***

Residuals 18 6579 366


Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

with(dataframe,interaction.plot(Temperature,Material,Light,type="b",pch=19,fixed=T,xlab="Temperature (°F)",ylab="Light"))

plot.design(Light~Material*Temperature,data=dataframe)

(b)

fit <-lm(Light~Material*Temperature,data=dataframe)

anova(fit)

> anova(fit)

Analysis of Variance Table

Response: Light

Df Sum Sq Mean Sq F value Pr(>F)

Material 2 150865 75432 206.37 3.886e-13 ***

Temperature 2 1970335 985167 2695.26 < 2.2e-16 ***

Material:Temperature 4 290552 72638 198.73 1.254e-14 ***

Residuals 18 6579 366


Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

summary(fit)

> summary(fit)

Call:

lm(formula = Light ~ Material * Temperature, data = dataframe)

Residuals:

Min 1Q Median 3Q Max

-35.000 -5.333 -0.333 6.667 35.000

Coefficients:

Estimate Std. Error t value Pr(>|t|)

(Intercept) 572.6667 11.0381 51.881 < 2e-16 ***

Material2 -19.6667 15.6102 -1.260 0.2238

Material3 0.6667 15.6102 0.043 0.9664

Temperature2 514.6667 15.6102 32.970 < 2e-16 ***

Temperature3 813.3333 15.6102 52.103 < 2e-16 ***

Material2:Temperature2 -32.6667 22.0762 -1.480 0.1562

Material3:Temperature2 -33.3333 22.0762 -1.510 0.1484

Material2:Temperature3 -53.3333 22.0762 -2.416 0.0265 *

Material3:Temperature3 -500.0000 22.0762 -22.649 1.11e-14 ***


Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 19.12 on 18 degrees of freedom

Multiple R-squared: 0.9973, Adjusted R-squared: 0.9961

F-statistic: 824.8 on 8 and 18 DF, p-value: < 2.2e-16

(c)

par(mfrow=c(2,2))

plot(fit)

par(mfrow=c(2,2))

plot(as.numeric(dataframeMaterial), fitresiduals, xlab="Material Type", ylab="Residuals", type="p", pch=16)

plot(as.numeric(dataframeTemperature), fitresiduals, xlab="Temperature", ylab="Residuals", pch=16)

相关推荐
Davina_yu11 小时前
R语言报错:无法打开文件‘sales_2025.txt‘: No such file or directory
开发语言·r语言
小小8程序员12 小时前
R 语言 4.5.0 全解析:性能优化、新特性与使用指南下载安装步骤
r语言
墨&白.1 天前
如何卸载/更新Mac上的R版本
开发语言·macos·r语言
Lun3866buzha2 天前
【深度学习】Mask R-CNN在温室番茄成熟度检测中的应用——基于ResNet18与FPN的多级特征融合分类系统
深度学习·r语言·cnn
Katecat996633 天前
夜间收费站与道路场景多类型车辆检测与分类:基于Faster R-CNN R50 PAFPN的实现_1
分类·r语言·cnn
Piar1231sdafa3 天前
红枣目标检测Cascade R-CNN改进版_FPN结构优化详解
目标检测·r语言·cnn
天桥下的卖艺者3 天前
R语言绘制复杂加权数据(nhanes数据)多模型生存分析决策曲线
开发语言·r语言
Tiger Z3 天前
《R for Data Science (2e)》免费中文翻译 (第15章) --- Regular expression(1)
数据分析·r语言·数据科学·免费书籍
Dekesas96954 天前
【深度学习】基于Faster R-CNN的黄瓜幼苗智能识别与定位系统,农业AI新突破
人工智能·深度学习·r语言
青啊青斯4 天前
二、PaddlePaddle seal_recognition印章内容提取
人工智能·r语言·paddlepaddle