Learn R Programming

RATest (version 0.1.10)

PT.Khmaladze.fit: Permutation Test for Heterogeneous Treatment Effects with a Nuisance Parameter

Description

A permutation test of the two-sample goodness-of-fit hypothesis in the presence of an estimated niusance parameter. The permutation test considered here is based on the Khmaladze transformation of the empirical process (Khmaladze (1981)), and adapted by Chung and Olivares (2020).

Usage

PT.Khmaladze.fit(y1, y0, alpha = 0.05, n.perm = 999)

Value

An object of class "PT.Khmaladze.fit" containing at least the following components:

n_populations

Number of grups.

N

Sample Size.

T.obs

Observed test statistic.

shift

The estimated nuisance parameter (average treatment effect).

cv

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

pvalue

P-value.

T.perm

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

n_perm

Number of permutations.

sample_sizes

Groups size.

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.

n.perm

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

Author

Maurcio Olivares

References

Khmaladze, E. (1981). Martingale Approach in the Theory of Goodness-of-fit Tests. Theory of Probability and its Application, 26: 240–257. Chung, E. and Olivares, M. (2021). Permutation Test for Heterogeneous Treatment Effects with a Nuisance Parameter. Forthcoming in Journal of Econometrics.

Examples

Run this code
if (FALSE) {
Y0 <- rnorm(100, 1, 1)
# Treatment Group with constant shift equals to 1
Y1 <- Y0 + 1
Tx = sample(100) <= 0.5*(100)
# Observed Outcome 
Y = ifelse( Tx, Y1, Y0 )
dta <- data.frame(Y = Y, Z = as.numeric(Tx))
pt.GoF<-PT.Khmaladze.fit(dta$Y[dta$Z==1],dta$Y[dta$Z==0],n.perm = 49)
summary(pt.GoF)
}

Run the code above in your browser using DataLab