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 'graph_lme'
augment(
x,
newdata = NULL,
which_repl = NULL,
sd_post_re = FALSE,
se_fit = FALSE,
conf_int = FALSE,
pred_int = FALSE,
level = 0.95,
edge_number = "edge_number",
distance_on_edge = "distance_on_edge",
coord_x = "coord_x",
coord_y = "coord_y",
data_coords = c("PtE", "spatial"),
normalized = FALSE,
no_nugget = FALSE,
check_euclidean = FALSE,
...
)Arguments
- x
A
graph_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.- which_repl
Which replicates to obtain the prediction. If
NULLpredictions will be obtained for all replicates. Default isNULL.- sd_post_re
Logical indicating whether or not a .sd_post_re column should be added to the augmented output containing the posterior standard deviations of the random effects.
- se_fit
Logical indicating whether or not a .se_fit column should be added to the augmented output containing the standard errors of the fitted values. If
TRUE, the posterior standard deviations of the random effects will also be returned.- conf_int
Logical indicating whether or not confidence intervals for the posterior mean of the random effects should be built.
- pred_int
Logical indicating whether or not prediction intervals for the fitted values should be built. If
TRUE, the confidence intervals for the posterior random effects will also be built.- level
Level of confidence and prediction intervals if they are constructed.
- edge_number
Name of the variable that contains the edge number, the default is
edge_number.- distance_on_edge
Name of the variable that contains the distance on edge, the default is
distance_on_edge.- coord_x
Column (or entry on the list) of the
datathat contains the x coordinate. If not supplied, the column with name "coord_x" will be chosen. Will not be used ifSpointsis notNULLor ifdata_coordsisPtE.- coord_y
Column (or entry on the list) of the
datathat contains the y coordinate. If not supplied, the column with name "coord_x" will be chosen. Will not be used ifSpointsis notNULLor ifdata_coordsisPtE.- data_coords
To be used only if
SpointsisNULL. It decides which coordinate system to use. IfPtE, the user must provideedge_numberanddistance_on_edge, otherwise ifspatial, the user must providecoord_xandcoord_y.- normalized
Are the distances on edges normalized?
- no_nugget
Should the prediction be done without nugget?
- check_euclidean
Check if the graph used to compute the resistance distance has Euclidean edges? The graph used to compute the resistance distance has the observation locations as vertices.
- ...
Additional arguments.
Value
A tidyr::tibble() with columns:
.fittedFitted or predicted value..relwrconfLower bound of the confidence interval of the random effects, if conf_int = TRUE.reuprconfUpper bound of the confidence interval of the random effects, if conf_int = TRUE.fittedlwrpredLower bound of the prediction interval, if conf_int = TRUE.fitteduprpredUpper bound of the prediction interval, if conf_int = TRUE.fixedPrediction of the fixed effects..randomPrediction of the random effects..residThe ordinary residuals, that is, the difference between observed and fitted values..std_residThe standardized residuals, that is, the ordinary residuals divided by the standard error of the fitted values (by the prediction standard error), if se_fit = TRUE or pred_int = TRUE..se_fitStandard errors of fitted values, if se_fit = TRUE..sd_post_reStandard deviation of the posterior mean of the random effects, if se_fit = TRUE.
