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 Febru

[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?

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 wrote: > Hi Katharina, > > Thanks for sending this. > > The problem is that the prediction data for site contain leve

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"

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

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

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 Code

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 c

[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 th

Re: [R] package mgcv inconsistency in help files? cyclic P-spline "cs" not cyclic?

2010-06-04 Thread Gavin Simpson
On Fri, 2010-06-04 at 15:56 +0200, Joris Meys wrote: > Dear all, > > I'm a bit stunned by the behaviour of a gam model using cyclic > P-spline smoothers. I cannot provide the data, as I have about 61.000 > observations from a time series. > > I checked the help files ?smooth.terms, and found ab

[R] package mgcv inconsistency in help files? cyclic P-spline "cs" not cyclic?

2010-06-04 Thread Joris Meys
Dear all, I'm a bit stunned by the behaviour of a gam model using cyclic P-spline smoothers. I cannot provide the data, as I have about 61.000 observations from a time series. I use the following model : testgam <- gam(NO~s(x)+s(y,bs="cs")+s(DD,bs="cs")+s(TT),data=Final) The problem lies with t

[R] package mgcv - actual bases

2008-06-09 Thread Amandine PIERROT
Thank you for your answer ! Actually I'm doing an internship about GAM for mid-term french load forecasting (at "EDF", Electricité De France). I'm working with your book and I was asked to simulate data on my own, in order to see if gam (from mgcv) gave good estimations of the functions I had

Re: [R] package mgcv

2008-06-09 Thread Simon Wood
Amandine, The coefficients of the splines are in the `coefficients' part of the fitted `gam' object, but what they mean depends on what basis you used Chapter 4 of Wood S.N. (2006) Generalized Additive Models: An Introduction with R. Chapman and Hall/CRC Press, gives the details for all the

[R] package mgcv

2008-06-09 Thread Amandine PIERROT
Hello ! I am working on generalized additive models using the package mgcv, and I would like to know where I could find information about the estimated splines so I could reconstruct the full function instead of just having values at given points (with predict.gam, type="terms") ? Thanks in adv