Corrected Cohen’s D

Calculating Cohen’s D is a pain particularly when you have data which is not independent (e.g. is longitudinal). So I have written a function which take away the hassle. It is in early form but produces a normal Cohen’s D and a corrected Cohen’s D for the paired nature of the data.

CCD<- function (x1, x2) {
dif<-mean(x2,na.rm=TRUE)-mean(x1, ,na.rm=TRUE)
SD<-(sd(x1,na.rm=TRUE) + sd(x2,na.rm=TRUE) )/2
COR<-cor(x1, x2, use="complete.obs")	
CCD<-CD/( (2*(1-COR) ) ^.5)	
list("Cohen's d"=CD, "Corrected Cohen's d"=CCD) 

About Philip Parker

I am a post doc in developmental and educational psychology at a Germany university. I did my PhD at the university of Sydney in stress and well-being. Most days I am hunched over a computer yelling at statistical software or responding to journal editors who seem to always want twice the amount of content but with half the words. For fun I like to read up on the latest developments in R and programming various functions.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s