Package 'Ricrt'

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

Help Index


Example data

Description

Example data

Usage

example1

Format

A data frame with 258 rows and 10 columns

Source

Randomly generated by a mixed model with Treatment effect of -50


Quantile Effect Analysis

Description

A function for quantile analysis that provides a p-value and a point estimation.

Usage

QuantileAnalysis(S, C, Z, R, quantile = 0.5, delta_hyp = 0)

Arguments

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.

Value

A list of the outputs

Examples

# 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)

Ricrt

Description

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

Usage

Ricrt(
  S,
  C,
  Z,
  R,
  X = NULL,
  tau_hyp = 0,
  method = "W",
  reg = "lm",
  permutation = 100
)

Arguments

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.

Value

A list of the outputs

Examples

# 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)