[R] package mgcv - predict with bam: Error in X[ind, ] : subscript out of bounds
Simon Wood
s.wood at bath.ac.uk
Fri Jan 31 12:57:36 CET 2014
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 code that produces the error, and I'll look at it?
best,
Simon
On 30/01/14 12:20, Katharina May wrote:
> 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 this:
> xylemRohWeekXnn.fit.bam <- bam(sensor1 ~ sensor2 + s(site, bs="re")
> + s(site, NthSampling, bs="re") , data=xylemRohWeekXnn2011,
> na.action=na.omit)
>
> However, than I try to use predict, I get an error:
> gapData <- xylemRohWeekXnn2011[is.na(xylemRohWeekXnn2011[,2]) &
> !is.na(xylemRohWeekXnn2011[,11]),c(2:3,6:7, 11)]
> xylemRohWeekXnnSite.fit <-
> predict.gam(xylemRohWeekXnn.fit.bam,gapData, type="response", se=F)
> Error in X[ind, ] : subscript out of bounds
>
> I was hoping that someone might be able to provide a quick hint on if
> there is an obvious problem or mistake within my model
> declaration/approach?
> I attached the sessionInfo() Output below and the xylemRohWeekXnn2011
> dump can be downloaded here:
> https://webdisk.ads.mwn.de/Handlers/AnonymousDownload.ashx?folder=1a7cbaa4&path=xylemRohWeekXnn2011.txt
> I`m appreciating any help and hints!
>
> Thank you very much, Katharina
>
> -------------------------------------------------------------------------------------------------------------------------------------
> sessionInfo()
> -------------------------------------------------------------------------------------------------------------------------------------
> R version 3.0.2 (2013-09-25)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
> LC_MONETARY=German_Germany.1252
> [4] LC_NUMERIC=C LC_TIME=German_Germany.1252
>
> attached base packages:
> [1] splines stats graphics grDevices utils datasets
> methods base
>
> other attached packages:
> [1] mgcv_1.7-27 plyr_1.8 ggplot2_0.9.3.1 lattice_0.20-24
> gdata_2.13.2 nlme_3.1-113
> [7] zoo_1.7-10 xlsx_0.5.5 xlsxjars_0.5.0 rJava_0.9-6
>
> loaded via a namespace (and not attached):
> [1] colorspace_1.2-4 dichromat_2.0-0 digest_0.6.4
> grid_3.0.2 gtable_0.1.2
> [6] gtools_3.2.1 labeling_0.2 MASS_7.3-29
> Matrix_1.1-2 munsell_0.4.2
> [11] proto_0.3-10 RColorBrewer_1.0-5 reshape2_1.2.2
> scales_0.2.3 stringr_0.6.2
> [16] tools_3.0.2
>
> ______________________________________________
> 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.
>
--
Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
+44 (0)1225 386603 http://people.bath.ac.uk/sw283
More information about the R-help
mailing list