N <- 100
n <- 10
x1 <- rgamma(N,4,25)
x2 <- rgamma(N,4,25)
strata <- rep(1:n,each = N/n)
pik <- rep(n/N,N)
X <- as.matrix(cbind(matrix(c(x1,x2),ncol = 2)))
s <- fbs(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