当前位置: 首页 > article >正文

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

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

dataframe <-data.frame(

wrap=c(17,20,12,9,16,12,21,17,16,21,18,13,18,21,23,21,24,22,17,12,25,23,23,22,28,27,27,31,30,23,29,31),

Temperature=gl(4,2,32),

copper=gl(4,8, 32))

summary (dataframe)

dataframe.aov2 <- aov(wrap~copper*Temperature,data=dataframe)

summary (dataframe.aov2)

> summary (dataframe.aov2)

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

copper              3  698.3  232.78  34.327 3.35e-07 ***

Temperature         3  156.1   52.03   7.673  0.00213 **

copper:Temperature  9  113.8   12.64   1.864  0.13275   

Residuals          16  108.5    6.78                    

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

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

plot.design(wrap~copper*Temperature,data=dataframe)

fit <-lm(wrap~copper*Temperature,data=dataframe)

anova(fit)

> anova(fit)

Analysis of Variance Table

Response: wrap

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

copper              3 698.34 232.781 34.3272 3.35e-07 ***

Temperature         3 156.09  52.031  7.6728 0.002127 **

copper:Temperature  9 113.78  12.642  1.8643 0.132748   

Residuals          16 108.50   6.781                    

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

summary(fit)

> summary(fit)

Call:

lm(formula = wrap ~ copper * Temperature, data = dataframe)

Residuals:

   Min     1Q Median     3Q    Max

  -3.5   -1.5    0.0    1.5    3.5

Coefficients:

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

(Intercept)           1.850e+01  1.841e+00  10.047 2.57e-08 ***

copper2               8.521e-15  2.604e+00   0.000  1.00000   

copper3               4.500e+00  2.604e+00   1.728  0.10323   

copper4               9.000e+00  2.604e+00   3.456  0.00325 **

Temperature2         -8.000e+00  2.604e+00  -3.072  0.00729 **

Temperature3         -4.500e+00  2.604e+00  -1.728  0.10323   

Temperature4          5.000e-01  2.604e+00   0.192  0.85015   

copper2:Temperature2  5.000e+00  3.683e+00   1.358  0.19340   

copper3:Temperature2 -5.000e-01  3.683e+00  -0.136  0.89370   

copper4:Temperature2  9.500e+00  3.683e+00   2.580  0.02016 * 

copper2:Temperature3  5.500e+00  3.683e+00   1.493  0.15477   

copper3:Temperature3  5.500e+00  3.683e+00   1.493  0.15477   

copper4:Temperature3  3.500e+00  3.683e+00   0.950  0.35605   

copper2:Temperature4  3.000e+00  3.683e+00   0.815  0.42725   

copper3:Temperature4 -1.000e+00  3.683e+00  -0.272  0.78945   

copper4:Temperature4  2.000e+00  3.683e+00   0.543  0.59456   

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 2.604 on 16 degrees of freedom

Multiple R-squared:  0.8992,    Adjusted R-squared:  0.8048

F-statistic: 9.519 on 15 and 16 DF,  p-value: 2.57e-05

par(mfrow=c(2,2))

plot(fit)

par(mfrow=c(2,2))

plot(as.numeric(dataframe$copper), fit$residuals, xlab="copper", ylab="Residuals", type="p", pch=16)

plot(as.numeric(dataframe$Temperature), fit$residuals, xlab="Temperature", ylab="Residuals", pch=16)

http://www.lryc.cn/news/2398331.html

相关文章:

  • 阿里云百炼全解析:一站式大模型开发平台的架构与行业实践
  • 字节新出的MCP应用DeepSearch,有点意思。
  • ​​Agentic Voice Stack 热门项目
  • 机器学习在多介质环境中多污染物空间预测的应用研究
  • 期货反向跟单运营逻辑推导思路
  • 使用 HTML + JavaScript 实现图片裁剪上传功能
  • Redis 缓存粒度如何控制?缓存整个对象还是部分字段?
  • 【灵动Mini-F5265-OB】vscode+gcc工程创建、下载、调试
  • 程序设计实践期末考试模拟题(1)
  • 现代语言模型中的分词算法全解:从基础到高级
  • HttpServletResponse 对象用来做什么?
  • 第十三章 Java基础-特殊处理
  • MTK的Download agent是什么下载程序?
  • ArcGIS Pro 3.4 二次开发 - 地图创作 2
  • 【操作系统原理08】文件管理
  • 图论学习笔记 5 - 最小树形图
  • VueUse:组合式API实用函数全集
  • 《自动驾驶轨迹规划实战:Lattice Planner实现避障路径生成(附可运行Python代码)》—— 零基础实现基于离散优化的避障路径规划
  • 嵌入式笔试题+面试题
  • 【Go语言生态】
  • PyTorch——卷积操作(2)
  • 【JavaWeb】SpringBoot原理
  • BSRR对比BRR对比ODR
  • ubuntu22.04安装taskfile
  • 记录被mybatis一级缓存坑的问题
  • 遥感影像建筑物变化检测
  • 【数据库】《DBA实战手记》- 读书笔记
  • 多模态大语言模型arxiv论文略读(103)
  • 汇编语言基础: 搭建实验环境
  • SIFT 算法原理详解