Learn R Programming

regtomean (version 1.2)

meechua_plot: Plot models from meechua_reg

Description

This functions plots all 4 diagnostics plots for each linear regression model: "Residuals vs Fitted", "Normal Q-Q", "Scale-Location" and "Residuals vs Leverage".

Usage

meechua_plot(models = NULL, env = regtomean_env)

Value

Diagnostics plots for the set of models from meechua_reg.

Arguments

models

A list containing the estimated linear models, typically the output of meechua_reg. If models is NULL, the function attempts to retrieve the models from the specified environment (env).

env

An environment where the models are stored. The default is regtomean_env. This argument is used only if models is not explicitly provided.

Author

Daniela Recchia, Thomas Ostermann.

Details

For each model from models 4 diagnostic plots are performed. For the first model the numbers 1 to 4 should be given, for the second model numbers from to 8 to 12, and so on.

References

Ostermann, T., Willich, Stefan N. & Luedtke, Rainer. (2008). Regression toward the mean - a detection method for unknown population mean based on Mee and Chua's algorithm. BMC Medical Research Methodology.

See Also

plot.lm,meechua_reg

Examples

Run this code
# Generate example data
language_test <- data.frame(
  Before = rnorm(100, mean = 50, sd = 10),
  After = rnorm(100, mean = 55, sd = 10)
)

# Replicate data
mee_chua <- replicate_data(50, 60, "Before", "After", data = language_test)
mee_chua_sort <- mee_chua[order(mee_chua$mu), ]

# Perform regression analysis
results <- meechua_reg(mee_chua_sort)

# Plot models
meechua_plot(results$models)

Run the code above in your browser using DataLab