Package 'CohensdpLibrary'

Title: Cohen's D_p Computation with Confidence Intervals
Description: Computing Cohen's d_p in any experimental designs (between-subject, within-subject, and single-group design). Cousineau (2022) <https://github.com/dcousin3/CohensdpLibrary>; Cohen (1969, ISBN: 0-8058-0283-5).
Authors: Denis Cousineau [aut, cre] (Developer), Douglas Fitts [ctb]
Maintainer: Denis Cousineau <[email protected]>
License: GPL-3
Version: 0.5.11
Built: 2024-11-09 06:27:13 UTC
Source: CRAN

Help Index


Cohen's standardized mean difference.

Description

Cohensdp() computes the Cohen's d (noted $d_p$) and its confidence interval in either within-subject, between-subject design and single-group design. For the between-subject design, MBESS already has an implementation based on the "pivotal" method but the present method is faster, using the method based on the Lambda prime distribution (Lecoutre 2007). See Hedges (1981); Cousineau (2022, submitted); Goulet-Pelletier and Cousineau (2018).

Usage

Cohensdp(statistics, design, gamma, method )

Arguments

statistics

a list of pre-computed statistics. The statistics to provide depend on the design: - for "between": m1, m2 the means of the two groups, s1, s2 the standard deviation of the two groups, and n1, n2, the sample sizes of the two groups; - for "within": m1, m2, s1, s2, n, and r or rho the correlation between the measure; - for "single": m, s, n and m0 the reference mean from which m is standardized).

design

the design of the measures ("within", "between", or "single");

gamma

the confidence level of the confidence interval (default 0.95)

method

In "within"-subject design only, choose among methods "piCI", or "adjustedlambdaprime" (default), "alginakeselman2003", "morris2000", and "regressionapproximation".

Details

This function uses the exact method in "single"-group and "between"-subject designs. In "within"-subject design, the default is the adjusted Lambda prime confidence interval ("adjustedlambdaprime") which is based on an approximate method. This method is described in Cousineau (submitted). Other methods are available, described in Morris (2000); Algina and Keselman (2003); Cousineau and Goulet-Pelletier (2021); Fitts (2022)

Value

The Cohen's $d_p$ statistic and its confidence interval. The return value is internally a dpObject which can be displayed with print, explain or summary/summarize.

References

Algina J, Keselman HJ (2003). “Approximate confidence intervals for effect sizes.” Educational and Psychological Measurement, 63, 537 – 553. doi:10.1177/0013164403256358.

Cousineau D (2022). “The exact distribution of the Cohen's dpd_p in repeated-measure designs.” doi:10.31234/osf.io/akcnd, https://osf.io/preprints/psyarxiv/akcnd/.

Cousineau D, Goulet-Pelletier J (2021). “A study of confidence intervals for Cohen's dp in within-subject designs with new proposals.” The Quantitative Methods for Psychology, 17, 51 – 75. doi:10.20982/tqmp.17.1.p051.

Cousineau D (submitted). “The exact confidence interval of the Cohen's dpd_p in repeated-measure designs.” The Quantitative Methods for Psychology.

Fitts DA (2022). “Point and interval estimates for a standardized mean difference in paired-samples designs using a pooled standard deviation.” The Quantitative Methods for Psychology, 18(2), 207-223. doi:10.20982/tqmp.18.2.p207.

Goulet-Pelletier J, Cousineau D (2018). “A review of effect sizes and their confidence intervals, Part I: The Cohen's d family.” The Quantitative Methods for Psychology, 14(4), 242-265. doi:10.20982/tqmp.14.4.p242.

Hedges LV (1981). “Distribution theory for Glass's estimator of effect size and related estimators.” journal of Educational Statistics, 6(2), 107–128.

Lecoutre B (2007). “Another look at confidence intervals from the noncentral T distribution.” Journal of Modern Applied Statistical Methods, 6, 107 – 116. doi:10.22237/jmasm/1177992600.

Morris SB (2000). “Distribution of the standardized mean change effect size for meta-analysis on repeated measures.” British Journal of Mathematical and Statistical Psychology, 53, 17 – 29. doi:10.1348/000711000159150.

