Function for prediction at new locations for multi-season multi-species spatially-varying coefficient occupancy models
predict.svcTMsPGOcc.Rd
The function predict
collects posterior predictive samples for a set of new locations given an object of class `svcTMsPGOcc`. Prediction is possible for both the latent occupancy state as well as detection. Predictions are currently only possible for sampled primary time periods.
Usage
# S3 method for svcTMsPGOcc
predict(object, X.0, coords.0, t.cols, n.omp.threads = 1,
verbose = TRUE, n.report = 100,
ignore.RE = FALSE, type = 'occupancy', grid.index.0, ...)
Arguments
- object
an object of class svcTMsPGOcc
- X.0
the design matrix of covariates at the prediction locations. This should be a three-dimensional array, with dimensions corresponding to site, primary time period, and covariate, respectively. Note that the first covariate should consist of all 1s for the intercept if an intercept is included in the model. If random effects are included in the occupancy (or detection if
type = 'detection'
) portion of the model, the levels of the random effects at the new locations/time periods should be included as an element of the three-dimensional array. The ordering of the levels should match the ordering used to fit the data insvcTMsPGOcc
. The covariates should be organized in the same order as they were specified in the corresponding formula argument ofsvcTMsPGOcc
. Names of the third dimension (covariates) of any random effects in X.0 must match the name of the random effects used to fit the model, if specified in the corresponding formula argument ofsvcTMsPGOcc
. See example below.- coords.0
the spatial coordinates corresponding to
X.0
. Note thatspOccupancy
assumes coordinates are specified in a projected coordinate system.- t.cols
an indexing vector used to denote which primary time periods are contained in the design matrix of covariates at the prediction locations (
X.0
). The values should denote the specific primary time periods used to fit the model. The values should indicate the columns indata$y
used to fit the model for which prediction is desired. See example below.- n.omp.threads
a positive integer indicating the number of threads to use for SMP parallel processing. The package must be compiled for OpenMP support. For most Intel-based machines, we recommend setting
n.omp.threads
up to the number of hyperthreaded cores. Note,n.omp.threads
> 1 might not work on some systems.- verbose
if
TRUE
, model specification and progress of the sampler is printed to the screen. Otherwise, nothing is printed to the screen.- ignore.RE
logical value that specifies whether or not to remove random unstructured occurrence (or detection if
type = 'detection'
) effects from the subsequent predictions. IfTRUE
, random effects will be included. IfFALSE
, unstructured random effects will be set to 0 and predictions will only be generated from the fixed effects, the spatial random effects, and AR(1) random effects if the model was fit withar1 = TRUE
.- n.report
the interval to report sampling progress.
- type
a quoted keyword indicating what type of prediction to produce. Valid keywords are 'occupancy' to predict latent occupancy probability and latent occupancy values (this is the default), or 'detection' to predict detection probability given new values of detection covariates.
- grid.index.0
an indexing vector used to specify how each row in
X.0
corresponds to the coordinates specified incoords.0
. Only relevant if the spatial random effect was estimated at a higher spatial resolution (e.g., grid cells) than point locations.- ...
currently no additional arguments
Note
When ignore.RE = FALSE
, both sampled levels and non-sampled levels of unstructured random effects are supported for prediction. For sampled levels, the posterior distribution for the random intercept corresponding to that level of the random effect will be used in the prediction. For non-sampled levels, random values are drawn from a normal distribution using the posterior samples of the random effect variance, which results in fully propagated uncertainty in predictions with models that incorporate random effects.
Occurrence predictions at sites that are only sampled for a subset of the total number of primary time periods are obtained directly when fitting the model. See the psi.samples
and z.samples
portions of the output list from the model object of class svcTMsPGOcc
.
Author
Jeffrey W. Doser doserjef@msu.edu,
Andrew O. Finley finleya@msu.edu
Value
A list object of class predict.svcTMsPGOcc
. When type = 'occupancy'
, the list consists of:
- psi.0.samples
a four-dimensional object of posterior predictive samples for the latent occupancy probability values with dimensions corresponding to posterior predictive sample, species, site, and primary time period.
- z.0.samples
a three-dimensional object of posterior predictive samples for the latent occupancy values with dimensions corresponding to posterior predictive sample, species, site, and primary time period.
- w.0.samples
a four-dimensional array of posterior predictive samples for the latent spatial factors with dimensions correpsonding to MCMC sample, latent factor, site, and spatially-varying coefficient.
When type = 'detection'
, the list consists of:
- p.0.samples
a four-dimensional object of posterior predictive samples for the detection probability values with dimensions corresponding to posterior predictive sample, site, and primary time period.
The return object will include additional objects used for standard extractor functions.
Examples
# Simulate Data -----------------------------------------------------------
set.seed(500)
J.x <- 8
J.y <- 8
J <- J.x * J.y
# Years sampled
n.time <- sample(3:10, J, replace = TRUE)
# n.time <- rep(10, J)
n.time.max <- max(n.time)
# Replicates
n.rep <- matrix(NA, J, max(n.time))
for (j in 1:J) {
n.rep[j, 1:n.time[j]] <- sample(2:4, n.time[j], replace = TRUE)
# n.rep[j, 1:n.time[j]] <- rep(4, n.time[j])
}
N <- 7
# Community-level covariate effects
# Occurrence
beta.mean <- c(-3, -0.2, 0.5)
trend <- FALSE
sp.only <- 0
p.occ <- length(beta.mean)
tau.sq.beta <- c(0.6, 1.5, 1.4)
# Detection
alpha.mean <- c(0, 1.2, -1.5)
tau.sq.alpha <- c(1, 0.5, 2.3)
p.det <- length(alpha.mean)
# Random effects
psi.RE <- list()
p.RE <- list()
# Draw species-level effects from community means.
beta <- matrix(NA, nrow = N, ncol = p.occ)
alpha <- matrix(NA, nrow = N, ncol = p.det)
for (i in 1:p.occ) {
beta[, i] <- rnorm(N, beta.mean[i], sqrt(tau.sq.beta[i]))
}
for (i in 1:p.det) {
alpha[, i] <- rnorm(N, alpha.mean[i], sqrt(tau.sq.alpha[i]))
}
sp <- TRUE
svc.cols <- c(1, 2)
p.svc <- length(svc.cols)
n.factors <- 2
phi <- runif(p.svc * n.factors, 3 / .9, 3 / .3)
factor.model <- TRUE
cov.model <- 'exponential'
ar1 <- TRUE
sigma.sq.t <- runif(N, 0.05, 1)
rho <- runif(N, 0.1, 1)
dat <- simTMsOcc(J.x = J.x, J.y = J.y, n.time = n.time, n.rep = n.rep, N = N,
beta = beta, alpha = alpha, sp.only = sp.only, trend = trend,
psi.RE = psi.RE, p.RE = p.RE, factor.model = factor.model,
svc.cols = svc.cols, n.factors = n.factors, phi = phi, sp = sp,
cov.model = cov.model, ar1 = ar1, sigma.sq.t = sigma.sq.t, rho = rho)
# Subset data for prediction
pred.indx <- sample(1:J, round(J * .25), replace = FALSE)
y <- dat$y[, -pred.indx, , , drop = FALSE]
# Occupancy covariates
X <- dat$X[-pred.indx, , , drop = FALSE]
# Prediction covariates
X.0 <- dat$X[pred.indx, , , drop = FALSE]
# Detection covariates
X.p <- dat$X.p[-pred.indx, , , , drop = FALSE]
# Coordinates
coords <- dat$coords[-pred.indx, ]
coords.0 <- dat$coords[pred.indx, ]
occ.covs <- list(occ.cov.1 = X[, , 2],
occ.cov.2 = X[, , 3])
det.covs <- list(det.cov.1 = X.p[, , , 2],
det.cov.2 = X.p[, , , 3])
data.list <- list(y = y, occ.covs = occ.covs,
det.covs = det.covs,
coords = coords)
# Priors
prior.list <- list(beta.comm.normal = list(mean = 0, var = 2.72),
alpha.comm.normal = list(mean = 0, var = 2.72),
tau.sq.beta.ig = list(a = 0.1, b = 0.1),
tau.sq.alpha.ig = list(a = 0.1, b = 0.1),
rho.unif = list(a = -1, b = 1),
sigma.sq.t.ig = list(a = 0.1, b = 0.1),
phi.unif = list(a = 3 / .9, b = 3 / .1))
z.init <- apply(y, c(1, 2, 3), function(a) as.numeric(sum(a, na.rm = TRUE) > 0))
inits.list <- list(alpha.comm = 0, beta.comm = 0, beta = 0,
alpha = 0, tau.sq.beta = 1, tau.sq.alpha = 1,
rho = 0.5, sigma.sq.t = 0.5,
phi = 3 / .5, z = z.init)
# Tuning
tuning.list <- list(phi = 1, rho = 0.5)
# Number of batches
n.batch <- 5
# Batch length
batch.length <- 25
n.burn <- 25
n.thin <- 1
n.samples <- n.batch * batch.length
out <- svcTMsPGOcc(occ.formula = ~ occ.cov.1 + occ.cov.2,
det.formula = ~ det.cov.1 + det.cov.2,
data = data.list,
inits = inits.list,
n.batch = n.batch,
batch.length = batch.length,
accept.rate = 0.43,
ar1 = TRUE,
svc.cols = svc.cols,
NNGP = TRUE,
n.neighbors = 5,
n.factors = n.factors,
cov.model = 'exponential',
priors = prior.list,
tuning = tuning.list,
n.omp.threads = 1,
verbose = TRUE,
n.report = 1,
n.burn = n.burn,
n.thin = n.thin,
n.chains = 1)
#> ----------------------------------------
#> Preparing to run the model
#> ----------------------------------------
#> lambda is not specified in initial values.
#> Setting initial values of the lower triangle to 0
#> ----------------------------------------
#> Building the neighbor list
#> ----------------------------------------
#> ----------------------------------------
#> Building the neighbors of neighbors list
#> ----------------------------------------
#> ----------------------------------------
#> Model description
#> ----------------------------------------
#> Spatial Factor NNGP Multi-season Multi-species Occupancy Model with Polya-Gamma latent
#> variables with 48 sites, 7 species, and 10 primary time periods.
#>
#> Samples per chain: 125 (5 batches of length 25)
#> Burn-in: 25
#> Thinning Rate: 1
#> Number of Chains: 1
#> Total Posterior Samples: 100
#>
#> Number of spatially-varying coefficients: 2
#> Using the exponential spatial correlation model.
#>
#> Using 2 latent spatial factors.
#> Using 5 nearest neighbors.
#>
#> Source compiled with OpenMP support and model fit using 1 thread(s).
#>
#> Adaptive Metropolis with target acceptance rate: 43.0
#> ----------------------------------------
#> Chain 1
#> ----------------------------------------
#> Sampling ...
#> Batch: 1 of 5, 20.00%
#> Coefficient Latent Factor Acceptance Tuning
#> 1 1 76.0 1.02020
#> 1 2 68.0 1.02020
#> 2 1 76.0 1.02020
#> 2 2 68.0 1.02020
#> Species Parameter Acceptance Tuning
#> 1 rho 68.0 0.51010
#> 2 rho 64.0 0.51010
#> 3 rho 88.0 0.51010
#> 4 rho 68.0 0.51010
#> 5 rho 76.0 0.51010
#> 6 rho 88.0 0.51010
#> 7 rho 80.0 0.51010
#> -------------------------------------------------
#> Batch: 2 of 5, 40.00%
#> Coefficient Latent Factor Acceptance Tuning
#> 1 1 56.0 1.03045
#> 1 2 72.0 1.03045
#> 2 1 68.0 1.03045
#> 2 2 84.0 1.03045
#> Species Parameter Acceptance Tuning
#> 1 rho 72.0 0.51523
#> 2 rho 72.0 0.51523
#> 3 rho 68.0 0.51523
#> 4 rho 72.0 0.51523
#> 5 rho 88.0 0.51523
#> 6 rho 68.0 0.51523
#> 7 rho 76.0 0.51523
#> -------------------------------------------------
#> Batch: 3 of 5, 60.00%
#> Coefficient Latent Factor Acceptance Tuning
#> 1 1 68.0 1.04081
#> 1 2 52.0 1.04081
#> 2 1 84.0 1.04081
#> 2 2 60.0 1.04081
#> Species Parameter Acceptance Tuning
#> 1 rho 88.0 0.52041
#> 2 rho 84.0 0.52041
#> 3 rho 80.0 0.52041
#> 4 rho 68.0 0.52041
#> 5 rho 64.0 0.52041
#> 6 rho 76.0 0.52041
#> 7 rho 76.0 0.52041
#> -------------------------------------------------
#> Batch: 4 of 5, 80.00%
#> Coefficient Latent Factor Acceptance Tuning
#> 1 1 52.0 1.05127
#> 1 2 76.0 1.05127
#> 2 1 68.0 1.05127
#> 2 2 64.0 1.05127
#> Species Parameter Acceptance Tuning
#> 1 rho 76.0 0.52564
#> 2 rho 72.0 0.52564
#> 3 rho 80.0 0.52564
#> 4 rho 84.0 0.52564
#> 5 rho 88.0 0.52564
#> 6 rho 44.0 0.52564
#> 7 rho 72.0 0.52564
#> -------------------------------------------------
#> Batch: 5 of 5, 100.00%
summary(out)
#>
#> Call:
#> svcTMsPGOcc(occ.formula = ~occ.cov.1 + occ.cov.2, det.formula = ~det.cov.1 +
#> det.cov.2, data = data.list, inits = inits.list, priors = prior.list,
#> tuning = tuning.list, svc.cols = svc.cols, cov.model = "exponential",
#> NNGP = TRUE, n.neighbors = 5, n.factors = n.factors, n.batch = n.batch,
#> batch.length = batch.length, accept.rate = 0.43, n.omp.threads = 1,
#> verbose = TRUE, ar1 = TRUE, n.report = 1, n.burn = n.burn,
#> n.thin = n.thin, n.chains = 1)
#>
#> Samples per Chain: 125
#> Burn-in: 25
#> Thinning Rate: 1
#> Number of Chains: 1
#> Total Posterior Samples: 100
#> Run Time (min): 0.0088
#>
#> ----------------------------------------
#> Community Level
#> ----------------------------------------
#> Occurrence Means (logit scale):
#> Mean SD 2.5% 50% 97.5% Rhat ESS
#> (Intercept) -3.3761 0.3495 -3.9395 -3.4174 -2.5106 NA 15
#> occ.cov.1 0.4690 0.2859 -0.0675 0.4622 0.9628 NA 36
#> occ.cov.2 0.8956 0.5736 -0.1061 0.9120 1.8918 NA 69
#>
#> Occurrence Variances (logit scale):
#> Mean SD 2.5% 50% 97.5% Rhat ESS
#> (Intercept) 0.5856 0.7889 0.0433 0.3317 3.4290 NA 16
#> occ.cov.1 0.6197 0.4174 0.1596 0.5230 1.6035 NA 35
#> occ.cov.2 3.1358 2.4545 0.7807 2.3574 9.4179 NA 57
#>
#> Detection Means (logit scale):
#> Mean SD 2.5% 50% 97.5% Rhat ESS
#> (Intercept) -0.0442 0.2010 -0.3538 -0.0434 0.3813 NA 44
#> det.cov.1 1.2213 0.3704 0.4155 1.2985 1.7098 NA 100
#> det.cov.2 -1.3102 0.7133 -2.8578 -1.2279 0.1591 NA 50
#>
#> Detection Variances (logit scale):
#> Mean SD 2.5% 50% 97.5% Rhat ESS
#> (Intercept) 0.2050 0.2347 0.0401 0.1447 0.9314 NA 28
#> det.cov.1 1.3907 1.2551 0.2820 0.8844 5.0474 NA 17
#> det.cov.2 3.3405 4.7226 0.4156 1.5539 18.7433 NA 34
#>
#> ----------------------------------------
#> Species Level
#> ----------------------------------------
#> Occurrence (logit scale):
#> Mean SD 2.5% 50% 97.5% Rhat ESS
#> (Intercept)-sp1 -3.8583 0.6182 -5.4566 -3.7876 -2.6966 NA 5
#> (Intercept)-sp2 -3.3938 0.3712 -4.1478 -3.3665 -2.7860 NA 9
#> (Intercept)-sp3 -3.6292 0.4360 -4.2323 -3.7231 -2.5083 NA 5
#> (Intercept)-sp4 -2.8321 0.6465 -3.7498 -3.0934 -1.7281 NA 3
#> (Intercept)-sp5 -3.4121 0.4382 -4.4794 -3.3413 -2.8393 NA 9
#> (Intercept)-sp6 -3.4963 0.3439 -4.1920 -3.4940 -2.9282 NA 13
#> (Intercept)-sp7 -3.6024 0.4333 -4.5418 -3.5582 -2.8465 NA 7
#> occ.cov.1-sp1 0.0136 0.3063 -0.6171 0.0304 0.5464 NA 13
#> occ.cov.1-sp2 0.1304 0.3693 -0.6035 0.2082 0.8206 NA 9
#> occ.cov.1-sp3 0.0843 0.3194 -0.5299 0.0691 0.6640 NA 15
#> occ.cov.1-sp4 0.0965 0.3168 -0.6872 0.1075 0.6357 NA 13
#> occ.cov.1-sp5 1.2095 0.2465 0.8139 1.1824 1.6849 NA 21
#> occ.cov.1-sp6 0.5881 0.3255 -0.0008 0.6512 1.1053 NA 14
#> occ.cov.1-sp7 1.4706 0.5148 0.3582 1.5620 2.2937 NA 6
#> occ.cov.2-sp1 1.3003 0.3995 0.7061 1.2369 2.2593 NA 22
#> occ.cov.2-sp2 2.0746 0.2777 1.4854 2.0884 2.6098 NA 21
#> occ.cov.2-sp3 -0.7888 0.2888 -1.3396 -0.8040 -0.2573 NA 27
#> occ.cov.2-sp4 -0.5775 0.2720 -1.1319 -0.5895 -0.0910 NA 26
#> occ.cov.2-sp5 0.3411 0.3021 -0.3524 0.3589 0.8913 NA 18
#> occ.cov.2-sp6 2.0080 0.3373 1.4592 1.9585 2.6483 NA 15
#> occ.cov.2-sp7 2.9260 0.5167 1.9931 2.9511 3.8630 NA 7
#>
#> Detection (logit scale):
#> Mean SD 2.5% 50% 97.5% Rhat ESS
#> (Intercept)-sp1 0.1990 0.3355 -0.4692 0.1975 0.8135 NA 40
#> (Intercept)-sp2 -0.1769 0.2182 -0.5209 -0.1908 0.2722 NA 48
#> (Intercept)-sp3 -0.0646 0.2966 -0.6354 -0.0698 0.4500 NA 43
#> (Intercept)-sp4 0.0584 0.1911 -0.2766 0.0422 0.4161 NA 69
#> (Intercept)-sp5 0.1424 0.2742 -0.3112 0.1234 0.6840 NA 51
#> (Intercept)-sp6 0.2229 0.2610 -0.2750 0.2274 0.7493 NA 39
#> (Intercept)-sp7 -0.3849 0.2816 -0.9896 -0.3538 0.0497 NA 15
#> det.cov.1-sp1 2.9319 0.6738 1.9426 2.8806 4.4151 NA 19
#> det.cov.1-sp2 0.9748 0.2670 0.4865 0.9911 1.4329 NA 38
#> det.cov.1-sp3 0.1007 0.6389 -1.1233 0.0764 1.2339 NA 31
#> det.cov.1-sp4 0.5407 0.2136 0.0827 0.5561 0.9364 NA 36
#> det.cov.1-sp5 1.8469 0.3910 1.1431 1.8686 2.5647 NA 35
#> det.cov.1-sp6 1.5676 0.3387 0.9389 1.5626 2.2115 NA 29
#> det.cov.1-sp7 1.3889 0.3075 0.8150 1.3872 1.9883 NA 27
#> det.cov.2-sp1 -0.6511 0.4771 -1.6769 -0.5932 0.0906 NA 38
#> det.cov.2-sp2 -0.2977 0.2000 -0.6930 -0.2750 0.0731 NA 90
#> det.cov.2-sp3 -4.2877 1.9126 -9.0545 -3.4591 -2.2855 NA 3
#> det.cov.2-sp4 -1.4425 0.2744 -1.9622 -1.4475 -0.9743 NA 24
#> det.cov.2-sp5 -0.7265 0.3065 -1.4205 -0.7070 -0.1790 NA 30
#> det.cov.2-sp6 -2.1308 0.4312 -2.8834 -2.1789 -1.3725 NA 22
#> det.cov.2-sp7 -1.5891 0.3519 -2.3017 -1.5600 -0.9656 NA 23
#>
#> ----------------------------------------
#> Spatio-temporal Covariance:
#> ----------------------------------------
#> Mean SD 2.5% 50% 97.5% Rhat ESS
#> phi-1-(Intercept) 10.6827 4.8640 4.7713 8.5566 19.3922 NA 11
#> phi-2-(Intercept) 21.5459 5.5072 10.9718 22.6073 29.4404 NA 10
#> phi-1-occ.cov.1 15.7870 6.8645 4.1130 16.4164 27.0621 NA 7
#> phi-2-occ.cov.1 15.0191 5.3840 5.7722 14.5669 25.1125 NA 16
#> sigma.sq.t-sp1 1.1013 1.7352 0.0420 0.5099 4.4786 NA 20
#> sigma.sq.t-sp2 0.3148 0.3147 0.0457 0.1987 1.3781 NA 19
#> sigma.sq.t-sp3 0.8575 1.2088 0.0498 0.2828 5.0274 NA 10
#> sigma.sq.t-sp4 5.0118 4.5068 1.1761 3.5892 17.7620 NA 16
#> sigma.sq.t-sp5 0.8914 0.7928 0.0580 0.7110 2.4268 NA 20
#> sigma.sq.t-sp6 0.6292 0.7769 0.0600 0.3621 2.8410 NA 29
#> sigma.sq.t-sp7 2.9082 2.4520 0.2760 1.9393 10.0092 NA 17
#> rho-sp1 -0.0029 0.4855 -0.8339 0.0752 0.7324 NA 3
#> rho-sp2 0.6561 0.2960 -0.0020 0.8112 0.9537 NA 4
#> rho-sp3 0.3865 0.4240 -0.3296 0.4883 0.9428 NA 4
#> rho-sp4 -0.2984 0.3342 -0.7428 -0.3578 0.4534 NA 7
#> rho-sp5 0.3237 0.4132 -0.4309 0.3327 0.9617 NA 6
#> rho-sp6 -0.5344 0.4160 -0.9690 -0.6282 0.2190 NA 2
#> rho-sp7 0.2590 0.4829 -0.5486 0.3330 0.9142 NA 2
# Predict at new sites across all n.max.years
# Take a look at array of covariates for prediction
str(X.0)
#> num [1:16, 1:10, 1:3] 1 1 1 1 1 1 1 1 1 1 ...
# Subset to only grab time periods 1, 2, and 5
t.cols <- c(1, 2, 5)
X.pred <- X.0[, t.cols, ]
out.pred <- predict(out, X.pred, coords.0, t.cols = t.cols, type = 'occupancy')
#> ----------------------------------------
#> Prediction description
#> ----------------------------------------
#> Spatial Factor NNGP Multi-season, Multi-species Occupancy model with Polya-Gamma latent
#> variable fit with 48 sites and 3 years.
#>
#> Number of covariates 3 (including intercept if specified).
#>
#> Number of spatially-varying covariates 2 (including intercept if specified).
#>
#> Using the exponential spatial correlation model.
#>
#> Using 5 nearest neighbors.
#> Using 2 latent spatial factors.
#>
#> Number of MCMC samples 100.
#>
#> Predicting at 16 non-sampled locations.
#>
#>
#> Source compiled with OpenMP support and model fit using 1 threads.
#> -------------------------------------------------
#> Predicting
#> -------------------------------------------------
#> Location: 16 of 16, 100.00%
#> Generating latent occupancy state
str(out.pred)
#> List of 6
#> $ z.0.samples : num [1:100, 1:7, 1:16, 1:3] 0 0 0 0 0 0 0 0 0 0 ...
#> $ w.0.samples : num [1:100, 1:2, 1:16, 1:2] 0.985 -1.16 1.352 -0.166 0.328 ...
#> $ psi.0.samples: num [1:100, 1:7, 1:16, 1:3] 0.04339 0.00533 0.17248 0.08771 0.13242 ...
#> $ run.time : 'proc_time' Named num [1:5] 0.025 0.068 0.019 0 0
#> ..- attr(*, "names")= chr [1:5] "user.self" "sys.self" "elapsed" "user.child" ...
#> $ call : language predict.svcTMsPGOcc(object = out, X.0 = X.pred, coords.0 = coords.0, t.cols = t.cols, type = "occupancy")
#> $ object.class : chr "svcTMsPGOcc"
#> - attr(*, "class")= chr "predict.svcTMsPGOcc"
# Extract SVC samples for each species at prediction locations
svc.samples <- getSVCSamples(out, out.pred)
str(svc.samples)
#> List of 2
#> $ (Intercept): num [1:100, 1:7, 1:16] -1.75 -4.07 -1.22 -2.77 -2.57 ...
#> $ occ.cov.1 : num [1:100, 1:7, 1:16] 1.099 1.85 0.425 -0.395 -1.322 ...