Skip to content

package mgcv - predict with bam: Error in X[ind, ] :, subscript out of bounds

2 messages · William Shadish, Gavin Simpson

#
Dear Simon, your note below says "bs="re" specifies a Gaussian random 
effect ". I have been using bs = "re" for data modeled with Poisson and 
binomial distributions, or variants thereof (e.g., quasi-Poisson). Have 
I erred in assuming bs ="re" can be used to obtain random effects for 
such data? Will Shadish

- 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
#
The two distributions are different. The random effect is assumed to
be a Gaussian random variable, just as it is with the GLMMs in the
lme4 package. It is fine to use such a random effect within a GAM with
a non-Gaussian error distribution, like the ones you describe using.

HTH

Gavin
On 3 February 2014 15:00, William Shadish <wshadish at ucmerced.edu> wrote: