Print out progress reports of add1()

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Print out progress reports of add1()

Chao Liu
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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Print out progress reports of add1()

Duncan Murdoch-2
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]]
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Print out progress reports of add1()

Chao Liu
Thank you Duncan. Do you by chance know any way around this?

On Mon, Jan 18, 2021 at 11:58 AM Duncan Murdoch <[hidden email]>
wrote:

> 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]]
> >
> > ______________________________________________
> > [hidden email] 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.
> >
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Print out progress reports of add1()

Duncan Murdoch-2
On 18/01/2021 12:08 p.m., Chao Liu wrote:
> Thank you Duncan. Do you by chance know any way around this?

I don't see any need for a trace when there's only one fit being done.
The tests that are shown are all you need.

Duncan Murdoch


>
> On Mon, Jan 18, 2021 at 11:58 AM Duncan Murdoch
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     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]]
>      >
>      > ______________________________________________
>      > [hidden email] <mailto:[hidden email]> mailing list
>     -- To UNSUBSCRIBE and more, see
>      > https://stat.ethz.ch/mailman/listinfo/r-help
>     <https://stat.ethz.ch/mailman/listinfo/r-help>
>      > PLEASE do read the posting guide
>     http://www.R-project.org/posting-guide.html
>     <http://www.R-project.org/posting-guide.html>
>      > and provide commented, minimal, self-contained, reproducible code.
>      >
>

______________________________________________
[hidden email] 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.