prepivot.ks.permtest: Permutation Test for the two-sample goodness-of-fit problem...

View source: R/prepivot.ks.permtest.R

prepivot.ks.permtestR Documentation

Permutation Test for the two-sample goodness-of-fit problem under covariate-adaptive randomization

Description

A permutation test of the two-sample goodness-of-fit hypothesis when the randomization scheme is covariate-adaptive. The permutation test considered here is based on prepivoting the Kolmogorov-Smirnov test statistic following Beran (1987,1988), and adapted by Olivares (2020). Current version includes the following randomization schemes: simple randomization, Efron's biased-coin design, Wei's biased-coin design, and stratified block randomization. This implementation uses a Bayesian bootstrap approximation for prepivoting.

Usage

prepivot.ks.permtest(Y1, Y0, alpha, B, n.perm)

Arguments

Y1

Numeric. A vector containing the response variable of the treatment group.

Y0

Numeric. A vector containing the response variable of the control group.

alpha

Numeric. Nominal level for the test. The default is 0.05.

B

Numeric. Number of weighted bootstrap samples.

n.perm

Numeric. Number of permutations needed for the stochastic approximation of the p-values. The default is n.perm=999.

Value

An object of class "prepivot.ks.permtest" containing at least the following components:

n_populations

Number of grups.

N

Sample Size.

T.obs

Observed test statistic.

cv

Critical Value. This value is used in the general construction of a randomization test.

pvalue

P-value.

rejectrule

Rule. Binary decision for randomization test, where 1 means "to reject"

T.perm

Vector. Test statistic recalculated for all permutations used in the stochastic approximation.

n.perm

Number of permutations.

B

Bayesian bootstrap samples.

sample_sizes

Groups size.

Author(s)

Maurcio Olivares

References

Beran, R. (1987). Prepivoting to reduce level error of confidence sets. Biometrika, 74(3): 457–468. Beran, R. (1988). Prepivoting test statistics: a bootstrap view of asymptotic refinements. Journal of the American Statistical Association, 83(403):687–697. Olivares, M. (2020). Asymptotically Robust Permutation Test under Covariate-Adaptive Randomization. Working Paper.

Examples

## Not run: 
Y0 <- rnorm(100, 1, 1)
Y1 <- rbeta(100,2,2)
Tx = sample(100) <= 0.5*(100)
# Observed Outcome 
Y = ifelse( Tx, Y1, Y0 )
dta <- data.frame(Y = Y, A = as.numeric(Tx))
pKS.GoF<-prepivot.ks.permtest(dta$Y[dta$A==1],dta$Y[dta$A==0],alpha=0.05,B=1000,n.perm = 999)
summary(pKS.GoF)

## End(Not run)

RATest documentation built on Sept. 29, 2022, 9:08 a.m.