% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/graph_lme.R
\name{augment.graph_lme}
\alias{augment.graph_lme}
\alias{augment}
\title{Augment data with information from a \code{graph_lme} object}
\usage{
\method{augment}{graph_lme}(
  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{
\item{x}{A \code{graph_lme} object.}

\item{newdata}{A \code{data.frame} or a \code{list} containing the covariates, the edge
number and the distance on edge for the locations to obtain the prediction. If \code{NULL}, the fitted values will be given for the original locations where the model was fitted.}

\item{which_repl}{Which replicates to obtain the prediction. If \code{NULL} predictions
will be obtained for all replicates. Default is \code{NULL}.}

\item{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.}

\item{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 \code{TRUE}, the posterior standard deviations of the random effects will also be returned.}

\item{conf_int}{Logical indicating whether or not confidence intervals for the posterior mean of the random effects should be built.}

\item{pred_int}{Logical indicating whether or not prediction intervals for the fitted values should be built. If \code{TRUE}, the confidence intervals for the posterior random effects will also be built.}

\item{level}{Level of confidence and prediction intervals if they are constructed.}

\item{edge_number}{Name of the variable that contains the edge number, the
default is \code{edge_number}.}

\item{distance_on_edge}{Name of the variable that contains the distance on
edge, the default is \code{distance_on_edge}.}

\item{coord_x}{Column (or entry on the list) of the \code{data} that contains
the x coordinate. If not supplied, the column with name "coord_x" will be
chosen. Will not be used if \code{Spoints} is not \code{NULL} or if \code{data_coords} is
\code{PtE}.}

\item{coord_y}{Column (or entry on the list) of the \code{data} that contains
the y coordinate. If not supplied, the column with name "coord_x" will be
chosen. Will not be used if \code{Spoints} is not \code{NULL} or if \code{data_coords} is
\code{PtE}.}

\item{data_coords}{To be used only if \code{Spoints} is \code{NULL}. It decides which
coordinate system to use. If \code{PtE}, the user must provide \code{edge_number} and
\code{distance_on_edge}, otherwise if \code{spatial}, the user must provide
\code{coord_x} and \code{coord_y}.}

\item{normalized}{Are the distances on edges normalized?}

\item{no_nugget}{Should the prediction be done without nugget?}

\item{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.}

\item{...}{Additional arguments.}
}
\value{
A \code{\link[tidyr:tibble]{tidyr::tibble()}} with columns:
\itemize{
\item \code{.fitted} Fitted or predicted value.
\item \code{.relwrconf} Lower bound of the confidence interval of the random effects, if conf_int = TRUE
\item \code{.reuprconf} Upper bound of the confidence interval of the random effects, if conf_int = TRUE
\item \code{.fittedlwrpred} Lower bound of the prediction interval, if conf_int = TRUE
\item \code{.fitteduprpred} Upper bound of the prediction interval, if conf_int = TRUE
\item \code{.fixed} Prediction of the fixed effects.
\item \code{.random} Prediction of the random effects.
\item \code{.resid} The ordinary residuals, that is, the difference between observed and fitted values.
\item \code{.std_resid} The 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.
\item \code{.se_fit} Standard errors of fitted values, if se_fit = TRUE.
\item \code{.sd_post_re} Standard deviation of the posterior mean of the random effects, if se_fit = TRUE.
}
}
\description{
Augment accepts a model object and a dataset and adds information about each observation in the dataset. It includes
predicted values in the \code{.fitted} column, residuals in the \code{.resid} column, and standard errors for the fitted values in a \code{.se.fit} column.
It also contains the New columns always begin with a . prefix to avoid overwriting columns in the original dataset.
}
\seealso{
\link{glance.graph_lme}
}
