Description Usage Arguments Value References Examples
Implements the residual resampling OLS algorithm described in Mathur & VanderWeele (in preparation). Specifically, the design matrix is fixed while the resampled outcomes are set equal to the original fitted values plus a vector of residuals sampled with replacement.
1 2 3 4 5 6 7 8 9 10 11 | resample_resid(
d,
X,
C = NA,
Ys,
alpha,
resid,
bhat.orig,
B = 2000,
cores = NULL
)
|
d |
Dataframe |
X |
Single quoted name of covariate of interest |
C |
Vector of quoted covariate names |
Ys |
Vector of quoted outcome names |
alpha |
Alpha level for individual tests |
resid |
Residuals from original sample (W X B matrix) |
bhat.orig |
Estimated coefficients for covariate of interest in original sample (W-vector) |
B |
Number of resamples to generate |
cores |
Number of cores available for parallelization |
Returns a list containing the number of rejections in each resample, a matrix of p-values in the resamples, and a matrix of t-statistics in the resamples.
Mathur, M.B., & VanderWeele, T.J. (in preparation). New metrics for multiple testing with correlated outcomes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | samp.res = dataset_result( X = "complaints",
C = c("privileges", "learning"),
Ys = c("rating", "raises"),
d = attitude,
center.stats = FALSE,
bhat.orig = NA, # bhat.orig is a single value now for just the correct Y
alpha = 0.05 )
resamps = resample_resid( X = "complaints",
C = c("privileges", "learning"),
Ys = c("rating", "raises"),
d = attitude,
alpha = 0.05,
resid = samp.res$resid,
bhat.orig = samp.res$b,
B=20,
cores = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.