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

Gavin Simpson ucfagls at gmail.com
Tue Feb 4 00:33:05 CET 2014

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.



On 3 February 2014 15:00, William Shadish <wshadish at ucmerced.edu> wrote:
> 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
> --
> William R. Shadish
> Distinguished Professor
> Founding Faculty
> Mailing Address:
> William R. Shadish
> University of California
> School of Social Sciences, Humanities and Arts
> 5200 North Lake Rd
> Merced CA  95343
> Physical/Delivery Address:
> University of California Merced
> ATTN: William Shadish
> School of Social Sciences, Humanities and Arts
> Facilities Services Building A
> 5200 North Lake Rd.
> Merced, CA 95343
> 209-228-4372 voice
> 209-228-4007 fax (communal fax: be sure to include cover sheet)
> wshadish at ucmerced.edu
> http://faculty.ucmerced.edu/wshadish/index.htm
> http://psychology.ucmerced.edu
> ______________________________________________
> R-help at 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.

Gavin Simpson, PhD

More information about the R-help mailing list