- 40
- 0
- 约1.34千字
- 约 2页
- 2021-08-31 发布于湖北
- 举报
自编R程序计算判定系数
x1=rchisq(100,6)
x2=rnorm(100,2,1)
err=rnorm(100,0,0.5)
y=2.5+2*x1+1.5*x2+err
plot(x1+x2,y,col=4)
lm(y~x1+x2)
fit=lm(y~x1+x2)
summary(fit)
Call:
lm(formula = y ~ x1 + x2)
Residuals:
Min 1Q Median 3Q Max
-1.30115 -0.32732 0.05836 0.26329 1.20733
Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept) 2.53643 0.15610 16.25 2e-16 ***
x1 1.99801 0.01415 141.18 2e-16 ***
x2 1.48427 0.06030 24.61 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residu
原创力文档

文档评论(0)