Examples

# example in which the means are 114 vs. 101 with sds of 14.3 and 12.5 respectively
Cohensdp( statistics = list( m1= 101, m2= 114, s1= 12.5, s2= 14.3, n1= 12, n2= 12 ), 
          design     = "between")

# example in a repeated-measure design
Cohensdp(statistics =list( m1= 101, m2= 114, s1= 12.5, s2= 14.3, n= 12, rho= 0.53 ),
         design     ="within" )

# example with a single-group design where mu is a population parameter
Cohensdp( statistics = list( m = 101, m0 = 114, s = 12.5, n = 10 ), 
          design     = "single")

# The results can be displayed in three modes
res <- Cohensdp( statistics = list( m = 101, m0 = 114, s = 12.5, n = 10), 
                 design     = "single")

# a raw result of the Cohen's d_p and its confidence interval
res              

# a human-readable output
summarize( res ) 

# ... and a human-readable ouptut with additional explanations.
explain( res )   

# example in a repeated-measure design with a different method than piCI
Cohensdp(statistics =list( m1= 101, m2= 114, s1= 12.5, s2= 14.3, n= 12, r= 0.53 ),
         design     ="within", method = "adjustedlambdaprime")

explain

Description

explain() provides a human-readable, exhaustive, description of the results. It also provides references to the key results.

Usage

explain(x, ...)

## S3 method for class 'CohensdpObject'
explain(x, ...)

Arguments

x

an object to explain

...

ignored

Value

a human-readable output with details of computations.


The unbiased Hedges' standardized mean difference.

Description

Hedgesgp() computes the unbiased Cohen's d (noted $g_p$) in either within-subject, between-subject design and single-group design. See Hedges (1981); Goulet-Pelletier and Cousineau (2018).

Usage

Hedgesgp(statistics, design)

Arguments

statistics

a list of pre-computed statistics. The statistics to provide depend on the design: - for "between": m1, m2 the means of the two groups, s1, s2 the standard deviation of the two groups, and n1, n2, the sample sizes of the two groups; - for "within": m1, m2, s1, s2, n, and r or rho the correlation between the measure; - for "single": m, s, n and m0 the reference mean from which m is standardized).

design

the design of the measures ("within", "between", or "single");

Details

This function returns the Cohen's d_p statistics corrected for bias but no confidence interval as this estimate is not used to build such interval. This function uses r when rho is unknown.

Value

The unbiased Cohen's $d_p$ statistic, commonly called a Hedges' $g_p$. The return value is internally a dpObject which can be displayed with print, explain or summary/summarize.

References

Goulet-Pelletier J, Cousineau D (2018). “A review of effect sizes and their confidence intervals, Part I: The Cohen's d family.” The Quantitative Methods for Psychology, 14(4), 242-265. doi:10.20982/tqmp.14.4.p242.

Hedges LV (1981). “Distribution theory for Glass's estimator of effect size and related estimators.” journal of Educational Statistics, 6(2), 107–128.

Examples

# example in which the means are 114 vs. 101 with sDs of 14.3 and 12.5 respectively 
Hedgesgp( statistics = list( m1= 101, m2= 114, s1= 12.5, s2= 14.3, n1= 12, n2= 12 ), 
          design     = "between")

# example in a repeated-measure design
Hedgesgp( statistics = list( m1= 101, m2= 114, s1= 12.5, s2= 14.3, n= 12, rho= 0.53 ), 
          design     = "within")

# example with a single-group design where mu is a population parameter
Hedgesgp( statistics = list( m = 101, m0 = 114, s = 12.5, n = 10 ), 
          design     = "single")

# The results can be displayed in three modes
res <- Hedgesgp( statistics = list( m = 101, m0 = 114, s = 12.5, n = 10 ), 
                 design     = "single")

# a raw result of the Cohen's d_p and its confidence interval
res              

# a human-readable output
summarize( res ) 

# ... and a human-readable ouptut with additional explanations 
explain( res )

hypergeometric functions.

Description

