Predict function of ngme2 predict using ngme after estimation
Usage
# S3 method for class 'ngme'
predict(
object,
map,
data = NULL,
type = "lp",
group = NULL,
estimator = c("mean", "sd", "0.05q", "0.95q", "median", "mode"),
sampling_size = 500,
burnin_size = 100,
seed = Sys.time(),
train_idx = NULL,
chain_combine = c("param_mean", "predictive_average"),
return_samples = FALSE,
...
)Arguments
- object
a ngme object
- map
a named list (or dataframe) of the locations to make the prediction
- data
a data.frame or matrix of covariates (used for fixed effects) names(loc) corresponding to the name each latent model vector or matrix (n * 2) for spatial coords
- type
what type of prediction, c("fe", "lp", <model_name>) "fe" is fixed effect prediction <model_name> is prediction of a specific model "lp" is linear predictor (including fixed effect and all sub-models) "response" is the linear predictor plus a fresh measurement-noise draw
- group
which filed to predict (used for bivariate model, should be of same length as map)
- estimator
what type of estimator. Options include: - "mean", "median", "mode", "sd": standard estimators - "0.XXXq": any quantile specified as probability (e.g., "0.025q", "0.5q", "0.975q")
- sampling_size
size of posterior sampling
- burnin_size
size of posterior burnin
- seed
random seed
- train_idx
optional vector of training indices to use for posterior sampling. If provided, only these indices from the original data will be used for training, similar to cross-validation. If NULL, uses all original training data.
- chain_combine
how to combine multiple optimization chains:
"param_mean": default behavior using the fitted object parameters."predictive_average": run prediction for each optimization chain and average predictions across chains.
- return_samples
logical; when `TRUE`, attach sample draws for the requested output in `attr(ret, "samples")`. For `type = "response"`, the attached samples are response predictive draws.
- ...
additional arguments (currently unused)
