plot_t {regtomean} | R Documentation |
Plot Results for p-values and t-values
Description
This function plots the t-statistics and p-values for a range of \mu
values, based on the provided data and regression models. It helps visualize whether the intervention has a significant impact on the measurements, accounting for regression to the mean.
Usage
plot_t(
mu_start,
mu_end,
n,
y1_mean,
y2_mean,
y1_std,
y2_std,
cov,
lower = F,
alpha = 0.05,
r_insteadof_cov = F
)
Arguments
mu_start |
Numeric. The starting value of |
mu_end |
Numeric. The ending value of |
n |
Numeric. The original sample size (number of observations) of the data. |
y1_mean |
Numeric. The mean of the first measurement. |
y2_mean |
Numeric. The mean of the second measurement. |
y1_std |
Numeric. The standard deviation of the first measurement. |
y2_std |
Numeric. The standard deviation of the second measurement. |
cov |
Numeric. The covariance between the two measurements, or if |
lower |
Logical. If |
alpha |
Numeric. The significance threshold for the p-values of the one-sided tests. The default is |
r_insteadof_cov |
Logical. If |
Value
A ggplot2
plot with two y-axes: one showing p-values and the other showing t-statistics. The function also prints key values including the most significant \mu
, the minimal p-value, and the range of \mu
where the treatment effect is significant.
Author(s)
Julian Stein
References
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.
Examples
# Example usage of the plot_t function
plot_t(
mu_start = 0, mu_end = 10, n = 50, y1_mean = 5,
y2_mean = 5, y1_std = 2, y2_std = 2, cov = 0.5
)
plot_t(
mu_start = 0, mu_end = 10, n = 50, y1_mean = 5,
y2_mean = 5, y1_std = 2, y2_std = 2, cov = 0.5,
lower = TRUE, alpha = 0.1
)