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

View source: R/PT.Khmaladze.fit.R

PT.Khmaladze.fitR Documentation

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 nuisance parameter. The permutation test considered here is based on the Khmaladze transformation of the empirical process (Khmaladze (1981)), and adapted by Chung and Olivares (2021).

Usage

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

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.

akj.control

Optional named list of tuning parameters passed to quantreg::akj, used to estimate the (extended) score function via adaptive kernel density estimation. Recognized entries are alpha, kappa, h, and iker1; see ?quantreg::akj. Any entry not supplied falls back to the akj defaults, which are used by default and are recommended: in the simulations reported in Chung and Olivares (2021) they maximize power, and alternative (e.g. larger-bandwidth) settings that reduce the score's estimation error were found to *lower* power. This argument is provided only for users who have a specific reason to prefer different settings for their application.

Value

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

n_populations

Number of groups.

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.

Author(s)

Mauricio 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. Journal of Econometrics.

Examples

## Not run: 
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)

## End(Not run)

RATest documentation built on Sept. 8, 2026, 1:11 a.m.