plot_mu | R Documentation |
Based on the data before and after the intervention and the regression models from the function meechua_reg
, this function plots the t-statistics and p-values for a given range of \mu
to assess whether the intervention has a significant impact on the measurements, accounting for regression to the mean.
plot_mu(x, n, se_after, lower = F, alpha = 0.05)
x |
A data frame containing the results from |
n |
The original sample size (number of observations) of the data. |
se_after |
The estimated standard error from |
lower |
A boolean value specifying the direction of the one-sided tests. For |
alpha |
Specifies the significance threshold for the p-values of the corresponding one-sided tests. The default is |
A list containing the most significant \mu
, t-statistic, p-value, and the range of \mu
for which the treatment impact is significant.
Julian Stein
Ostermann, T., Willich, S. N., & Luedtke, R. (2008). Regression toward the mean - a detection method for unknown population mean based on Mee and Chua's algorithm. BMC Medical Research Methodology.
# Generate example data
language_test <- data.frame(
Before = rnorm(100, mean = 50, sd = 10),
After = rnorm(100, mean = 55, sd = 10)
)
mee_chua <- replicate_data(0, 1, "Before", "After", data = language_test)
mee_chua <- mee_chua[order(mee_chua$mu), ] # Sortieren nach 'mu'
# Regression ausführen und Ergebnisse erhalten
reg_results <- meechua_reg(mee_chua)
# Zugriff auf Ergebnisse
mod_coef <- reg_results$mod_coef
se_after <- reg_results$se_after
# mod_coef and se_after are stored in the environment.
plot_mu(mod_coef, 8, se_after)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.