| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/stats-decompose.R |
| 3 |
\name{augment.stl} |
| 4 |
\alias{augment.stl} |
| 5 |
\title{Augment data with information from a(n) stl object} |
| 6 |
\usage{ |
| 7 |
\method{augment}{stl}(x, data = NULL, weights = TRUE, ...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{x}{An \code{stl} object returned from \code{\link[stats:stl]{stats::stl()}}.} |
| 11 |
|
| 12 |
\item{data}{Ignored, included for consistency with the augment generic signature only.} |
| 13 |
|
| 14 |
\item{weights}{Logical indicating whether or not to include the robust |
| 15 |
weights in the output.} |
| 16 |
|
| 17 |
\item{...}{Additional arguments. Not used. Needed to match generic |
| 18 |
signature only. \strong{Cautionary note:} Misspelled arguments will be |
| 19 |
absorbed in \code{...}, where they will be ignored. If the misspelled |
| 20 |
argument has a default value, the default value will be used. |
| 21 |
For example, if you pass \code{conf.lvel = 0.9}, all computation will |
| 22 |
proceed using \code{conf.level = 0.95}. Two exceptions here are: |
| 23 |
\itemize{ |
| 24 |
\item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if |
| 25 |
it will be ignored. |
| 26 |
\item \code{augment()} methods will warn when supplied a \code{newdata} argument if it |
| 27 |
will be ignored. |
| 28 |
}} |
| 29 |
} |
| 30 |
\value{ |
| 31 |
A \link[tibble:tibble]{tibble::tibble} with one row for each observation in the |
| 32 |
original times series: |
| 33 |
|
| 34 |
\item{\code{.seasonal}}{The seasonal component of the decomposition.} |
| 35 |
\item{\code{.trend}}{The trend component of the decomposition.} |
| 36 |
\item{\code{.remainder}}{The remainder, or "random" component of the |
| 37 |
decomposition.} |
| 38 |
\item{\code{.weight}}{The final robust weights, if requested.} |
| 39 |
\item{\code{.seasadj}}{The seasonally adjusted (or "deseasonalised") |
| 40 |
series.} |
| 41 |
} |
| 42 |
\description{ |
| 43 |
Augment accepts a model object and a dataset and adds |
| 44 |
information about each observation in the dataset. Most commonly, this |
| 45 |
includes predicted values in the \code{.fitted} column, residuals in the |
| 46 |
\code{.resid} column, and standard errors for the fitted values in a \code{.se.fit} |
| 47 |
column. New columns always begin with a \code{.} prefix to avoid overwriting |
| 48 |
columns in the original dataset. |
| 49 |
|
| 50 |
Users may pass data to augment via either the \code{data} argument or the |
| 51 |
\code{newdata} argument. If the user passes data to the \code{data} argument, |
| 52 |
it \strong{must} be exactly the data that was used to fit the model |
| 53 |
object. Pass datasets to \code{newdata} to augment data that was not used |
| 54 |
during model fitting. This still requires that at least all predictor |
| 55 |
variable columns used to fit the model are present. If the original outcome |
| 56 |
variable used to fit the model is not included in \code{newdata}, then no |
| 57 |
\code{.resid} column will be included in the output. |
| 58 |
|
| 59 |
Augment will often behave differently depending on whether \code{data} or |
| 60 |
\code{newdata} is given. This is because there is often information |
| 61 |
associated with training observations (such as influences or related) |
| 62 |
measures that is not meaningfully defined for new observations. |
| 63 |
|
| 64 |
For convenience, many augment methods provide default \code{data} arguments, |
| 65 |
so that \code{augment(fit)} will return the augmented training data. In these |
| 66 |
cases, augment tries to reconstruct the original data based on the model |
| 67 |
object with varying degrees of success. |
| 68 |
|
| 69 |
The augmented dataset is always returned as a \link[tibble:tibble]{tibble::tibble} with the |
| 70 |
\strong{same number of rows} as the passed dataset. This means that the passed |
| 71 |
data must be coercible to a tibble. If a predictor enters the model as part |
| 72 |
of a matrix of covariates, such as when the model formula uses |
| 73 |
\code{\link[splines:ns]{splines::ns()}}, \code{\link[stats:poly]{stats::poly()}}, or \code{\link[survival:Surv]{survival::Surv()}}, it is represented |
| 74 |
as a matrix column. |
| 75 |
|
| 76 |
We are in the process of defining behaviors for models fit with various |
| 77 |
\code{na.action} arguments, but make no guarantees about behavior when data is |
| 78 |
missing at this time. |
| 79 |
} |
| 80 |
\seealso{ |
| 81 |
\code{\link[=augment]{augment()}}, \code{\link[stats:stl]{stats::stl()}} |
| 82 |
|
| 83 |
Other decompose tidiers: |
| 84 |
\code{\link{augment.decomposed.ts}()} |
| 85 |
} |
| 86 |
\concept{decompose tidiers} |