
Extract fitted values and residuals from a predmicror fit
Source:R/model_diagnostics.R
predmicror_augment.Rdpredmicror_augment() returns the original data, or optional new data, with
columns containing fitted values and residuals. It is intentionally lightweight
and does not require the broom package.
Usage
predmicror_augment(object, ...)
# Default S3 method
predmicror_augment(object, ...)
# S3 method for class 'predmicror_fit'
predmicror_augment(object, newdata = NULL, ...)
# S3 method for class 'predmicror_fit'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)Arguments
- object, x
A
predmicror_fitobject.- ...
Additional arguments passed to
predict().- newdata
Optional data frame used for prediction. If
NULL, the data stored in the fitted object are used.- row.names, optional
Arguments required by the base
as.data.frame()generic. They are accepted for method compatibility.
Value
A data frame containing the original columns plus .fitted, .resid
when the response column is available, .model, and .type.
Examples
data(growthfull)
fit <- fit_growth(
data = growthfull,
model = "HuangFM",
time = "Time",
response = "lnN",
start = list(Y0 = 0, Ymax = 22, MUmax = 1.7, lag = 5)
)
head(predmicror_augment(fit))
#> Time logN lnN .fitted .resid .model .type
#> 1 0 -0.1046 -0.2006 0.04562398 -0.2462240 HuangFM growth
#> 2 2 0.0792 0.1922 0.04562605 0.1465739 HuangFM growth
#> 3 4 0.1212 0.1587 0.05176904 0.1069310 HuangFM growth
#> 4 6 0.7344 1.5290 1.76811761 -0.2391176 HuangFM growth
#> 5 8 2.5531 5.9421 5.47539652 0.4667035 HuangFM growth
#> 6 10 3.8358 8.8024 9.19423483 -0.3918348 HuangFM growth