统计建模与R软件第六章习题_第1页
统计建模与R软件第六章习题_第2页
统计建模与R软件第六章习题_第3页
统计建模与R软件第六章习题_第4页
统计建模与R软件第六章习题_第5页
已阅读5页,还剩5页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

第六章1 a x y plot(x,y)X与Y线性相关 b x y lm.sol summary(lm.sol)Call:lm(formula = y 1 + x)Residuals: Min 1Q Median 3Q Max -128.591 -70.978 -3.727 49.263 167.228 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 140.95 125.11 1.127 0.293 x 364.18 19.26 18.908 6.33e-08 *-Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1 Residual standard error: 96.42 on 8 degrees of freedomMultiple R-Squared: 0.9781, Adjusted R-squared: 0.9754 F-statistic: 357.5 on 1 and 8 DF, p-value: 6.33e-08 回归方程为Y=140.95+364.18X,极为显著 d new lm.pred lm.pred fit lwr upr1, 2690.227 2454.971 2925.484Y(7)= 2690.227, 2454.971,2925.4842 out-data.frame(+ x1 - c(0.4,0.4,3.1,0.6,4.7,1.7,9.4,10.1,11.6,12.6,10.9,23.1,23.1,21.6,23.1,1.9,26.8,29.9),+ x2 - c(52,34,19,34,24,65,44,31,29,58,37,46,50,44,56,36,58,51),+ x3 - c(158,163,37,157,59,123,46,117,173,112,111,114,134,73,168,143,202,124),+ y lm.sol summary(lm.sol)Call:lm(formula = y x1 + x2 + x3, data = out)Residuals: Min 1Q Median 3Q Max -27.575 -11.160 -2.799 11.574 48.808 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 44.9290 18.3408 2.450 0.02806 * x1 1.8033 0.5290 3.409 0.00424 *x2 -0.1337 0.4440 -0.301 0.76771 x3 0.1668 0.1141 1.462 0.16573 -Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1 Residual standard error: 19.93 on 14 degrees of freedomMultiple R-Squared: 0.551, Adjusted R-squared: 0.4547 F-statistic: 5.726 on 3 and 14 DF, p-value: 0. 回归方程为 y=44.9290+1.8033x1-0.1337x2+0.1668x3由计算结果可以得到,回归系数与回归方程的检验都是显著的3 a x y lm.sol summary(lm.sol)Call:lm(formula = y 1 + x)Residuals: Min 1Q Median 3Q Max -9.84130 -2.33691 -0.02137 1.05921 17.83201 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) -1.4519 1.8353 -0.791 0.436 x 1.5578 0.2807 5.549 7.93e-06 *-Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1 Residual standard error: 5.168 on 26 degrees of freedomMultiple R-Squared: 0.5422, Adjusted R-squared: 0.5246 F-statistic: 30.8 on 1 and 26 DF, p-value: 7.931e-06 线性回归方程为 y=-1.4519+1.5578x,并且未通过t检验和F检验 plot(x,y) abline(-1.4519,1.5578)c x y y.res-resid(lm.sol);y.fit plot(y.resy.fit) y.rst plot(y.rsty.fit)普通残差标准化残差d(4) lm.new plot(x,y) lines(x,y=0.+0.*x2+0.*x) y.res-resid(lm.new);y.fit plot(y.resy.fit) y.rst plot(y.rsty.fit)4 lm.sol summary(lm.sol)Call:lm(formula = Y X1 + X2, data = toothpaste)Residuals: Min 1Q Median 3Q Max -0. -0. -0. 0. 0. Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 4.4075 0.7223 6.102 1.62e-06 *X1 1.5883 0.2994 5.304 1.35e-05 *X2 0.5635 0.1191 4.733 6.25e-05 *-Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1 Residual standard error: 0.2383 on 27 degrees of freedomMultiple R-squared: 0.886, Adjusted R-squared: 0.8776 F-statistic: 105 on 2 and 27 DF, p-value: 1.845e-13 source(Reg_Diag.R);Reg_Diag(lm.sol) residual s1 standard s2 student s3 hat_matrix s4 DFFITS1 -0. -0. -0. 0. -0.2 -0. -0. -0. 0. -0.3 0. 0. 0. 0. 0.4 -0. -0. -0. 0. -0.5 0. * 2. * 2. * 0. 0.6 -0. -0. -0. 0. -0.7 0. 1. 1. 0. 0.8 0. 2. * 2. * 0. * 1.9 -0. -0. -0. 0. -0.10 -0. -0. -0. 0. -0.11 -0. -2. * -2. * 0. -0.12 0. 0. 0. 0. 0.13 0. 0. 0. 0. 0.14 -0. -0. -0. 0. -0.15 0. 0. 0. 0. 0.16 0. 0. 0. 0. 0.17 0. 0. 0. 0. 0.18 -0. -0. -0. 0. -0.19 -0. -0. -0. 0. -0.20 -0. -0. -0. 0. -0.21 -0. -0. -0. 0. -0.22 -0. -1. -1. 0. -0.23 -0. -1. -1. 0. -0.24 -0. -0. -0. 0. -0.25 -0. -1. -1. 0. -0.26 0. 0. 0. 0. 0.27 0. 1. 1. 0. 0.28 0. 0. 0. 0. 0.29 0. 0. 0. 0. 0.30 0. 0. 0. 0. 0. s5 cooks_distance s6 COVRATIO s71 2.e-03 1. 2 2.e-03 1. 3 5.e-03 1. 4 4.e-05 1. 5 * 2.e-01 0. *6 2.e-03 1. 7 4.e-02 0. 8 * 4.e-01 * 0. 9 1.e-03 1. 10 3.e-04 1. 11 5.e-02 0. 12 1.e-03 1. 13 5.e-03 1. 14 1.e-02 1. 15 3.e-03 1. 16 7.e-03 1. 17 2.e-03 1. 18 1.e-02 1. 19 5.e-03 1. 20 2.e-03 1. 21 2.e-02 1. 22 9.e-02 0. 23 3.e-02 0. 24 1.e-04 1. 25 5.e-02 1. 26 4.e-04 1. 27 9.e-02 1. 28 3.e-04 1. 29 1.e-02 1. 30 2.e-02 1. toothpaste lm.sol summary(lm.sol)Call:lm(formula = Y X1 + X2, data = toothpaste)Residuals: Min 1Q Median 3Q Max -0.37130 -0.10114 0.03066 0.10016 0.30162 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 4.0759 0.6267 6.504 1.00e-06 *X1 1.5276 0.2354 6.489 1.04e-06 *X2 0.6138 0.1027 5.974 3.63e-06 *-Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1 Residual standard error: 0.1767 on 24 degrees of freedomMultiple R-squared: 0.9378, Adjusted R-squared: 0

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论