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

2014-02-03 Thread Simon Wood
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.

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

2014-02-03 Thread Simon Wood
Hi Katharina, Thanks for sending this. The problem is that the prediction data for site contain levels not available in the (useable non-NA) fit data... levels(m$model$site) [1] KRB NP.FOR WKS.FRE WKS.KRE WKS.RIE WKS.WUE levels(gapData$site) [1] KRB NP.FOR RIE.2 WKS.BBR WKS.FRE

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

2014-02-03 Thread Katharina May
Hi Simon, many thanks for looking into this and making me understand the problem! I'll adjust my factor levels right away... Best, Katharina On 3 February 2014 12:42, Simon Wood s.w...@bath.ac.uk wrote: Hi Katharina, Thanks for sending this. The problem is that the prediction data for site

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

2014-02-03 Thread William Shadish
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

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

2014-02-03 Thread Gavin Simpson
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

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

2014-02-02 Thread Katharina May
Hi Simon, thank you for your reply, I really appreciate any help to understand the problem here... Unluckily the package upgrade didn't help with this issue. An example reproducing the error, and a current sessionInfo() Output can be found below. Many thanks once again, Katharina R

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

2014-02-02 Thread David Winsemius
On Feb 2, 2014, at 9:52 AM, Katharina May wrote: Hi Simon, thank you for your reply, I really appreciate any help to understand the problem here... Unluckily the package upgrade didn't help with this issue. An example reproducing the error, and a current sessionInfo() Output can be found

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

2014-01-31 Thread Simon Wood
Hi Katharina, Could you try upgrading to mgcv_1.7-28, please? There was an occasional problem to do with matching factor levels, which is fixed, but I'm not very confident that is what is going on. If upgrading doesn't work, is there any chance you could send me a small example dataset and

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

2014-01-30 Thread Katharina May
Dear R-Community, I`m trying to apply the mgcv package to fill gaps in sensor data from different sites (9 sites, 2 sensors per site) and do the filling on a site-wise level. Based on http://r.789695.n4.nabble.com/mgcv-gamm-predict-to-reflect-random-s-effects-td3622738.html my model looks like