Calculate cohen’s d for 2 paired samples. See Using_cohens_d.ipynb for a notebook of given examples.
Syntax
d = cD.cohensd_2paired(pre, post)
d = cD.cohensd_2paired(pre, post, Name=Value)
Description
A
d = cD.cohensd_2paired(pre, post) returns cohen’s d for 2 paired samples. example
B
d = cD.cohensd_2paired(pre, post, Name=Value) returns cohen’s d for 2 paired samples with additional options specified by one or more name-value pair arguments. For example, you can compare to a mean. example
Examples
Example 1
Generate some random data and find cohen’s d.
mu = np.array([3, 5])
sigma = np.array([[1, 0.6], [0.6, 3]])
data = np.random.multivariate_normal(mu, sigma, (100,))
cD.cohensd_2paired(data[:,0], data[:,1])
d = 1.4494613347104766
Example 2
Generate some random data and calculate cohen’s d with mean of 15.
mu = np.array([3, 5])
sigma = np.array([[1, 0.6], [0.6, 3]])
data = np.random.multivariate_normal(mu, sigma, (100,))
cD.cohensd_2paired(data[:,0], data[:,1])
d = 12.800599127957925
pre
Pre data vector
Vector of pre data.
Data Types: (numeric, vector)
post
Post data vector.
Vector of post data
Data Types: (numeric, vector)
Name-Value Arguments
Specified optional pairs of Name=Value
arguments. Name
is the is the argument name and Value
is the corresponding value. You can specify several name and value pair arguments in any order as Name1=Value1,...,NameN=ValueN
.
Example: mu=15
specifies compare difference in pre and post against mean of 15.
mu
Mean to compare against (default=0)
Mean to compare difference of pre and post data vectors against.
Data Types: (scalar, numeric, float)
Output
d
Effect size.
Cohen’s d effect size for 2 paired samples.
Data Types: (scalar, float, numeric)
More About
Lecture
I refrained from outputting size of effect (e.g., ‘small’, ‘medium’, ‘large’) because these are arbitrary and should be thought of as such.
Tips
Issues and Discussion
Issues and Discussion.
If you don’t know how to use github (or don’t want to), just send me an email.