[R] missing F statistic in anova.gam

Michael A. Milligan pakdke at yahoo.com
Sun Aug 3 19:25:27 CEST 2008


Hello,

I have encountered results which I am not sure how to interpret when using anova.gam to compare 2 different models.  For certain tests the results do not include an F- or associated p-statistic.  This happens when comparing certain models and not others, and I do not discern a patten explaining when the test works and when it does not.

Here is some output for some of my tests (y#, x1, and x2 are each 1-variable vectors, while X is a matrix of several variables).

These results compare a model additively separable in x1 and x2 with a model in which they are not assumed additively separable:

Model 1: y1 ~ s(x1) + s(x2) + X
Model 2: y1 ~ X + s(x1, x2)
  Resid. Df Resid. Dev        Df Deviance F Pr(>F)
1 3815.5111    29860.6                            
2 3810.3577    29898.8    5.1534    -38.2         

No F statistic is computed, though the statistic is computed when other dependent variables are used.

Here are some results for a similar analysis with a different dependent variable:

Model 1: y2 ~ x1 + x2 + X
Model 2: y2 ~ s(x1) + s(x2) + X
  Resid. Df Resid. Dev       Df Deviance      F  Pr(>F)  
1  3822.000      33970                                   
2  3819.535      33921    2.465       49 2.2257 0.09578 .
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
> anova(EqQuad,EqGamAS,test="F")
Analysis of Deviance Table

Model 1: y2 ~ x1 + x1sq + x2 + x2sq + x1x2 + X
Model 2: y2 ~ s(x1) + s(x2) + X
   Resid. Df Resid. Dev         Df Deviance F Pr(>F)
1 3819.00000      33955                             
2 3819.53502      33921   -0.53502       34      

Model 1: y2 ~ s(x1) + s(x2) + X
Model 2: y2 ~ X + s(x1, x2)
  Resid. Df Resid. Dev        Df Deviance      F  Pr(>F)  
1 3819.5350      33921                                    
2 3821.8323      33967   -2.2973      -46 2.2391 0.09863 .

An F statistic is reported for comparing the linear model with the additively separable semiparametric model, and for comparing the additively separable model with the non-additvely separable model, but not when comparing the partially quadratic model (x#sq means x#^2) with the additively separable semiparametric model.

I'm happy to provide more information about my dataset or my estimation, but I don't know what might be helpful, as I really don't understand at all the cause of this problem.  My dataset is not small (about 3800 observations).  I will say that x2 has many observations of value 0.

I appreciate any light anyone can shed on this issue.  Thank you very much.

Michael Milligan
Ph.D. Candidate
University of New Mexico






More information about the R-help mailing list