You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a question regarding cohen.d function.
I am trying to use this function to calculate confidence intervals for effect size using non-central t distribution for 500 samples. However, the function does not run inside a for loop if non-central=TRUE, even for small loops such as a loop of 2.
Here is the code that I have used:
# I generate two independent normal random samples size 10 with 500 repetition
x1 <-matrix(0,10,500)
x2 <-matrix(0,10,500)
for (i in 1:500) {
x1[,i] <- rnorm(10,9,2)
x2[,i] <- rnorm(10,8,2)
}
####Then I calculate confidence intervals for effect size using non-central t distribution
lb<-c(0)
ub<-c(0)
for (i in 1:500) {
cohen.dres<-cohen.d(x1[,i],x2[,i],hedges.correction = FALSE, noncentral =TRUE)
lb[i]<-cohen.dres$conf.int[1] ##saving the lower limit in a vector
ub[i]<-cohen.dres$conf.int[2] ##saving the upper limit in a vector
}
However, as I mentioned function cohen.d in the above for loop does not work.
The text was updated successfully, but these errors were encountered:
From email on March 19, 2017
The text was updated successfully, but these errors were encountered: