View source: R/mc_S3_methods.R
| plot.mcglm | R Documentation |
Produces diagnostic plots for fitted mcglm objects and returns
the data used to generate the plots. Available diagnostics include:
"residuals": plots of fitted values vs. Pearson residuals
and Q-Q plots of residuals;
"algorithm": plots of regression and covariance parameters
and quasi-score iterations to inspect algorithm convergence;
"partial_residuals": partial residual plots for each
covariate in the model.
## S3 method for class 'mcglm'
plot(
x,
type = c("residuals", "algorithm", "partial_residuals"),
plot_graphics = TRUE,
...
)
x |
A fitted object of class |
type |
Character string specifying the type of diagnostic plot to produce.
One of |
plot_graphics |
Logical; if |
... |
Additional arguments; currently ignored. Included for compatibility
with the generic |
A list containing the data used to generate the plots:
For "residuals": fitted values and residuals.
For "algorithm": IterationRegression,
IterationCovariance, ScoreRegression,
ScoreCovariance.
For "partial_residuals": residuals, list_beta,
and partial_residuals containing x and y values for each covariate.
Wagner Hugo Bonat, wbonat@ufpr.br
residuals, fitted,
plot
library(mcglm)
set.seed(123)
mydata <- data.frame(y = rnorm(10), x1 = rnorm(10),
x2 = rbinom(10, size = 1, prob = 0.5))
Z0 <- mc_id(mydata)
fit <- mcglm(c(y ~ x1 + x2), matrix_pred = list(Z0), data = mydata)
# Produce plots and get data
diag_data <- plot(fit, type = "residuals")
# Only get data without plotting
diag_data <- plot(fit, type = "partial_residuals", plot_graphics = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.