[R] mgcv: bam(), error in models with random intercepts and random slopes

Simon Wood simon.wood at bath.edu
Wed Sep 21 09:45:03 CEST 2016

Any chance you could send me the data and exact code that produces this 
(I'll only use the data for investigating this issue of course - often 
data with the predictor replaced by noise will produce the same error, 
if sending the raw data is a problem)?
best, Simon (mgcv maintainer)

On 20/09/16 17:22, Fotis Fotiadis wrote:
> Hi all
> I am using the bam function of the mgcv package to model behavioral data of
> a learning experiment. To model individual variation in learning rate, I am
> testing models with (a) by-participant random intercepts of trial, (b)
> by-participant random slopes and random intercepts of trial, and (c)
> by-participant random smooth terms.
> While all (a) and (c) models converge, I am getting an error for every
> possible variation of a model with random intercepts and random slopes. For
> example:
> m1.rs<-bam(acc~ 1 + igc + s(ctrial) + s(sbj, bs="re") + s(ctrial, sbj,
> bs="re") , data=data_a, family=binomial)
> Error in G$smooth[[i]]$first.para:G$smooth[[i]]$last.para :
>    argument of length 0
> Any idea on what that error might be?
> Thank you in advance for your time.
> Fotis
> P.S.: R version: 3.3.1, mgcv version: 1.8.15

Simon Wood, School of Mathematics, University of Bristol BS8 1TW UK
+44 (0)117 33 18273     http://www.maths.bris.ac.uk/~sw15190

More information about the R-help mailing list