The hypergeometric functions are a series of functions which includes the hypergeometric0F1, called the confluent hypergeometric limit function (D. Cousineau); the hypergeometric1F1, called the confluent hypergeometric function (Moreau 2014); and the hypergeometric2F1, called Gauss' confluent hypergeometric function (Michel and Stoitsov 2008). These functions are involved in the computation of the K' and Lambda' distributions, as well as the Chi-square" and the t" distributions (Cousineau 2022).

Usage

hypergeometric0F1(a, z)      
hypergeometric1F1(a, b, z)  
hypergeometric2F1(a, b, c, z)

Arguments

a

the first parameter;

z

the argument raised to the powers 0 ... infinity ;

b

the second parameter;

c

the third parameter;

Value

The result of the hypergeometric function.

References

Cousineau D (2022). “The exact distribution of the Cohen's dpd_p in repeated-measure designs.” doi:10.31234/osf.io/akcnd, https://osf.io/preprints/psyarxiv/akcnd/.

Michel N, Stoitsov MV (2008). “Fast computation of the Gauss hypergeometric function with all its parameters complex with application to the Poschl-Teller-Ginocchio potential wave functions.” Computer Physics Communications, 178(7), 535-551. doi:10.1016/j.cpc.2007.11.007.

Moreau J (2014). “Fortran Routines for Computation of Special Functions.” https://fortranwiki.org/fortran/show/Libraries.

Examples

hypergeometric0F1(12, 0.4)         #   1.033851
hypergeometric1F1(12, 14, 0.4)     #   1.409877
hypergeometric2F1(12, 14, 16, 0.4) # 205.5699

The correction factor J for a standardized mean difference.

Description

J() computes the correction factor to get an unbiased Cohen's $d_p$ in either within- subject, between-subject design and single-group design. See Lecoutre (2022 - submitted); Goulet-Pelletier and Cousineau (2018).

Usage

J(statistics, design)

Arguments

statistics

a list of pre-computed statistics. The statistics to provide depend on the design: - for "between": n1, n2, the sample sizes of the two groups; - for "within": n, and r or rho the correlation between the measure; - for "single": n.

design

the design of the measures ("within", "between", or "single");

Details

This function decreases the degrees of freedom by 1 in within-subject design when the population rho is unknown.

Value

The correction factor for unbiasing a Cohen's $d_p$. The return value is internally a dpObject which can be displayed with print, explain or summary/summarize.

References

Goulet-Pelletier J, Cousineau D (2018). “A review of effect sizes and their confidence intervals, Part I: The Cohen's d family.” The Quantitative Methods for Psychology, 14(4), 242-265. doi:10.20982/tqmp.14.4.p242.

Lecoutre B (2022 - submitted). “A note on the distributions of the sum and ratio of two correlated chi-square distributions.” submitted, submitted, submitted.

Examples

# example in which the means are 114 vs. 101 with sds of 14.3 and 12.5 respectively
J( statistics = list( n1 = 12, n2 = 12 ), 
   design     = "between")

# example in a repeated-measure design
J( statistics = list( n = 12, rho = 0.53 ), 
   design     = "within")

# example with a single-group design where mu is a population parameter
J( statistics = list( n = 12 ), 
   design     = "single")

# The results can be displayed in three modes
res <- J( statistics = list( n = 12 ), 
          design     = "single")

# a raw result of the Cohen's d_p and its confidence interval
res              

# a human-readable output
summarize( res ) 

# ...and a human-readable ouptut with additional explanations
explain( res )

The K' or non-central K distribution.

Description

The K' distribution was created to solve various problems in linear model statistics. pkprime returns the cumulative probability of the lambda prime distribution with parameters nu1, nu2, ncp; dkprime returns its density and qkprime, a quantile. Lecoutre (1999); Poitevineau and Lecoutre (2010).

Usage

pkprime(x, nu1, nu2, ncp) 
dkprime(x, nu1, nu2, ncp) 
qkprime(p, nu1, nu2, ncp)

Arguments

x

the value from which a probability is sought;

nu1

the first degree of freedom;

nu2

the second degree of freedom;

ncp

