# [R] getting p-value for comparing to gam's from gmcv

David Winsemius dwinsemius at comcast.net
Thu Oct 31 17:58:31 CET 2013

```On Oct 30, 2013, at 7:27 PM, Robert Lynch wrote:

> I am trying to compare two different GAM fits.
> I have something like
> Course.bam20 <-bam(zGrade ~ Rep + ISE   + White + Female + Years + AP_TOTAL
> + MATH + HSGPA+ EOP + factor(P7APrior, ordered = FALSE)+s(Yfrm7A,k=20),
> data= Course, na.action = na.exclude,samfrac =0.1)
>
> Course.bam4 <-bam(zGrade ~ Rep + ISE   + White + Female + Years + AP_TOTAL
> + MATH + HSGPA+ EOP + factor(P7APrior, ordered = FALSE)+s(Yfrm7A,k=4),
> data= Course, na.action = na.exclude,samfrac =0.1)
>
> anova(Course.bam20, Course.bam4)
>
> Model 1: zGrade ~ Rep + ISE + White + Female + Years + AP_TOTAL + MATH +
>    HSGPA + EOP + factor(P7APrior, ordered = FALSE) + s(Yfrm7A,
>    k = 20)
> Model 2: zGrade ~ Rep + ISE + White + Female + Years + AP_TOTAL + MATH +
>    HSGPA + EOP + factor(P7APrior, ordered = FALSE) + s(Yfrm7A,
>    k = 4)
>  Resid. Df Resid. Dev      Df Deviance
> 1    4721.7     1907.0
> 2    4724.5     1913.5 -2.7919  -6.4986
>
> How can I get a p-value out of the anova?
>
> 	[[alternative HTML version deleted]]

I suspect that the reason no one has answered this is that it appears to be a) a request to explain a fairly simple step in statistical analysis and such requests are generally considered off-topic on r-help, and supporting that notion ...  b) your naming conventions suggests that this is homework, also off-topic here.

>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help

If you wnat to appeal this "decision", then please to read the Posting Guide first.

> and provide commented, minimal, self-contained, reproducible code.

--

David Winsemius
Alameda, CA, USA

```