rm(list=ls()) #clears memory setwd("/rstuff") #sets path x <- 1:5000 #number of iterations for "for" h25<-NULL h50<-NULL h100<-NULL b25 <- NULL #creates null set b50 <- NULL b100 <- NULL #generate null distribution for(i in seq(along=x)) {b25<-c(b25, (mean(runif(25,3,12)))-(mean(runif(25,1,10))))} #randomly draws 100 continuous numbers #from 1 to 10, and calculates the mean #a2 <- sample(1:10, 500, replace=T) would draw 500 discrete observations #replace=T specifies sampling with replacement; replace=F is without replacement bet25<-b25/sd(b25) #generate alternate distribution where means differ by 2 for(i in seq(along=x)) {b50<-c(b50, (mean(runif(50,3,12)))-(mean(runif(50,1,10))))} bet50<-b50/sd(b50) #generate alternate distribution where means differ by 4 for(i in seq(along=x)) {b100<-c(b100, (mean(runif(100,3,12)))-(mean(runif(100,1,10))))} bet100<-b100/sd(b100) for(i in seq(along=x)) {h25<-c(h25, (mean(runif(25,1,10)))-(mean(runif(25,1,10))))} hn25<-h25/sd(h25) #generate alternate distribution where means differ by 2 for(i in seq(along=x)) {h50<-c(h50, (mean(runif(50,1,10)))-(mean(runif(50,1,10))))} hn50<-h50/sd(h50) #generate alternate distribution where means differ by 4 for(i in seq(along=x)) {h100<-c(h100, (mean(runif(100,1,10)))-(mean(runif(100,1,10))))} hn100<-h100/sd(h100) betan <- cbind(hn25,hn50,hn100,bet25,bet50,bet100) write.csv(betan, file = "betan.csv")