
Last chance! 50% off unlimited learning
Sale ends in
Equivalent to fitted(fit, ...) - fit$data[, fit$data$yvar]
(or fitted(fit, ...) - newdata[, fit$data$yvar]
),
but with fixed arguments for fitted
: rate = FALSE, which_y = 'ct', samples_format = 'tidy'
.
# S3 method for mcpfit
residuals(
object,
newdata = NULL,
summary = TRUE,
probs = TRUE,
prior = FALSE,
varying = TRUE,
arma = TRUE,
nsamples = NULL,
...
)
An mcpfit
object.
A tibble
or a data.frame
containing predictors in the model. If NULL
(default),
the original data is used.
Summarise at each x-value
Vector of quantiles. Only in effect when summary == TRUE
.
TRUE/FALSE. Plot using prior samples? Useful for mcp(..., sample = "both")
One of:
TRUE
All varying effects (fit$pars$varying
).
FALSE
No varying effects (c()
).
Character vector: Only include specified varying parameters - see fit$pars$varying
.
Whether to include autoregressive effects.
TRUE
Compute autoregressive residuals. Requires the response variable in newdata
.
FALSE
Disregard the autoregressive effects. For family = gaussian()
, predict()
just use sigma
for residuals.
Integer or NULL
. Number of samples to return/summarise.
If there are varying effects, this is the number of samples from each varying group.
NULL
means "all". Ignored if both are FALSE
. More samples trade speed for accuracy.
Currently ignored.
Jonas Kristoffer Lindeløv jonas@lindeloev.dk
pp_eval
fitted.mcpfit
predict.mcpfit
# \donttest{
residuals(demo_fit)
residuals(demo_fit, probs = c(0.1, 0.5, 0.9)) # With median and 80% credible interval.
residuals(demo_fit, summary = FALSE) # Samples instead of summary.
# }
Run the code above in your browser using DataLab