Does R's drop1 account for the non-interaction terms when there are both interaction terms and non-interaction terms in the model?

StackOverflow https://stackoverflow.com/questions/15434103

  •  24-03-2022
  •  | 
  •  

문제

My question is in the title. I am unsure if the non-interaction terms are being accounted for as the output of drop1 does not include them, but only the interaction terms. The code and output is as follows:

> 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`
도움이 되었습니까?

해결책

Yes, the drop1 functions accounts for the lower-level terms if an interaction is present. If a predictor is part of an interaction, it will not be dropped.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top