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

William Shadish wshadish at ucmerced.edu
Mon Feb 3 22:00:02 CET 2014

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.


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

More information about the R-help mailing list