the noncentrality parameter;

p

the probability from which a quantile is requested;

Details

kprime is a (p,d,q) set of functions that compute the K-prime distribution. This distribution has many applications, including to obtain the sampling distribution of r given a population rho and the predictive distributions of rho given a sample r. See Lecoutre (1999); Poitevineau and Lecoutre (2010).

These functions are herein implemented from the FORTRAN source code of Poitevineau and Lecoutre (2010). Note that the library sadists also implements this distribution (Pav 2020). However, the sadists::kprime distribution is inaccurate for small nu1 or small nu2.

Value

     The probability or quantile of a K' distribution.

References

Lecoutre B (1999). “Two useful distributions for Bayesian predictive procedures under normal models.” Journal of Statistical Planning and Inference, 79, 93 – 105. doi:10.1016/S0378-3758(98)00231-6.

Pav SE (2020). “sadists: Some Additional Distributions [R package].” https://github.com/shabbychef/sadists.

Poitevineau J, Lecoutre B (2010). “Implementing Bayesian predictive procedures: The K-prime and K-square distributions.” Computational Statistics and Data Analysis, 54, 724 – 731. doi:10.1016/j.csda.2008.11.004.

Poitevineau J, Lecoutre B (2010). “Statistical distributions for bayesian experimental data analysis fortran functions 1. continuous distributions.” https://eris62.eu.

Examples

dkprime(11.1, 9, 8, 10.0)  # 0.09410193
pkprime(11.1, 9, 8, 10.0)  # 0.606652
qkprime(0.01, 9, 8, 10.0)  # 3.875234

Lambda prime or noncentral Lambda distribution.

Description

plprime computes the cumulative probability of the lambda-prime distribution with parameters nu, ncp. dlprime(x, nu, ncp) returns the density of the lambda prime and distribution qlprime(p, nu, ncp) its quantiles. See Lecoutre (1999).

Usage

plprime(x, nu, ncp) 
dlprime(x, nu, ncp)
qlprime(p, nu, ncp)

Arguments

x

the score for which a probability is sought;

nu

the degree of freedom of the distribution;

ncp

the non-centrality parameter of the distribution;

p

the probability from which a quantile is requested;

Details

lprime are functions that compute the Lambda-prime distribution. It was shown to be the predictive distribution of a population standardized mean or standardized mean difference in between-group design given an observed Cohen's dp (Lecoutre 2007).

These functions are implemented from the FORTRAN source of Poitevineau and Lecoutre (2010). Note that the library sadists also implements this distribution sadists::lprime (Pav 2020).

Value

     The probability or quantile of a Lambda' distribution.

References

Lecoutre B (1999). “Two useful distributions for Bayesian predictive procedures under normal models.” Journal of Statistical Planning and Inference, 79, 93 – 105. doi:10.1016/S0378-3758(98)00231-6.

Lecoutre B (2007). “Another look at confidence intervals from the noncentral T distribution.” Journal of Modern Applied Statistical Methods, 6, 107 – 116. doi:10.22237/jmasm/1177992600.

Pav SE (2020). “sadists: Some Additional Distributions [R package].” https://github.com/shabbychef/sadists.

Poitevineau J, Lecoutre B (2010). “Statistical distributions for bayesian experimental data analysis fortran functions 1. continuous distributions.” https://eris62.eu.

Examples

dlprime(11.1, 9, 10.0) # 0.129447
plprime(11.1, 9, 10.0) # 0.7134134
qlprime(0.01, 9, 10.0) # 4.2453

Lambda second distribution or the non-central, non-standard, Lambda distribution.

Description

This distribution was introduced in Cousineau (submitted) as the exact solution to the predictive distribution of the Cohen's dp in repeated-measure design. A more elegant notation was provided in Lecoutre (2022 - submitted). It is the dual of the t" distribution, the sampling distribution of dp in repeated-measure design introduced in Cousineau (2022).

Usage

plsecond(delta, n, d, rho) 
dlsecond(delta, n, d, rho) 
qlsecond(p,     n, d, rho)

Arguments

delta

the parameter of the population whose probability is to assess;

