Ricrt {Ricrt}R Documentation

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)

[Package Ricrt version 0.1.0 Index]