You are using add1 on an "lm" object, and add1.lm doesn't have a
trace
parameter.
Duncan Murdoch
On 18/01/2021 10:55 a.m., Chao Liu wrote:> I have a few questions about using add1(). First of all, according to the R
> document of add1(), the trace = TRUE function prints out progress reports
> but my attempts to do this have failed several times. So how do we print
> out the progress reports of adding terms to the model so as to test for
> improved fit (or not)? Also, why the LRT (likelihood-ratio test) value is
> not in the output? Any help is greatly appreciated! Example as follows:
>
> require(graphics); require(utils)
> lm1 <- lm(Fertility ~ ., data = swiss)
> add1(lm1, scope = .~. + .^2, test="Chisq", trace = TRUE)
>
> #It seems that no progress report has been printed. Also `LRT` is missing
> Single term additions
>
> Model:
> Fertility ~ Agriculture + Examination + Education + Catholic +
> Infant.Mortality
> Df Sum of Sq RSS AIC Pr(>Chi)
> <none> 2105 191
> Agriculture:Examination 1 10.7 2094 192 0.6251
> Agriculture:Education 1 1.8 2103 193 0.8399
> Agriculture:Catholic 1 75.0 2030 191 0.1915
> Agriculture:Infant.Mortality 1 4.4 2101 193 0.7528
> Examination:Education 1 48.7 2056 192 0.2943
> Examination:Catholic 1 40.8 2064 192 0.3378
> Examination:Infant.Mortality 1 65.9 2039 191 0.2216
> Education:Catholic 1 278.2 1827 186 0.0099 **
> Education:Infant.Mortality 1 93.0 2012 191 0.1451
> Catholic:Infant.Mortality 1 2.4 2103 193 0.8184
> ---
> Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
>
> Best,
>
> Chao
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>