For the paired-samples case, the most common variant of Cohen's d is simply the mean of the differences divided by the standard deviation of the differences.
The following can be run in R, or at rdrr.io/snippets/.
(Example taken from here, with the caveat that I wrote it.)
Before = c(65, 75, 86, 69, 60, 81, 88, 53, 75, 73)
After = c(77, 98, 92, 77, 65, 77, 100, 73, 93, 75)
Difference = Before - After
mean(Difference)
### -10.2
sd(Difference)
### 8.469553
mean(Difference) / sd(Difference)
### -1.204314
Note that Cohen's d is negative, suggesting that the values in the second sample (After) are greater than those in the first sample (Before).
Also note that some calculators will return the absolute value of Cohen's d.
There are variants to this calculation. For example, there are cases where some suggest using the standard deviation of the Before samples as the denominator.
It is often useful to report the confidence interval for the effect size statistic.
For R users, at the time of writing, I didn't find a package that has pre-built function to calculate the confidence interval for the paired-samples case that I like. Below is code to get the confidence interval by bootstrap.
n = length(Difference)
Data = data.frame(1:n, Difference)
library(boot)
Function = function(input, index){
Input = input[index,]
Result = mean(Input$Difference) / sd(Input$Difference)
return(Result)}
Boot = boot(Data,
Function,
R=1000)
boot.ci(Boot,
conf = 0.95,
type = "perc")
### Intervals :
### Level Percentile
### 95% (-2.358, -0.681 )