I suppose there may be an error of sorts, but have you considered
the fact that solving the error might not gain you admittance into
heaven? Look at the RHS of the model:
sensor2 + s(site, bs = "re")
... and think about the fact that you are "smoothing" a factor
variable.
- Actually this is ok. mgcv exploits the duality between quadratically
penalized smooths and Gaussian random effects to allow random effects to
be specified this way. bs="re" specifies a Gaussian random effect with
corresponding model matrix given by model.matrix(~site-1). (More
generally s(x,y,z,bs="re") specifies a gaussian random effect with model
matrix given by model.matrix(~x:y:z-1), with obvious generalization to
more or fewer variables). See mgcv help file ?random.effects for more.
best,
Simon
str(gapData)
'data.frame': 2304 obs. of 5 variables: $ sensor1 : num NA NA NA
NA NA NA NA NA NA NA ... $ site : Factor w/ 9 levels
"KRB","NP.FOR",..: 3 3 3 3 3 3 3 3 3 3 ... $ NthSampling: int 7489
7490 7491 7492 7493 7494 7495 7496 7497 7498 ... $ YDay : num
53 53 53 53 53 53 53 53 53 53 ... $ sensor2 : num 0.567 0.566
0.567 0.567 0.569 ...
I'm having trouble making any sense of how that might work. It is, of
course, possible to just do this:
xylemRohWeekXnnSite.fit <- predict.gam(xylemRohWeekXnn.fit.bam,
type="response", se=F)
That gives predictions for the original dataset.
But I think the error might be helpful in alerting one to the
problems with the model.
--
Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
+44 (0)1225 386603 http://people.bath.ac.uk/sw283
______________________________________________
R-help@r-project.org mailing list
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.