hello, I try to run simulation of levene's test to find the p-value but the error of replacement has length zero occur, could anyone help me to fix this problem? asim <- 1000 pv<-rep(NA,asim) for(i in 1:asim) {print(i) set.seed(i) g1 <- rnorm(20,0,2) g2 <- rnorm(20,0,2) g3 <- rnorm(20,0,2) x <- c(g1,g2,g3) group<-as.factor(c(rep(1,20),rep(2,20),rep(3,20))) library(Rcmdr) pv[i]<-leveneTest(x,group)$p.value } -- View this message in context: http://r.789695.n4.nabble.com/simulation-of-levene-s-test-tp4631578.html Sent from the R help mailing list archive at Nabble.com.
Dear Dila, Try the following: library(Rcmdr) asim <- 1000 pv<-NULL for(i in 1:asim) { print(i) set.seed(i) g1 <- rnorm(20,0,2) g2 <- rnorm(20,0,2) g3 <- rnorm(20,0,2) x <- c(g1,g2,g3) group<-as.factor(c(rep(1,20),rep(2,20),rep(3,20))) pv<-c(pv,leveneTest(x,group)$"Pr(>F)"[1]) } Best Ozgur ----- ************************************ Ozgur ASAR Research Assistant Middle East Technical University Department of Statistics 06531, Ankara Turkey Ph: 90-312-2105309 http://www.stat.metu.edu.tr/people/assistants/ozgur/ -- View this message in context: http://r.789695.n4.nabble.com/simulation-of-levene-s-test-tp4631578p4631600.html Sent from the R help mailing list archive at Nabble.com.