predict.Hmsc {Hmsc} | R Documentation |
predict
Description
Calculates predicted values from a fitted Hmsc
model.
Usage
## S3 method for class 'Hmsc'
predict(
object,
post = poolMcmcChains(object$postList),
XData = NULL,
X = NULL,
XRRRData = NULL,
XRRR = NULL,
studyDesign = object$studyDesign,
ranLevels = object$ranLevels,
Gradient = NULL,
Yc = NULL,
mcmcStep = 1,
expected = FALSE,
predictEtaMean = FALSE,
predictEtaMeanField = FALSE,
nParallel = 1,
useSocket = TRUE,
...
)
Arguments
object |
a fitted |
post |
a list of posterior samples of the HMSC model. By default uses all samples from the pooled posterior of the hM object. |
XData |
a dataframe specifying the unpreprocessed covariates for the predictions to be made.
Works only if the |
X |
a matrix specifying the covariates for the predictions to be made. Only one of XData and X arguments may be provided. |
XRRRData |
a dataframe of covariates for reduced-rank regression |
XRRR |
a matrix of covariates for reduced-rank regression |
studyDesign |
a matrix, specifying the structure of the study design for the prediction.
Requirements are similar to those of the |
ranLevels |
a list of |
Gradient |
an object returned by
|
Yc |
a matrix of the outcomes that are assumed to be known for
conditional predictions. Cannot be used together with
|
mcmcStep |
the number of extra mcmc steps used for updating the random effects |
expected |
boolean flag indicating whether to return the location parameter of the observation models or sample the values from those. |
predictEtaMean |
boolean flag indicating whether to use the estimated mean values of posterior predictive distribution for random effets corresponding for the new units. |
predictEtaMeanField |
boolean flag indicating whether to use draws from the mean-field of the posterior predictive distribution for random effets corresponding for the new units. |
nParallel |
Number of parallel processes. Parallel processing
is only useful with new |
useSocket |
(logical) Use socket clusters in parallel
proecessing; these are the only alternative in Windows, but in
other systems this should be usually set |
... |
other arguments passed to functions. |
Details
In mcmcStep,the number of extra mcmc steps used for updating the random effects
for the Eta parameters, starting from the samples of the fitted Hmsc model in order to
account for the conditional infromation provided in the Yc argument. The higher this number is,
the more the obtained updated samples are unaffected by the posterior estimates of latent factors
in the model fitted to the training data and more resembles the true conditional posterior. However,
the elapsed time for conditional prediction grows approximately linearly as this parameter increases.
The exact number for sufficient is problem-dependent and should be assessed by e.g. gradually
increasing this parameter till the stationarity of the produced predictions.
Value
A list of length length(post)
, each element of which contains a sample from the posterior
predictive distribution (given the sample of the Hmsc model parameters in the corresponding element of
the post
argument)