如何比较3组数据,才能理清其中2组数据对第三组数据的影响?
How to compare a 3 sets of data in order to sort out how 2 of these data influence the third one?
我有这样的 3 组数据:
有工具说去除中最重要的变量是什么?是pH值还是剂量?我在考虑 PCA(主成分分析)但是我有点迷路
这里有一些尝试。
从图中可以清楚地看出,剂量(第 2 列)与去除(第 3 列)的关系比 pH(第 1 列)的关系更密切。
此外,剂量与去除率有 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")
我有这样的 3 组数据:
有工具说去除中最重要的变量是什么?是pH值还是剂量?我在考虑 PCA(主成分分析)但是我有点迷路
这里有一些尝试。
从图中可以清楚地看出,剂量(第 2 列)与去除(第 3 列)的关系比 pH(第 1 列)的关系更密切。
此外,剂量与去除率有 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")