Hello Jeff and listserv,
I'm worriedI've been misunderstanding the t.cols argument in prediction of various models, so I'm hoping to get some advice/clarification.
My current use is in a set of stPGOcc and svcTPGOcc models. The data set I'm using covers 19 years (the structure of data.list$y is [1:1134, 1:19, 1:26]). Many sites are surveyed only a couple years out of that time frame (with many missing years in between). I tried both ar1 = TRUE and ar1 = FALSE plus a random effect for year (ar1 = FALSE + RE for year performed better so I used that form).
For prediction, my goal is to predict only as close to current time as possible. So when generating X.0, I use only the most recent year of data available for the covariates in the model. So, the dimensions of X.0 are:
dim1 = number of sites for prediction (which is many more than our sampled sites),
dim2 = 1 (a single year of covariate values, i.e., latest year available for each covariate),
dim3 = 7 (Intercept plus number of covariates in my model),
and I set t.cols = 1 in the predict function.
Overall my predict set up is this (I'm separating the prediction into chunks because of the number of sites and computing limits):
tmp.X.pred <- array(NA, dim = c(length(starts[i]:stops[i]), 1, 7))
tmp.X.pred[,,1] <- 1
tmp.X.pred[,,2] <- annual_temp.0[starts[i]:stops[i]]
tmp.X.pred[,,3] <- hii.0[starts[i]:stops[i]]
tmp.X.pred[,,4] <- ndwi.0[starts[i]:stops[i]]
tmp.X.pred[,,5] <- pntv.0[starts[i]:stops[i]]
tmp.X.pred[,,6] <- precip_seasonality.0[starts[i]:stops[i]]
tmp.X.pred[,,7] <- temp_seasonality.0[starts[i]:stops[I]]
pred <- predict(
mod,
X.0 = tmp.X.pred,
t.cols = 1,
coords = pred_coords[starts[i]:stops[i],],
type = "occupancy",
ignore.RE = TRUE)
This ran fine for the stPGOcc models, but I am now getting this error when running it for the svcTPGocc models:
"error: when predicting at sampled sites using svcTPGOcc, you must predict across all primary time periods"
I'm worried that I might not understand the requirements of t.cols and/or that I'm screwing something up here trying to predict to only the latest year of covariate data available.
Would appreciate any thoughts or advice.
Thanks in advance, take care!
Sara