kasturi bardhan wrote: > hello everybody > I use the following code for my programming & it runs with the error as > specified below.Any help that would disolve the error will be highly > appreciated. > Thanks in advance > my code looks like this > #### R programme for simulating the power of the two sample t test vs various > #### non-parametric alternatives > sim.size <- 200 > sample.size <- 10 > set.seed(231) > mu1 <- 0 > delta <- seq(-2,2, length=50) > for (j in 1:length(delta)) > { > mu2 <- mu1 + delta[j] > for (i in 1:sim.size) > { > # Generate ith sample > samp1 <- rnorm(mean=mu1,sample.size) > samp2 <- rnorm(mean=mu2,sample.size) > # Perform ith set of tests > test1 <- t.test(samp1, samp2,alternative = c("two.sided")) > pt.test[i] <- (test1$p.value < 0.05) > test2 <- wilcox.test(samp1, samp2,alternative = c("two.sided"), > exact = TRUE) > pw.test[i] <- (test2$p.value < 0.05) > test3 <- ks.test(samp1, samp2,alternative = c("two.sided"), > exact = TRUE) > pks.test[i] <- (test3$p.value < 0.05) > } > pow.ttest[j] <- sum(pt.test)/sim.size # Calculate powers for jth setting > pow.wtest[j] <- sum(pw.test)/sim.size > pow.kstest[j] <- sum(pks.test)/sim.size > } # End of j loop > > Error in pt.test[i] <- (test1$p.value < 0.05) : > object "pt.test" not found
Please do your homework yourself, read the psoting guide to this list and read the error message carefully, it tells you exactly what went wrong. Additionally, R provides some useful tools for debugging that you could your prior to spending others' time. Best wishes, Uwe Ligges > > Chat on a cool, new interface. No download required. Go to > http://in.messenger.yahoo.com/webmessengerpromo.php > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.