答案 0 :(得分:4)
以下是一些可以尝试的事情。
从图中可以清楚地看出,Dosage(第2列)与去除(第3列)的关系比pH(第1列)更密切。
Dosage与去除率的相关性为61%,而pH值的相关性仅为-14%。
由于数据量很小,这两个变量在lm汇总输出中都不具有统计显着性。
基于AIC的逐步回归选择Removal~Dosage模型。
(图表后继续)
matplot(scale(DF), type = "o")
cor(DF)
## pH Dosage Removal
## pH 1.0000000 0.0000000 -0.1418573 <-- -14%
## Dosage 0.0000000 1.0000000 0.6091517 <-- 61%
## Removal -0.1418573 0.6091517 1.0000000
summary(lm(Removal ~., DF))
## Call:
## lm(formula = Removal ~ ., data = DF)
##
## Residuals:
## Min 1Q Median 3Q Max
## -15.5556 -7.0556 -4.8889 0.7778 25.7778
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 69.056 39.047 1.769 0.127
## pH -2.833 6.362 -0.445 0.672 <-- not significant
## Dosage 12.167 6.362 1.912 0.104 <-- not significant
##
## Residual standard error: 15.58 on 6 degrees of freedom
## Multiple R-squared: 0.3912, Adjusted R-squared: 0.1883
## F-statistic: 1.928 on 2 and 6 DF, p-value: 0.2257
fm <- step(lm(Removal ~., DF))
## ...snip...
fm
## Call:
## lm(formula = Removal ~ Dosage, data = DF)
##
## Coefficients:
## (Intercept) Dosage
## 52.06 12.17
注意:可重复形式的输入数据是:
DF <- structure(list(pH = c(5, 5, 5, 6, 6, 6, 7, 7, 7), Dosage = c(0L,
1L, 2L, 0L, 1L, 2L, 0L, 1L, 2L), Removal = c(50, 60, 70, 50,
90, 95, 50, 55, 58)), .Names = c("pH", "Dosage", "Removal"), row.names = c(NA,
-9L), class = "data.frame")