n

the sample size n

d

the observed d_p of the sample;

rho

the population correlation

p

the probability from which a quantile is requested

Details

lsecond are (p,d,q) functions that compute the Lambda-second (L") distribution. This distribution is an generalization of the lambda-prime distribution (Lecoutre 1999).

Note that the parameters are the raw sample size n, the observed Cohen's dp, and the population rho. All the scaling required are performed within the functions (and so you do not provide degrees of freedom).This is henceforth not a generic lambda-second distribution, but a lambda-second custom-tailored for the problem of standardized mean difference.

Value

     The probability or quantile of a Lambda'' distribution.

References

Cousineau D (2022). “The exact distribution of the Cohen's dpd_p in repeated-measure designs.” doi:10.31234/osf.io/akcnd, https://osf.io/preprints/psyarxiv/akcnd/.

Cousineau D (submitted). “The exact confidence interval of the Cohen's dpd_p in repeated-measure designs.” The Quantitative Methods for Psychology.

Lecoutre B (1999). “Two useful distributions for Bayesian predictive procedures under normal models.” Journal of Statistical Planning and Inference, 79, 93 – 105. doi:10.1016/S0378-3758(98)00231-6.

Lecoutre B (2022 - submitted). “A note on the distributions of the sum and ratio of two correlated chi-square distributions.” submitted, submitted, submitted.

Examples

dlsecond(0.25, 9, 0.26, 0.333) # 1.03753
plsecond(0.25, 9, 0.26, 0.333) # 0.494299
qlsecond(0.01, 9, 0.26, 0.333) # -0.6468003

prior-informed Lambda second distribution.

Description

This distribution extend the lambda second distribution introduced in Cousineau (submitted) as the exact solution to the predictive distribution of the Cohen's dp in repeated-measure when the population correlation is known. A more elegant notation was provided in Lecoutre (2022 - submitted). The prior-informed lambda prime is a bayesian extension to the lambda prime distribution in the case where the population rho is not known. It is then replaced by a prior which indicates the probability of a certain rho given the observed correlation r.

Usage

ppilsecond(delta, n, d, r) 
dpilsecond(delta, n, d, r) 
qpilsecond(p,     n, d, r)

Arguments

delta

the parameter of the population whose probability is to assess;

n

the sample size n

d

the observed d_p of the sample;

r

the sample correlation

p

the probability from which a quantile is requested

Details

pilsecond are (p,d,q) functions that compute the prior-informed Lambda-second (L") distribution. This distribution is an generalization of the lambda-prime distribution (Lecoutre 1999). It can take up to two seconds to compute.

Note: the parameters are the raw sample size n, the observed Cohen's dp, and the sample correlation r. All the scaling required are performed within the functions (and so you do not provide degrees of freedom). This is henceforth not a generic lambda-second distribution, but a lambda-second custom-tailored for the problem of standardized mean difference.

Value

     The probability or quantile of a prior-informed Lambda'' distribution.

References

Cousineau D (submitted). “The exact confidence interval of the Cohen's dpd_p in repeated-measure designs.” The Quantitative Methods for Psychology.

Lecoutre B (1999). “Two useful distributions for Bayesian predictive procedures under normal models.” Journal of Statistical Planning and Inference, 79, 93 – 105. doi:10.1016/S0378-3758(98)00231-6.

Lecoutre B (2022 - submitted). “A note on the distributions of the sum and ratio of two correlated chi-square distributions.” submitted, submitted, submitted.

Examples

### Note: this distribution can be slow to compute
### dpilsecond(0.25, 9, 0.26, 0.333) # 1.186735
### ppilsecond(0.25, 9, 0.26, 0.333) # 0.5150561
### qpilsecond(0.01, 9, 0.26, 0.333) # -0.7294266

summarize

Description

summarize() provides a human-readable output of a dpObject. it is synonym of summary() (but as actions are verbs, I used a verb).

Usage

summarize(x, ...)

## S3 method for class 'CohensdpObject'
summarize(x, ...)

Arguments

x

an object to summarize

...

ignored

Value

a human-readable output as per articles.