Augment accepts a model object and a dataset and adds information about each observation in the dataset. It includes predicted values in the .fitted column, residuals in the .resid column, and standard errors for the fitted values in a .se.fit column, if the type of prediction is 'link'. New columns always begin with a . prefix to avoid overwriting columns in the original dataset.

# S3 method for mixpoissonreg
augment(
  x,
  data = stats::model.frame(x),
  newdata = NULL,
  type.predict = c("response", "link", "precision", "variance"),
  type.residuals = c("pearson", "score"),
  se_fit = FALSE,
  conf_int = TRUE,
  pred_int = FALSE,
  ...
)

Arguments

x

A mixpoissonreg object.

data

A base::data.frame or tibble::tibble() containing the original data that was used to produce the object x.

newdata

A base::data.frame or tibble::tibble() containing all the original predictors used to create x. Defaults to NULL, indicating that nothing has been passed to newdata. If newdata is specified, the data argument will be ignored.

type.predict

Type of prediction. The options are 'response', 'link', 'precision' and 'variance'. The default is "response".

type.residuals

Type of residuals. The options are 'pearson' and 'score'. The default is 'pearson'.

se_fit

Logical indicating whether or not a .se.fit column should be added to the augmented output. If TRUE, it only returns a non-NA value if type of prediction is 'link'.

conf_int

Logical indicating whether or not confidence intervals for the fitted variable with type chosen from type.predict should be built. The available type options are 'response' and 'link'.

pred_int

Logical indicating whether or not prediction intervals for future observations should be built. It only works with type.predict = 'response'. The arguments level, nsim_pred, nsim_pred_y are passed through additional arguments '...'. Notice that this can be computationally intensive.

...

Additional arguments. Possible additional arguments are level, nsim_pred, nsim_pred_y, that are passed to predict.mixpoissonreg function.

Value

A tibble::tibble() with columns:

  • .cooksd Cook's distance.

  • .fitted Fitted or predicted value.

  • .fittedlwrconf Lower bound of the confidence interval, if conf_int = TRUE

  • .fitteduprconf Upper bound of the confidence interval, if conf_int = TRUE

  • .fittedlwrpred Lower bound of the prediction interval, if pred_int = TRUE

  • .fitteduprpred Upper bound of the prediction interval, if pred_int = TRUE

  • .hat Diagonal of the hat matrix.

  • .resid The chosen residual.

  • .resfit The chosen residual of the fitted object.

  • .se.fit Standard errors of fitted values, if se_fit = TRUE.

  • .gencooksd Generalized Cook's distance.

  • .lwrenv Lower bound of the simulated envelope, if the fitted mixpoissonreg object, was fitted with envelopes > 0.

  • .mdnenv Median of the simulated envelope, if the fitted mixpoissonreg object, was fitted with envelopes > 0.

  • .uprenv Upper bound of the simulated envelope, if the fitted mixpoissonreg object, was fitted with envelopes > 0.

See also