Debian Codegraph @

man/augment.drc.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/drc.R
3 \name{augment.drc}
4 \alias{augment.drc}
5 \title{Augment data with information from a(n) drc object}
6 \usage{
7 \method{augment}{drc}(
8 x,
9 data = NULL,
10 newdata = NULL,
11 se_fit = FALSE,
12 conf.int = FALSE,
13 conf.level = 0.95,
14 ...
15 )
16 }
17 \arguments{
18 \item{x}{A \code{drc} object produced by a call to \code{\link[drc:drm]{drc::drm()}}.}
19
20 \item{data}{A \link[base:data.frame]{base::data.frame} or \code{\link[tibble:tibble]{tibble::tibble()}} containing the original
21 data that was used to produce the object \code{x}. Defaults to
22 \code{stats::model.frame(x)} so that \code{augment(my_fit)} returns the augmented
23 original data. \strong{Do not} pass new data to the \code{data} argument.
24 Augment will report information such as influence and cooks distance for
25 data passed to the \code{data} argument. These measures are only defined for
26 the original training data.}
27
28 \item{newdata}{A \code{\link[base:data.frame]{base::data.frame()}} or \code{\link[tibble:tibble]{tibble::tibble()}} containing all
29 the original predictors used to create \code{x}. Defaults to \code{NULL}, indicating
30 that nothing has been passed to \code{newdata}. If \code{newdata} is specified,
31 the \code{data} argument will be ignored.}
32
33 \item{se_fit}{Logical indicating whether or not a \code{.se.fit} column should be
34 added to the augmented output. For some models, this calculation can be
35 somewhat time-consuming. Defaults to \code{FALSE}.}
36
37 \item{conf.int}{Logical indicating whether or not to include a confidence
38 interval in the tidied output. Defaults to \code{FALSE}.}
39
40 \item{conf.level}{The confidence level to use for the confidence interval
41 if \code{conf.int = TRUE}. Must be strictly greater than 0 and less than 1.
42 Defaults to 0.95, which corresponds to a 95 percent confidence interval.}
43
44 \item{...}{Additional arguments. Not used. Needed to match generic
45 signature only. \strong{Cautionary note:} Misspelled arguments will be
46 absorbed in \code{...}, where they will be ignored. If the misspelled
47 argument has a default value, the default value will be used.
48 For example, if you pass \code{conf.lvel = 0.9}, all computation will
49 proceed using \code{conf.level = 0.95}. Two exceptions here are:
50 \itemize{
51 \item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if
52 it will be ignored.
53 \item \code{augment()} methods will warn when supplied a \code{newdata} argument if it
54 will be ignored.
55 }}
56 }
57 \description{
58 Augment accepts a model object and a dataset and adds
59 information about each observation in the dataset. Most commonly, this
60 includes predicted values in the \code{.fitted} column, residuals in the
61 \code{.resid} column, and standard errors for the fitted values in a \code{.se.fit}
62 column. New columns always begin with a \code{.} prefix to avoid overwriting
63 columns in the original dataset.
64
65 Users may pass data to augment via either the \code{data} argument or the
66 \code{newdata} argument. If the user passes data to the \code{data} argument,
67 it \strong{must} be exactly the data that was used to fit the model
68 object. Pass datasets to \code{newdata} to augment data that was not used
69 during model fitting. This still requires that at least all predictor
70 variable columns used to fit the model are present. If the original outcome
71 variable used to fit the model is not included in \code{newdata}, then no
72 \code{.resid} column will be included in the output.
73
74 Augment will often behave differently depending on whether \code{data} or
75 \code{newdata} is given. This is because there is often information
76 associated with training observations (such as influences or related)
77 measures that is not meaningfully defined for new observations.
78
79 For convenience, many augment methods provide default \code{data} arguments,
80 so that \code{augment(fit)} will return the augmented training data. In these
81 cases, augment tries to reconstruct the original data based on the model
82 object with varying degrees of success.
83
84 The augmented dataset is always returned as a \link[tibble:tibble]{tibble::tibble} with the
85 \strong{same number of rows} as the passed dataset. This means that the passed
86 data must be coercible to a tibble. If a predictor enters the model as part
87 of a matrix of covariates, such as when the model formula uses
88 \code{\link[splines:ns]{splines::ns()}}, \code{\link[stats:poly]{stats::poly()}}, or \code{\link[survival:Surv]{survival::Surv()}}, it is represented
89 as a matrix column.
90
91 We are in the process of defining behaviors for models fit with various
92 \code{na.action} arguments, but make no guarantees about behavior when data is
93 missing at this time.
94 }
95 \examples{
96 \dontshow{if (rlang::is_installed("drc")) withAutoprint(\{ # examplesIf}
97
98 # load libraries for models and data
99 library(drc)
100
101 # fit model
102 mod <- drm(dead / total ~ conc, type,
103 weights = total, data = selenium, fct = LL.2(), type = "binomial"
104 )
105
106 # summarize model fit with tidiers
107 tidy(mod)
108 tidy(mod, conf.int = TRUE)
109
110 glance(mod)
111
112 augment(mod, selenium)
113 \dontshow{\}) # examplesIf}
114 }
115 \seealso{
116 \code{\link[=augment]{augment()}}, \code{\link[drc:drm]{drc::drm()}}
117
118 Other drc tidiers:
119 \code{\link{glance.drc}()},
120 \code{\link{tidy.drc}()}
121 }
122 \concept{drc tidiers}
123 \value{
124 A \code{\link[tibble:tibble]{tibble::tibble()}} with columns:
125 \item{.cooksd}{Cooks distance.}
126 \item{.fitted}{Fitted or predicted value.}
127 \item{.lower}{Lower bound on interval for fitted values.}
128 \item{.resid}{The difference between observed and fitted values.}
129 \item{.se.fit}{Standard errors of fitted values.}
130 \item{.upper}{Upper bound on interval for fitted values.}
131
132 }