Debian Codegraph @

man/augment.factanal.Rd

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