plot_t | R Documentation |
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.
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
)
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 |
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.
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.
# 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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.