实验设计与分析(第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)

相关推荐
统计学小王子4 小时前
分类模型评价指标——R语言(数学建模常用)
数学建模·分类·r语言
Biotree_20251 天前
Cell Death Dis.(IF=12.2)|厦门大学徐兵教授团队解锁滤泡性淋巴瘤治疗新策略:PI3Kδ与PPARα双靶向重塑代谢激活FoxO1
r语言
深兰科技1 天前
深兰科技亮相天津医疗器械创新生态大会,DeepAgent智能体赋能医疗医美并签约天津OPC项目
人工智能·科技·r语言·symfony·视觉大模型·深兰科技·deepagent智能体
生态学者1 天前
Journal of Applied Ecology | 华南植物园王法明研究员团队揭示加纳红树林蓝碳储量及其环境调控机制
大数据·r语言·微信公众平台
独行侠影a3 天前
用ggplot2画出“能发论文”的统计图:R语言可视化的底层逻辑与高阶技巧
r语言
小洁忘了怎么分身5 天前
多样本空间转录组 Harmony 整合与标签转移指南
网络·r语言·生信分析
临床数据科学和人工智能兴趣组5 天前
在R语言中,数据存储和读取是数据分析工作的重要环节
r语言·r语言-4.2.1
赵钰老师7 天前
R语言数据统计分析与ggplot2高级绘图
开发语言·数据分析·r语言
开开心心_Every7 天前
电脑文件搜索软件支持内容和拼音搜索
linux·服务器·人工智能·r语言·pdf·音视频·symfony
AAIshangyanxiu8 天前
R语言数据统计分析与ggplot2高级绘图实践应用
开发语言·r语言·ggplot2