[R] gamm error message

Simon Wood sw283 at maths.bath.ac.uk
Wed Jun 21 21:54:56 CEST 2006


This is a bug. The `prior.weights' element of the the faked `gam' object 
(i.e. `test$gam$prior.wieghts' below) has been set to the varIdent() 
variance function, rather than the weights that this eventually 
represents. I'll fix this for the next patch release, (as soon as I get 
any time to do research rather than doing dummy runs of describing how 
good the research might be that I would be doing if I was doing it instead 
of practicing writing about it).

In the meantime if you do something like:
   test$gam$prior.weights <- rep(1,length(Z))
then
   summary(test.gam)
will work, but you should ignore the reported r^2.

best,
Simon

>- Simon Wood, Mathematical Sciences, University of Bath, Bath BA2 7AY 
>-             +44 (0)1225 386603         www.maths.bath.ac.uk/~sw283/


On Tue, 6 Jun 2006, Highland Statistics Ltd. wrote:

> Hello,
>
> Why would I get an error message  with the following code for gamm? I
> want to fit the a gam with different variances per stratum.
>
>
> library(mgcv)
> library(nlme)
>
> Y<-rnorm(100)
> X<-rnorm(100,sd=2)
> Z<-rep(c(T,F),each=50)
>
> test<-gamm(Y~s(X),weights=varIdent(form=~1|Z))
>
> summary(test$lme)   #ok
>
> summary(test$gam)
>
> Gives an error message:
> Error in inherits(x, "data.frame") : dim<- : dims [product 100] do
> not match the length of object [0]
>
>
> All the other output seems to be ok:
>
>
> > summary(test$lme)
> Linear mixed-effects model fit by maximum likelihood
>  Data: strip.offset(mf)
>        AIC      BIC    logLik
>   299.9468 312.9727 -144.9734
>
> Random effects:
>  Formula: ~Xr.1 - 1 | g.1
>  Structure: pdIdnot
>                Xr.11        Xr.12        Xr.13        Xr.14        Xr.15
> StdDev: 0.0001073404 0.0001073404 0.0001073404 0.0001073404 0.0001073404
>                Xr.16        Xr.17        Xr.18 Residual
> StdDev: 0.0001073404 0.0001073404 0.0001073404 1.045916
>
> Variance function:
>  Structure: Different standard deviations per stratum
>  Formula: ~1 | Z
>  Parameter estimates:
>      TRUE     FALSE
> 1.0000000 0.9721987
> Fixed effects: y ~ X.0 - 1
>                      Value Std.Error DF    t-value p-value
> X.0(Intercept)  0.04426102 0.1041540 98  0.4249573  0.6718
> X.0s(X)Fx1     -0.01053900 0.1039558 98 -0.1013796  0.9195
>  Correlation:
>            X.0(I)
> X.0s(X)Fx1 0.002
>
> Standardized Within-Group Residuals:
>         Min          Q1         Med          Q3         Max
> -1.96955692 -0.81101014  0.07004034  0.72528662  2.44244302
>
> Number of Observations: 100
> Number of Groups: 1
>
>
>
>
>
> Kind regards,
>
> Alain
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



More information about the R-help mailing list