第一范文网 - 专业文章范例文档资料分享平台

统计建模与R软件

来源:用户分享 时间:2025/5/16 18:25:04 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

---

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

Residual standard error: 19.93 on 14 degrees of freedom Multiple R-squared: 0.551, Adjusted R-squared: 0.4547 F-statistic: 5.726 on 3 and 14 DF, p-value: 0.009004 回归方程为 y=44.9290+1.8033x1-0.1337x2+0.1668x3 (2)

回归方程显著,但有些回归系数不显著。 (3)

> lm.step<-step(lm.sol) Start: AIC=111.2 y ~ x1 + x2 + x3

Df Sum of Sq RSS AIC - x2 1 36.0 5599.4 109.3 5563.4 111.2 - x3 1 849.8 6413.1 111.8 - x1 1 4617.8 10181.2 120.1

Step: AIC=109.32 y ~ x1 + x3

Df Sum of Sq RSS AIC 5599.4 109.3 - x3 1 833.2 6432.6 109.8 - x1 1 5169.5 10768.9 119.1

> summary(lm.step)

Call:

lm(formula = y ~ x1 + x3, data = pho)

Residuals:

Min 1Q Median 3Q Max

-29.713 -11.324 -2.953 11.286 48.679

Coefficients:

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

(Intercept) 41.4794 13.8834 2.988 0.00920 ** x1 1.7374 0.4669 3.721 0.00205 ** x3 0.1548 0.1036 1.494 0.15592 ---

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

Residual standard error: 19.32 on 15 degrees of freedom Multiple R-squared: 0.5481, Adjusted R-squared: 0.4878 F-statistic: 9.095 on 2 and 15 DF, p-value: 0.002589 x3仍不够显著。

再用drop1函数做逐步回归。 > drop1(lm.step) Single term deletions

Model:

y ~ x1 + x3

Df Sum of Sq RSS AIC 5599.4 109.3 x1 1 5169.5 10768.9 119.1 x3 1 833.2 6432.6 109.8 可以考虑再去掉x3.

> lm.opt<-lm(y~x1,data=pho);summary(lm.opt)

Call:

lm(formula = y ~ x1, data = pho)

Residuals:

Min 1Q Median 3Q Max

-31.486 -8.282 -1.674 5.623 59.337

Coefficients:

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

(Intercept) 59.2590 7.4200 7.986 5.67e-07 *** x1 1.8434 0.4789 3.849 0.00142 ** ---

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

Residual standard error: 20.05 on 16 degrees of freedom Multiple R-squared: 0.4808, Adjusted R-squared: 0.4484 F-statistic: 14.82 on 1 and 16 DF, p-value: 0.001417 皆显著。

Ex6.3

> x<-c(1,1,1,1,2,2,2,3,3,3,4,4,4,5,6,6,6,7,7,7,8,8,8,9,11,12,12,12) >

y<-c(0.6,1.6,0.5,1.2,2.0,1.3,2.5,2.2,2.4,1.2,3.5,4.1,5.1,5.7,3.4,9.7,8.6,4.0,5.5,10.5,17.5,13.4,4.5,30.4,12.4,13.4,26.2,7.4) > plot(x,y)

> lm.sol<-lm(y~1+x)

> summary(lm.sol)

Call:

lm(formula = y ~ 1 + x)

Residuals:

Min 1Q Median 3Q Max

-9.8413 -2.3369 -0.0214 1.0592 17.8320

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 freedom Multiple 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,通过F 检验。常数项参数未通过t 检验。 > abline(lm.sol)

> y.yes<-resid(lm.sol) > y.fit<-predict(lm.sol) > y.rst<-rstandard(lm.sol) > plot(y.yes~y.fit)

搜索更多关于: 统计建模与R软件 的文档
统计建模与R软件.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c1dcuj6idyr553972zwpb_7.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top