1
我的問題在標題中。我不確定是否因爲drop1的輸出不包括它們而僅考慮了交互項,因此會計入非交互項。的代碼,並輸出如下:當模型中存在交互項和非交互項時,R的drop1是否解釋了非交互項?
> temp = lm(auto.mpg.data$mpg ~ auto.mpg.data$weight + auto.mpg.data$model_year + auto.mpg.data$origin + auto.mpg.data$weight:auto.mpg.data$model_year + auto.mpg.data$weight:auto.mpg.data$origin + auto.mpg.data$model_year:auto.mpg.data$origin)
> drop1(temp, test="F")
Single term deletions
Model:
auto.mpg.data$mpg ~ auto.mpg.data$weight + auto.mpg.data$model_year +
auto.mpg.data$origin + auto.mpg.data$weight:auto.mpg.data$model_year +
auto.mpg.data$weight:auto.mpg.data$origin + auto.mpg.data$model_year:auto.mpg.data$origin
Df Sum of Sq RSS AIC F value Pr(>F)
<none> 3769.8 908.83
auto.mpg.data$weight:auto.mpg.data$model_year 1 300.625 4070.4 937.37 31.1807 4.407e-08 ***
auto.mpg.data$weight:auto.mpg.data$origin 1 94.557 3864.3 916.69 9.8074 0.001869 **
auto.mpg.data$model_year:auto.mpg.data$origin 1 0.027 3769.8 906.83 0.0028 0.958085
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 `enter code here`
一個忠告,不要在爲線性模型創建公式時使用'data $ column'。使用'lm(mpg〜(weight + model_year + origin)^ 2,data = auto.mpg.data)'來獲得相同的模型。 – mnel 2013-03-15 01:16:21
這是值得閱讀http://www.stats.ox.ac.uk/pub/MASS3/Exegeses.pdf – mnel 2013-03-15 01:20:31
這是不是很清楚你的意思是「帳戶」。 'drop1'只是放棄每一項,並將沒有它的模型與完整模型進行比較。 – Ista 2013-03-15 01:29:59