# NOT RUN {
## example for est.confounder.num
data <- gen.sim.data(n = 50, p = 50, r = 5)
X.data <- data.frame(X1 = data$X1)
est.confounder.num(~ X1 | 1, X.data, data$Y, method = "ed")
est.confounder.num(~ X1 | 1, X.data, data$Y, method = "bcv")
## example for est.factor.num
n <- 50
p <- 100
r <- 5
Z <- matrix(rnorm(n * r), n, r)
Gamma <- matrix(rnorm(p * r), p, r)
Y <- Z %*% t(Gamma) + rnorm(n * p)
est.factor.num(Y, method = "ed")
est.factor.num(Y, method = "bcv")
# }
Run the code above in your browser using DataLab