N <- 100
n <- 10
p <- 4
X <- matrix(rgamma(N*p,4,25),ncol = p)
strata <- as.matrix(rep(1:n,each = N/n))
pik <- rep(n/N,N)
s <- balstrat(X,strata,pik)
t(X/pik)%*%s
t(X/pik)%*%pik
Xcat <- disj(strata)
t(Xcat)%*%s
t(Xcat)%*%pik
Run the code above in your browser using DataLab