[R] package mgcv - predict with bam: Error in X[ind, ] : subscript out of bounds
Katharina May
may.katharina at googlemail.com
Thu Jan 30 13:20:10 CET 2014
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
More information about the R-help
mailing list