library(DImodels)
## Load data
data(sim1)
## Fit model
mod1 <- lm(response ~ 0 + (p1 + p2 + p3 + p4)^2, data = sim1)
## Get data for diagnostics plot
diagnostics_data <- model_diagnostics_data(mod1,
prop = c("p1", "p2", "p3", "p4"))
## Create diagnostics plots
diagnostics <- model_diagnostics_plot(diagnostics_data)
print(diagnostics)
## Access individual plots
print(diagnostics[[1]])
print(diagnostics[[4]])
## Change plot arrangement
model_diagnostics_plot(diagnostics_data, which = c(1, 3),
nrow = 2, ncol = 1)
## Show only extreme points as pie-glyphs to avoid overplotting
model_diagnostics_plot(diagnostics_data, which = 2,
npoints = 3, only_extremes = TRUE)
## Change size and colours of pie_glyphs
model_diagnostics_plot(diagnostics_data, which = 2,
npoints = 3, only_extremes = TRUE,
pie_radius = 0.3,
pie_colours = c("gold", "steelblue", "tomato", "darkgrey"))
Run the code above in your browser using DataLab