makepseudo: Nearest neighbor augmentatation based on ranks

Description Usage Arguments Value References Examples

View source: R/functions.R

Description

The function makepseudo performs the nearest neighbor augmentation based on the rank of covariate values according to the scheme discribed on page 410-411 of Wang, Tolos and Wang (2010)

Usage

1
makepseudo(N, n, k, a, alltrt)

Arguments

N

total number of covariate values.

n

vector of sample sizes from all treatments

k

number of nearest neighbors

a

number of treatment levels in the data

alltrt

a matrix of dimension 3xN, whose first two rows are Y and X, and the third row gives the rank of X values within the same treatment level.

Value

A list containing the following: psudo: a 3-d array of the dimension (k, a, N) that stores the augmented observations based on k-nearest neighbor rule in Wang, Tolos and Wang (2010). index: a 3-d array of the dimension (k, a, N) that stores the index of which observation was used for augmentation.

References

Haiyan Wang, Siti Tolos, and Suojin Wang (2010). A Distribution Free Nonparametric Test to Detect Dependence Between a Response Variable and Covariate in Presence of Heteroscedastic Treatment Effects. The Canadian Journal of Statistics. 38(3), 408433. Doi:10.1002/cjs.10068

Examples

1
2
3
4
5
6
 a=2; n=c(7,9); N=sum(n);  X=runif(N);
 trt=c(rep(1,n[1]), rep(2, n[2])); e=rnorm(N, 0, 0.1)
 Y=ifelse(trt==1, 4*(X-0.5)^2+e, 2*X+e)
 ranksuse=unlist(tapply(X, trt, rank) )
 alltrt=rbind(Y, X, ranksuse )
 aug=makepseudo(N,n, k=3, a, alltrt)

PSSIM documentation built on Sept. 13, 2020, 5:18 p.m.

Related to makepseudo in PSSIM...