Augment accepts a model object and a dataset and adds information about each observation in the dataset. It includes
predicted values in the .fitted column, residuals in the .resid column, and standard errors for the fitted values in a .se.fit column.
It also contains the New columns always begin with a . prefix to avoid overwriting columns in the original dataset.
Usage
# S3 method for class 'rspde_lme'
augment(
x,
newdata = NULL,
loc = NULL,
mesh = FALSE,
which_repl = NULL,
se_fit = FALSE,
conf_int = FALSE,
pred_int = FALSE,
level = 0.95,
n_samples = 100,
...
)Arguments
- x
A
rspde_lmeobject.- newdata
A
data.frameor alistcontaining the covariates, the edge number and the distance on edge for the locations to obtain the prediction. IfNULL, the fitted values will be given for the original locations where the model was fitted.- loc
Prediction locations. Can either be a
data.frame, amatrixor a character vector, that contains the names of the columns of the coordinates of the locations. For models usingmetric_graphobjects, plase useedge_numberanddistance_on_edgeinstead.- mesh
Obtain predictions for mesh nodes? The graph must have a mesh, and either
only_latentis set to TRUE or the model does not have covariates.- which_repl
Which replicates to obtain the prediction. If
NULLpredictions will be obtained for all replicates. Default isNULL.- se_fit
Logical indicating whether or not a .se.fit column should be added to the augmented output. If TRUE, it only returns a non-NA value if type of prediction is 'link'.
- conf_int
Logical indicating whether or not confidence intervals for the fitted variable should be built.
- pred_int
Logical indicating whether or not prediction intervals for future observations should be built.
- level
Level of confidence and prediction intervals if they are constructed.
- n_samples
Number of samples when computing prediction intervals.
- ...
Additional arguments. Expert use only.
Value
A tidyr::tibble() with columns:
.fittedFitted or predicted value..fittedlwrconfLower bound of the confidence interval, if conf_int = TRUE.fitteduprconfUpper bound of the confidence interval, if conf_int = TRUE.fittedlwrpredLower bound of the prediction interval, if pred_int = TRUE.fitteduprpredUpper bound of the prediction interval, if pred_int = TRUE.fixedPrediction of the fixed effects..randomPrediction of the random effects..residThe ordinary residuals, that is, the difference between observed and fitted values..se_fitStandard errors of fitted values, if se_fit = TRUE.
