Title: | Randomization Inference of Clustered Randomized Trials |
---|---|
Description: | Methods for randomization inference in group-randomized trials. Specifically, it can be used to analyze the treatment effect of stratified data with multiple clusters in each stratum with treatment given on cluster level. User may also input as many covariates as they want to fit the data. Methods are described by Dylan S Small et al., (2012) <doi:10.1198/016214507000000897>. |
Authors: | Yang Dong [aut, cph, cre], Bingkai Wang [aut, cph], Dylan Small [aut, cph] |
Maintainer: | Yang Dong <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2025-02-22 03:56:31 UTC |
Source: | https://github.com/cran/Ricrt |
Example data
example1
example1
A data frame with 258 rows and 10 columns
Randomly generated by a mixed model with Treatment effect of -50
A function for quantile analysis that provides a p-value and a point estimation.
QuantileAnalysis(S, C, Z, R, quantile = 0.5, delta_hyp = 0)
QuantileAnalysis(S, C, Z, R, quantile = 0.5, delta_hyp = 0)
S |
A numeric column vector with individuals' stratum number |
C |
A numeric column vector with individuals' cluster number |
Z |
A numeric column vector with individuals' treatment assignment (binary) |
R |
A numeric column vector with individuals' outcome |
quantile |
A numeric value for intended quantile in the input data for running the quantile test, the default of this value is 0.5. |
delta_hyp |
A numeric value that is the hypothesized treatment effect given the quantile. The default of this value is 0. |
A list of the outputs
# First we need to obtain the vectors for the inputs. S = example1$S C = example1$C Z = example1$Z R = example1$R QuantileAnalysis(S, C, Z, R)
# First we need to obtain the vectors for the inputs. S = example1$S C = example1$C Z = example1$Z R = example1$R QuantileAnalysis(S, C, Z, R)
This package can use Mann-Whitney-Wilcoxon or signed-rank test to perform randomization inference. The statistics, p-value, point estimation, and a two-sided 95
Ricrt( S, C, Z, R, X = NULL, tau_hyp = 0, method = "W", reg = "lm", permutation = 100 )
Ricrt( S, C, Z, R, X = NULL, tau_hyp = 0, method = "W", reg = "lm", permutation = 100 )
S |
A numeric column vector with individuals' stratum number |
C |
A numeric column vector with individuals' cluster number |
Z |
A numeric column vector with individuals' treatment assignment (binary) |
R |
A numeric column vector with individuals' outcome |
X |
A numeric matrix with each column being a covariate |
tau_hyp |
A numeric value for hypothesized treatment effect, the default for this value is 0. |
method |
A string being either "W" or "sr", indicating either weighted sum of S Mann–Whitney–Wilcoxon statistics will be used or signed-rank test will be used |
reg |
A string being either "lm" or "rf," indicating either linear model or random forest model being used for fitting the data with covariates. The default is "lm." |
permutation |
A numeric value indicating the number of permutation inside the function when using permutation tests for p-values, the default is 50. |
A list of the outputs
# First we need to obtain the vectors for the inputs. S = example1$S C = example1$C Z = example1$Z R = example1$R X = cbind(example1$X1, example1$X2, example1$X3, example1$X4, example1$X5) # Let's see the first example with method = W and reg = lm. set.seed(123) Ricrt(S, C, Z, R, X, tau_hyp = 10, method = "W", reg = "lm", permutation = 5) # Let's see the second example with method = W and reg = rf Ricrt(S, C, Z, R, X, tau_hyp = 10, method = "W", reg = "rf", permutation = 5)
# First we need to obtain the vectors for the inputs. S = example1$S C = example1$C Z = example1$Z R = example1$R X = cbind(example1$X1, example1$X2, example1$X3, example1$X4, example1$X5) # Let's see the first example with method = W and reg = lm. set.seed(123) Ricrt(S, C, Z, R, X, tau_hyp = 10, method = "W", reg = "lm", permutation = 5) # Let's see the second example with method = W and reg = rf Ricrt(S, C, Z, R, X, tau_hyp = 10, method = "W", reg = "rf", permutation = 5)