[R] anova.gls from nlme on multiple arguments within a function	fails
    Markus Jantti 
    markus.jantti at iki.fi
       
    Thu Nov 17 12:17:10 CET 2005
    
    
  
Dear All -- 
I am trying to use within a little table producing code an anova
comparison of two gls fitted objects, contained in a list of such
object, obtained using nlme function gls.
The anova procedure fails to locate the second of the objects.
The following code, borrowed from the help page of anova.gls,
exemplifies:
--------------- start example code ---------------
library(nlme)
## stolen from example(anova.gls)
# AR(1) errors within each Mare
fm1 <- gls(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary,
           correlation = corAR1(form = ~ 1 | Mare))
anova(fm1)
# variance changes with a power of the absolute fitted values?
fm2 <- update(fm1, weights = varPower())
anova(fm1, fm2)
## now define a little function
dummy <- function(obj)
  {
    anova(obj[[1]], obj[[2]])
  }
dummy(list(fm1, fm2))
## compare with what happens in anova.lm:
lm1 <- lm(follicles ~ sin(2*pi*Time), Ovary)
lm2 <- lm(follicles ~ sin(2*pi*Time) + cos(2*pi*Time), Ovary)
dummy(list(lm1, lm2))
------------- end example code ------------------
It is not the end of the world: I can easily work around this. 
But it would be nice to know why this does not work.
Digging around using options(error=recover) did not help my much, I'm
afraid.  
Best,
Markus 
-- 
Markus Jantti
Abo Akademi University
markus.jantti at iki.fi
http://www.iki.fi/~mjantti
    
    
More information about the R-help
mailing list