| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/stats-loess.R |
| 3 |
\name{augment.loess} |
| 4 |
\alias{augment.loess} |
| 5 |
\alias{loess_tidiers} |
| 6 |
\title{Tidy a(n) loess object} |
| 7 |
\usage{ |
| 8 |
\method{augment}{loess}(x, data = model.frame(x), newdata = NULL, se_fit = FALSE, ...) |
| 9 |
} |
| 10 |
\arguments{ |
| 11 |
\item{x}{A \code{loess} objects returned by \code{\link[stats:loess]{stats::loess()}}.} |
| 12 |
|
| 13 |
\item{data}{A \link[base:data.frame]{base::data.frame} or \code{\link[tibble:tibble]{tibble::tibble()}} containing the original |
| 14 |
data that was used to produce the object \code{x}. Defaults to |
| 15 |
\code{stats::model.frame(x)} so that \code{augment(my_fit)} returns the augmented |
| 16 |
original data. \strong{Do not} pass new data to the \code{data} argument. |
| 17 |
Augment will report information such as influence and cooks distance for |
| 18 |
data passed to the \code{data} argument. These measures are only defined for |
| 19 |
the original training data.} |
| 20 |
|
| 21 |
\item{newdata}{A \code{\link[base:data.frame]{base::data.frame()}} or \code{\link[tibble:tibble]{tibble::tibble()}} containing all |
| 22 |
the original predictors used to create \code{x}. Defaults to \code{NULL}, indicating |
| 23 |
that nothing has been passed to \code{newdata}. If \code{newdata} is specified, |
| 24 |
the \code{data} argument will be ignored.} |
| 25 |
|
| 26 |
\item{se_fit}{Logical indicating whether or not a \code{.se.fit} column should be |
| 27 |
added to the augmented output. For some models, this calculation can be |
| 28 |
somewhat time-consuming. Defaults to \code{FALSE}.} |
| 29 |
|
| 30 |
\item{...}{Additional arguments. Not used. Needed to match generic |
| 31 |
signature only. \strong{Cautionary note:} Misspelled arguments will be |
| 32 |
absorbed in \code{...}, where they will be ignored. If the misspelled |
| 33 |
argument has a default value, the default value will be used. |
| 34 |
For example, if you pass \code{conf.lvel = 0.9}, all computation will |
| 35 |
proceed using \code{conf.level = 0.95}. Two exceptions here are: |
| 36 |
\itemize{ |
| 37 |
\item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if |
| 38 |
it will be ignored. |
| 39 |
\item \code{augment()} methods will warn when supplied a \code{newdata} argument if it |
| 40 |
will be ignored. |
| 41 |
}} |
| 42 |
} |
| 43 |
\description{ |
| 44 |
Tidy summarizes information about the components of a model. |
| 45 |
A model component might be a single term in a regression, a single |
| 46 |
hypothesis, a cluster, or a class. Exactly what tidy considers to be a |
| 47 |
model component varies across models but is usually self-evident. |
| 48 |
If a model has several distinct types of components, you will need to |
| 49 |
specify which components to return. |
| 50 |
} |
| 51 |
\details{ |
| 52 |
When the modeling was performed with \code{na.action = "na.omit"} |
| 53 |
(as is the typical default), rows with NA in the initial data are omitted |
| 54 |
entirely from the augmented data frame. When the modeling was performed |
| 55 |
with \code{na.action = "na.exclude"}, one should provide the original data |
| 56 |
as a second argument, at which point the augmented data will contain those |
| 57 |
rows (typically with NAs in place of the new columns). If the original data |
| 58 |
is not provided to \code{\link[=augment]{augment()}} and \code{na.action = "na.exclude"}, a |
| 59 |
warning is raised and the incomplete rows are dropped. |
| 60 |
|
| 61 |
Note that \code{loess} objects by default will not predict on data |
| 62 |
outside of a bounding hypercube defined by the training data unless the |
| 63 |
original \code{loess} object was fit with |
| 64 |
\verb{control = loess.control(surface = \\"direct\\"))}. See |
| 65 |
\code{\link[stats:predict.loess]{stats::predict.loess()}} for details. |
| 66 |
} |
| 67 |
\examples{ |
| 68 |
|
| 69 |
lo <- loess( |
| 70 |
mpg ~ hp + wt, |
| 71 |
mtcars, |
| 72 |
control = loess.control(surface = "direct") |
| 73 |
) |
| 74 |
|
| 75 |
augment(lo) |
| 76 |
|
| 77 |
# with all columns of original data |
| 78 |
augment(lo, mtcars) |
| 79 |
|
| 80 |
# with a new dataset |
| 81 |
augment(lo, newdata = head(mtcars)) |
| 82 |
|
| 83 |
} |
| 84 |
\seealso{ |
| 85 |
\link[stats:na.action]{stats::na.action} |
| 86 |
|
| 87 |
\code{\link[=augment]{augment()}}, \code{\link[stats:loess]{stats::loess()}}, \code{\link[stats:predict.loess]{stats::predict.loess()}} |
| 88 |
} |
| 89 |
\value{ |
| 90 |
A \code{\link[tibble:tibble]{tibble::tibble()}} with columns: |
| 91 |
\item{.fitted}{Fitted or predicted value.} |
| 92 |
\item{.resid}{The difference between observed and fitted values.} |
| 93 |
\item{.se.fit}{Standard errors of fitted values.} |
| 94 |
|
| 95 |
} |