# NOT RUN {
set.seed(1234)
## simulate data from a latent variable model: Y = BL + E
B = c(rep(1,50),rep(-1,50), rep(0,900))
L = rnorm(20)
E = matrix(rnorm(1000*20), nrow=1000)
dat = B %*% t(L) + E
dat = t(scale(t(dat), center=TRUE, scale=TRUE))
## apply the jackstraw
out = jackstraw(dat, r=1, method="PCA")
## Use optional arguments
## For example, set s and B for a balance between speed of the algorithm and accuracy of p-values
# }
# NOT RUN {
out = jackstraw(dat, r=1, s=10, B=1000, seed=5678)
# }
Run the code above in your browser using DataLab