Package 'minter'

Title: Effect Sizes for Meta-Analysis of Interactions from Factorial Experiments
Description: Compute effect sizes and their sampling variances from factorial experimental designs. The package supports calculation of simple effects, overall effects, and interaction effects for use in factorial meta-analyses. See Gurevitch et al. (2000) <doi:10.1086/303337>, Morris et al. (2007) <doi:10.1890/06-0442>, Lajeunesse (2011) <doi:10.1890/11-0423.1> and Macartney et al. (2022) <doi:10.1016/j.neubiorev.2022.104554>.
Authors: Facundo Decunta [aut, cre] (ORCID: <https://orcid.org/0009-0004-5774-1085>), Shinichi Nakagawa [ctb], Daniel Noble [ctb]
Maintainer: Facundo Decunta <[email protected]>
License: MIT + file LICENSE
Version: 0.1.1
Built: 2026-06-04 17:12:53 UTC
Source: https://github.com/fdecunta/minter

Help Index


Individual Effect: Log Coefficient Of Variation Ratio

Description

Computes the Log of the Coefficient of Variation Ratio between Factor A and the Control treatment.

Usage

lnCVR_ind(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  Ctrl_mean,
  Ctrl_sd,
  Ctrl_n,
  A_mean,
  A_sd,
  A_n
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

Ctrl_mean

Mean outcome from the Control treatment

Ctrl_sd

Standard deviation from the control treatment

Ctrl_n

Sample size from the control treatment

A_mean

Mean outcome from the treatment

A_sd

Standard deviation from the treatment

A_n

Sample size from the treatment

Details

lnCVRind=ln(CVACVCtrl)+12(nA1)12(nCtrl1)lnCVR_{ind} = \ln\left( \frac{CV_{A}}{CV_{Ctrl}} \right) + \frac{1}{2(n_{A} - 1)} - \frac{1}{2(n_{Ctrl} - 1)}

var(lnCVRind)=sdCtrl2nCtrlXˉCtrl2+12(nCtrl1)+sdA2nAXˉA2+12(nA1)var(lnCVR_{ind}) = \frac{sd_{Ctrl}^2}{n_{Ctrl}\bar{X}_{Ctrl}^2} + \frac{1}{2(n_{Ctrl} - 1)} + \frac{sd_A^2}{n_A\bar{X}_A^2} + \frac{1}{2(n_A - 1)}

This assumes no correlation between mean and variance (Nakagawa et al. 2015) and is computed as the sum of lnRR and lnVR variances.

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

References

Nakagawa, S., Poulin, R., Mengersen, K., Reinhold, K., Engqvist, L., Lagisz, M., & Senior, A. M. (2015). Meta‐analysis of variation: ecological and evolutionary applications and beyond. Methods in Ecology and Evolution, 6(2), 143-152.

Examples

data <- data.frame(
  study_id = 1:3,
  control_mean = c(8.5, 12.3, 6.8),
  control_sd = c(1.8, 2.9, 1.4),
  control_n = c(18, 24, 16),
  nutrient_mean = c(11.2, 16.7, 9.3),
  nutrient_sd = c(3.1, 4.8, 2.7),
  nutrient_n = c(19, 22, 17)
)

result <- lnCVR_ind(
  data = data,
  Ctrl_mean = "control_mean", Ctrl_sd = "control_sd", Ctrl_n = "control_n",
  A_mean = "nutrient_mean", A_sd = "nutrient_sd", A_n = "nutrient_n"
)

Interaction Effect: Log Coefficient of Variation Ratio

Description

Computes the interaction effect between Factors A and B in factorial experiments on the coefficient of variation ratio.

Usage

lnCVR_inter(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  Ctrl_mean,
  Ctrl_sd,
  Ctrl_n,
  A_mean,
  A_sd,
  A_n,
  B_mean,
  B_sd,
  B_n,
  AB_mean,
  AB_sd,
  AB_n
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

Ctrl_mean

Mean outcome from the Control treatment

Ctrl_sd

Standard deviation from the control treatment

Ctrl_n

Sample size from the control treatment

A_mean

Mean outcome from the treatment

A_sd

Standard deviation from the treatment

A_n

Sample size from the treatment

B_mean

Mean outcome from the B treatment

B_sd

Standard deviation from the B treatment

B_n

Sample size from the B treatment

AB_mean

Mean outcome from the interaction AxB treatment

AB_sd

Standard deviation from the interaction AxB treatment

AB_n

Sample size from the interaction AxB treatment

Details

lnCVRinter=ln(CVAB/CVBCVA/CVCtrl)+12(nAB1)12(nA1)12(nB1)+12(nCtrl1)lnCVR_{inter} = \ln\left( \frac{CV_{AB} / CV_{B}}{CV_{A} / CV_{Ctrl}} \right) + \frac{1}{2(n_{AB} - 1)} - \frac{1}{2(n_{A} - 1)} - \frac{1}{2(n_{B} - 1)} + \frac{1}{2(n_{Ctrl} - 1)}

var(lnCVRinter)=var(lnRRinter)+var(lnVRinter)var(lnCVR_{inter}) = var(\ln RR_{inter}) + var(\ln VR_{inter})

This follows the assumption of no correlation between mean and variance.

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

Examples

# Interaction effect logCVR (Light x Nutrients)
data <- data.frame(
  study_id = 1:2,
  control_mean = c(7.3, 8.9),
  control_sd = c(1.4, 1.7),
  control_n = c(20, 18),
  light_mean = c(12.8, 14.2),
  light_sd = c(3.1, 3.5),
  light_n = c(19, 20),
  nutrients_mean = c(9.6, 11.1),
  nutrients_sd = c(1.9, 2.2),
  nutrients_n = c(21, 17),
  light_nutrients_mean = c(18.4, 20.7),
  light_nutrients_sd = c(4.8, 5.3),
  light_nutrients_n = c(18, 19)
)

result <- lnCVR_inter(
  data = data,
  Ctrl_mean = "control_mean",
  Ctrl_sd = "control_sd",
  Ctrl_n = "control_n",
  A_mean = "light_mean",
  A_sd = "light_sd",
  A_n = "light_n",
  B_mean = "nutrients_mean",
  B_sd = "nutrients_sd",
  B_n = "nutrients_n",
  AB_mean = "light_nutrients_mean",
  AB_sd = "light_nutrients_sd",
  AB_n = "light_nutrients_n"
)

Main Effect: Log Coefficient Of Variation Ration

Description

Computes the main effect of Factor A across levels of Factor B in factorial experiments on the coefficient of variation.

Usage

lnCVR_main(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  Ctrl_mean,
  Ctrl_sd,
  Ctrl_n,
  A_mean,
  A_sd,
  A_n,
  B_mean,
  B_sd,
  B_n,
  AB_mean,
  AB_sd,
  AB_n
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

Ctrl_mean

Mean outcome from the Control treatment

Ctrl_sd

Standard deviation from the control treatment

Ctrl_n

Sample size from the control treatment

A_mean

Mean outcome from the treatment

A_sd

Standard deviation from the treatment

A_n

Sample size from the treatment

B_mean

Mean outcome from the B treatment

B_sd

Standard deviation from the B treatment

B_n

Sample size from the B treatment

AB_mean

Mean outcome from the interaction AxB treatment

AB_sd

Standard deviation from the interaction AxB treatment

AB_n

Sample size from the interaction AxB treatment

Details

lnCVRmain=12ln(CVABCVACVBCVCtrl)+12(12(nAB1)+12(nA1)12(nB1)12(nCtrl1))lnCVR_{main} = \frac{1}{2} \ln\left(\frac{CV_{AB}CV_{A}}{CV_{B}CV_{Ctrl}} \right) + \frac{1}{2} \left( \frac{1}{2(n_{AB} - 1)} + \frac{1}{2(n_{A} - 1)} - \frac{1}{2(n_{B} - 1)} - \frac{1}{2(n_{Ctrl} - 1)} \right)

var(lnCVRmain)=var(lnRRmain)+var(lnVRmain)var(\ln CVR_{main}) = var(\ln RR_{main}) + var(\ln VR_{main})

This follows the assumption of no correlation between mean and variance.

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

Examples

data <- data.frame(
  study_id = 1:2,
  control_mean = c(14.2, 16.8), control_sd = c(2.8, 3.1), control_n = c(16, 14),
  irrigation_mean = c(19.5, 22.1), irrigation_sd = c(5.2, 5.8), irrigation_n = c(15, 16),
  co2_mean = c(16.8, 19.4), co2_sd = c(3.1, 3.6), co2_n = c(17, 13),
  irrigation_co2_mean = c(24.3, 27.9), irrigation_co2_sd = c(6.8, 7.4), irrigation_co2_n = c(14, 15)
)

result <- lnCVR_main(
  data = data,
  Ctrl_mean = "control_mean", Ctrl_sd = "control_sd", Ctrl_n = "control_n",
  A_mean = "irrigation_mean", A_sd = "irrigation_sd", A_n = "irrigation_n",
  B_mean = "co2_mean", B_sd = "co2_sd", B_n = "co2_n", 
  AB_mean = "irrigation_co2_mean", AB_sd = "irrigation_co2_sd", AB_n = "irrigation_co2_n"
)

Individual effect: Log Response Ratio

Description

Computes the individual or simple effect of Factor A over the Control.

Usage

lnRR_ind(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  Ctrl_mean,
  Ctrl_sd,
  Ctrl_n,
  A_mean,
  A_sd,
  A_n
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

Ctrl_mean

Mean outcome from the Control treatment

Ctrl_sd

Standard deviation from the control treatment

Ctrl_n

Sample size from the control treatment

A_mean

Mean outcome from the experimental treatment

A_sd

Standard deviation from the experimental treatment

A_n

Sample size from the experimental treatment

Details

It is the classic Log Response Ratio (lnRR), which can also be computed with metafor's escalc() function using measure = "ROM".

The log response ratio of Factor A over Control is computed as:

Formulas:

lnRRind=ln(XˉAXˉCtrl)lnRR_{ind} = \ln\left(\frac{\bar{X}_A}{\bar{X}_{Ctrl}}\right)

var(lnRRind)=sdA2nAXˉA2+sdCtrl2nCtrlXˉCtrl2var(lnRR_{ind}) = \frac{sd_A^2}{n_A\bar{X}_A^2} + \frac{sd_{Ctrl}^2}{n_{Ctrl}\bar{X}_{Ctrl}^2}

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

References

Morris, W. F., Hufbauer, R. A., Agrawal, A. A., Bever, J. D., Borowicz, V. A., Gilbert, G. S., ... & Vázquez, D. P. (2007). Direct and interactive effects of enemies and mutualists on plant performance: a meta‐analysis. Ecology, 88(4), 1021-1029. https://doi.org/10.1890/06-0442

Lajeunesse, M. J. (2011). On the meta‐analysis of response ratios for studies with correlated and multi‐group designs. Ecology, 92(11), 2049-2055. https://doi.org/10.1890/11-0423.1

Examples

data <- data.frame(
  study_id = 1:3,
  control_mean = c(10, 15, 12),
  control_sd = c(2.1, 3.2, 2.8),
  control_n = c(20, 25, 18),
  drought_mean = c(12, 18, 14),
  drought_sd = c(2.3, 3.5, 3.1),
  drought_n = c(22, 24, 20)
)

# Compute individual effect of drought vs control
result <- lnRR_ind(
  data = data,
  Ctrl_mean = "control_mean",
  Ctrl_sd = "control_sd", 
  Ctrl_n = "control_n",
  A_mean = "drought_mean",
  A_sd = "drought_sd",
  A_n = "drought_n"
)

Interaction effect: Log Response Ratio

Description

Computes the interaction effect between factors A and B in factorial data.

Usage

lnRR_inter(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  Ctrl_mean,
  Ctrl_sd,
  Ctrl_n,
  A_mean,
  A_sd,
  A_n,
  B_mean,
  B_sd,
  B_n,
  AB_mean,
  AB_sd,
  AB_n
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

Ctrl_mean

Mean outcome from the Control treatment

Ctrl_sd

Standard deviation from the control treatment

Ctrl_n

Sample size from the control treatment

A_mean

Mean outcome from the treatment

A_sd

Standard deviation from the treatment

A_n

Sample size from the treatment

B_mean

Mean outcome from the B treatment

B_sd

Standard deviation from the B treatment

B_n

Sample size from the B treatment

AB_mean

Mean outcome from the interaction AxB treatment

AB_sd

Standard deviation from the interaction AxB treatment

AB_n

Sample size from the interaction AxB treatment

Details

lnRRinter=(lnXˉABlnXˉB)(lnXˉAlnXˉCtrl)lnRR_{inter} = (\ln\bar{X}_{AB} - \ln\bar{X}_B) - (\ln\bar{X}_A -\ln\bar{X}_{Ctrl})

var(lnRRinter)=sdAB2nABXˉAB2+sdA2nAXˉA2+sdB2nBXˉB2+sdCtrl2nCtrlXˉCtrl2var(lnRR_{inter}) = \frac{sd_{AB}^2}{n_{AB}\bar{X}_{AB}^2} + \frac{sd_A^2}{n_A\bar{X}_A^2} + \frac{sd_B^2}{n_B\bar{X}_B^2} + \frac{sd_{Ctrl}^2}{n_{Ctrl}\bar{X}_{Ctrl}^2}

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

References

Morris, W. F., Hufbauer, R. A., Agrawal, A. A., Bever, J. D., Borowicz, V. A., Gilbert, G. S., ... & Vázquez, D. P. (2007). Direct and interactive effects of enemies and mutualists on plant performance: a meta‐analysis. Ecology, 88(4), 1021-1029. https://doi.org/10.1890/06-0442

Examples

data <- data.frame(
  study_id = 1:2,
  control_mean = c(25, 28), control_sd = c(3.2, 3.8), control_n = c(15, 17),
  predation_mean = c(18, 20), predation_sd = c(2.9, 3.1), predation_n = c(16, 18),
  competition_mean = c(22, 24), competition_sd = c(3.0, 3.5), competition_n = c(14, 16),
  pred_comp_mean = c(12, 15), pred_comp_sd = c(2.1, 2.6), pred_comp_n = c(15, 17)
)

# Compute interaction effect between predation and competition
result <- lnRR_inter(
  data = data,
  Ctrl_mean = "control_mean", Ctrl_sd = "control_sd", Ctrl_n = "control_n",
  A_mean = "predation_mean", A_sd = "predation_sd", A_n = "predation_n",
  B_mean = "competition_mean", B_sd = "competition_sd", B_n = "competition_n",
  AB_mean = "pred_comp_mean", AB_sd = "pred_comp_sd", AB_n = "pred_comp_n"
)

Main effect: Log Response Ratio

Description

Computes the main effect of Factor A across levels of Factor B, analogous to the main effect in a factorial ANOVA.

Usage

lnRR_main(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  method = "nakagawa",
  Ctrl_mean,
  Ctrl_sd,
  Ctrl_n,
  A_mean,
  A_sd,
  A_n,
  B_mean,
  B_sd,
  B_n,
  AB_mean,
  AB_sd,
  AB_n
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

method

Method to compute lnRR. Can be either "nakagawa" or "morris". Default is "nakagawa".

Ctrl_mean

Mean outcome from the Control treatment

Ctrl_sd

Standard deviation from the control treatment

Ctrl_n

Sample size from the control treatment

A_mean

Mean outcome from the A treatment

A_sd

Standard deviation from the A treatment

A_n

Sample size from the A treatment

B_mean

Mean outcome from the B treatment

B_sd

Standard deviation from the B treatment

B_n

Sample size from the B treatment

AB_mean

Mean outcome from the interaction AxB treatment

AB_sd

Standard deviation from the interaction AxB treatment

AB_n

Sample size from the interaction AxB treatment

Details

There are two ways of computing the lnRR. One is the original method used by Morris et al. 2007, and the other is the one proposed by Shinichi Nakagawa (in prep). Default method is 'nakagawa':

Nakagawa formula

lnRRmain=12ln(XˉAXˉABXˉBXˉCtrl)lnRR_{main} = \frac{1}{2} \ln(\frac{\bar{X}_A\bar{X}_{AB}}{\bar{X}_B\bar{X}_{Ctrl}})

var(lnRRmain)=14(sdA2nAXˉA2+sdB2nBXˉB2+sdAB2nABXˉAB2+sdCtrl2nCtrlXˉCtrl2)var(lnRR_{main}) = \frac{1}{4} ( \frac{sd_A^2}{n_A\bar{X}_A^2} + \frac{sd_B^2}{n_B\bar{X}_B^2} + \frac{sd_{AB}^2}{n_{AB}\bar{X}_{AB}^2} + \frac{sd_{Ctrl}^2}{n_{Ctrl}\bar{X}_{Ctrl}^2} )

Morris formula

lnRRmain=ln(XˉA+XˉABXˉB+XˉCtrl)lnRR_{main} = \ln(\frac{\bar{X}_A + \bar{X}_{AB}}{\bar{X}_B + \bar{X}_{Ctrl}})

var(lnRRmain)=(1XˉA+XˉAB)2(sdA2nA+sdAB2nAB)+(1XˉB+XˉCtrl)2(sdB2nB+sdCtrl2nCtrl)var(lnRR_{main}) = (\frac{1}{\bar{X}_A + \bar{X}_{AB}})^2 (\frac{sd_A^2}{n_A} + \frac{sd_{AB}^2}{n_{AB}}) + (\frac{1}{\bar{X}_B + \bar{X}_{Ctrl}})^2 (\frac{sd_B^2}{n_B} + \frac{sd_{Ctrl}^2}{n_{Ctrl}})

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

References

Morris, W. F., Hufbauer, R. A., Agrawal, A. A., Bever, J. D., Borowicz, V. A., Gilbert, G. S., ... & Vázquez, D. P. (2007). Direct and interactive effects of enemies and mutualists on plant performance: a meta‐analysis. Ecology, 88(4), 1021-1029. https://doi.org/10.1890/06-0442

Lajeunesse, M. J. (2011). On the meta‐analysis of response ratios for studies with correlated and multi‐group designs. Ecology, 92(11), 2049-2055. https://doi.org/10.1890/11-0423.1

Macartney, E. L., Lagisz, M., & Nakagawa, S. (2022). The relative benefits of environmental enrichment on learning and memory are greater when stressed: A meta-analysis of interactions in rodents. Neuroscience & Biobehavioral Reviews, 135, 104554. https://doi.org/10.1016/j.neubiorev.2022.104554

Examples

# Example data for 2x2 factorial design (Fertilization x Warming)
data <- data.frame(
  study_id = 1:2,
  control_mean = c(10, 12), control_sd = c(2.0, 2.5), control_n = c(20, 18),
  fertilization_mean = c(15, 16), fertilization_sd = c(2.2, 2.8), fertilization_n = c(20, 19),
  warming_mean = c(11, 13), warming_sd = c(2.1, 2.6), warming_n = c(21, 17),
  fert_warm_mean = c(17, 19), fert_warm_sd = c(2.4, 3.0), fert_warm_n = c(19, 20)
)

# Compute main effect of fertilization
result <- lnRR_main(
  data = data,
  Ctrl_mean = "control_mean", Ctrl_sd = "control_sd", Ctrl_n = "control_n",
  A_mean = "fertilization_mean", A_sd = "fertilization_sd", A_n = "fertilization_n",
  B_mean = "warming_mean", B_sd = "warming_sd", B_n = "warming_n",
  AB_mean = "fert_warm_mean", AB_sd = "fert_warm_sd", AB_n = "fert_warm_n"
)

Individual effect: Log of Variability Ratio

Description

Computes the Log of the Variability Ratio between a Factor A and the Control treatment in factorial experiments.

Usage

lnVR_ind(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  Ctrl_sd,
  Ctrl_n,
  A_sd,
  A_n
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

Ctrl_sd

Standard deviation from the control treatment

Ctrl_n

Sample size from the control treatment

A_sd

Standard deviation from the treatment

A_n

Sample size from the treatment

Details

lnVRind=ln(sdAsdCtrl)+12(nA1)12(nCtrl1)lnVR_{ind} = \ln\left(\frac{sd_{A}}{sd_{Ctrl}}\right) + \frac{1}{2(n_{A} - 1)} - \frac{1}{2(n_{Ctrl} - 1)}

var(lnVRind)=12(nA1)+12(nCtrl1)var(lnVR_{ind}) = \frac{1}{2(n_{A} - 1)} + \frac{1}{2(n_{Ctrl} - 1)}

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

References

Nakagawa, S., Poulin, R., Mengersen, K., Reinhold, K., Engqvist, L., Lagisz, M., & Senior, A. M. (2015). Meta‐analysis of variation: ecological and evolutionary applications and beyond. Methods in Ecology and Evolution, 6(2), 143-152.

Examples

# Example focusing on variability differences (Herbivory effect)
data <- data.frame(
  study_id = 1:3,
  control_sd = c(2.1, 1.8, 2.5),
  control_n = c(20, 22, 18),
  herbivory_sd = c(3.2, 2.9, 3.8),
  herbivory_n = c(21, 20, 19)
)

result <- lnVR_ind(
  data = data,
  Ctrl_sd = "control_sd",
  Ctrl_n = "control_n",
  A_sd = "herbivory_sd", 
  A_n = "herbivory_n"
)

Interaction effect: Log Variability Ratio

Description

Computes the interaction of Factors A and B measured as the log of the variability ratio.

Usage

lnVR_inter(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  Ctrl_sd,
  Ctrl_n,
  A_sd,
  A_n,
  B_sd,
  B_n,
  AB_sd,
  AB_n
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

Ctrl_sd

Standard deviation from the control treatment

Ctrl_n

Sample size from the control treatment

A_sd

Standard deviation from the A treatment

A_n

Sample size from the A treatment

B_sd

Standard deviation from the B treatment

B_n

Sample size from the B treatment

AB_sd

Standard deviation from the interaction AxB treatment

AB_n

Sample size from the interaction AxB treatment

Details

lnVRinter=ln(sdAB/sdBsdA/sdCtrl)+12(nAB1)12(nA1)12(nB1)+12(nCtrl1)lnVR_{inter} = \ln\left( \frac{sd_{AB} / sd_{B}}{sd_{A} / sd_{Ctrl}} \right) + \frac{1}{2(n_{AB} - 1)} - \frac{1}{2(n_{A} - 1)} - \frac{1}{2(n_{B} - 1)} + \frac{1}{2(n_{Ctrl} - 1)}

var(lnVRinter)=12(nAB1)+12(nA1)+12(nB1)+12(nCtrl1)var(lnVR_{inter}) = \frac{1}{2(n_{AB} - 1)} + \frac{1}{2(n_{A} - 1)} + \frac{1}{2(n_{B} - 1)} + \frac{1}{2(n_{Ctrl} - 1)}

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

Examples

# Example for interaction effect in 2x2 factorial focusing on variability (Drought x Temperature)
data <- data.frame(
  study_id = 1:2,
  control_sd = c(1.8, 2.1), control_n = c(22, 19),
  drought_sd = c(2.6, 2.9), drought_n = c(20, 21),
  temperature_sd = c(2.0, 2.3), temperature_n = c(21, 18),
  drought_temp_sd = c(3.2, 3.6), drought_temp_n = c(19, 20)
)

result <- lnVR_inter(
  data = data,
  Ctrl_sd = "control_sd", Ctrl_n = "control_n",
  A_sd = "drought_sd", A_n = "drought_n", 
  B_sd = "temperature_sd", B_n = "temperature_n",
  AB_sd = "drought_temp_sd", AB_n = "drought_temp_n"
)

Main Effect: Log of the Variability Ratio

Description

Computes the overral log of the variability ratio for Factor A across levels of Factor B.

Usage

lnVR_main(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  Ctrl_sd,
  Ctrl_n,
  A_sd,
  A_n,
  B_sd,
  B_n,
  AB_sd,
  AB_n
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

Ctrl_sd

Standard deviation from the control treatment

Ctrl_n

Sample size from the control treatment

A_sd

Standard deviation from the A treatment

A_n

Sample size from the A treatment

B_sd

Standard deviation from the B treatment

B_n

Sample size from the B treatment

AB_sd

Standard deviation from the interaction AxB treatment

AB_n

Sample size from the interaction AxB treatment

Details

lnVRmain=12ln(sdABsdAsdBsdCtrl)+12(12(nAB1)+12(nA1)12(nB1)12(nCtrl1))lnVR_{main} = \frac{1}{2} \ln\left( \frac{sd_{AB}sd_{A}}{sd_{B}sd_{Ctrl}} \right) + \frac{1}{2} \left( \frac{1}{2(n_{AB} - 1)} + \frac{1}{2(n_{A} - 1)} - \frac{1}{2(n_{B} - 1)} - \frac{1}{2(n_{Ctrl} - 1)} \right)

var(lnVRmain)=14(12(nAB1)+12(nA1)+12(nB1)+12(nCtrl1))var(lnVR_{main}) = \frac{1}{4} \left( \frac{1}{2(n_{AB} - 1)} + \frac{1}{2(n_{A} - 1)} + \frac{1}{2(n_{B} - 1)} + \frac{1}{2(n_{Ctrl} - 1)} \right)

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

Examples

# Example for main effect in 2x2 factorial focusing on variability (Fire x Grazing)
data <- data.frame(
  study_id = 1:2,
  control_sd = c(2.0, 2.3), control_n = c(20, 18),
  fire_sd = c(2.8, 3.1), fire_n = c(19, 20),
  grazing_sd = c(2.2, 2.5), grazing_n = c(21, 17),
  fire_grazing_sd = c(3.5, 3.8), fire_grazing_n = c(18, 19)
)

result <- lnVR_main(
  data = data,
  Ctrl_sd = "control_sd", Ctrl_n = "control_n",
  A_sd = "fire_sd", A_n = "fire_n",
  B_sd = "grazing_sd", B_n = "grazing_n",
  AB_sd = "fire_grazing_sd", AB_n = "fire_grazing_n"
)

Individual effect: Standardized Mean Difference

Description

Computes the effect of Factor A over the Control.

Usage

SMD_ind(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  hedges_correction = TRUE,
  Ctrl_mean,
  Ctrl_sd,
  Ctrl_n,
  A_mean,
  A_sd,
  A_n
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

hedges_correction

Boolean. If TRUE correct for small-sample bias. Default is TRUE.

Ctrl_mean

Mean outcome from the Control treatment

Ctrl_sd

Standard deviation from the control treatment

Ctrl_n

Sample size from the control treatment

A_mean

Mean outcome from the experimental treatment

A_sd

Standard deviation from the experimental treatment

A_n

Sample size from the experimental treatment

Details

It is the classic Standardized Mean Difference (SMD), which can also be computed with metafor's escalc() function using measure = "SMD".

The SMD of Factor A over the Control is computed as:

dind=XˉAXˉCtrlSpooledJ(m)d_{ind} = \frac{\bar{X}_A - \bar{X}_{Ctrl}}{S_{pooled}} \cdot J(m)

where the pooled standard deviation is:

Spooled=(nA1)sdA2+(nCtrl1)sdCtrl2nA+nCtrl2S_{pooled} = \sqrt{\frac{(n_A-1)sd_A^2 + (n_{Ctrl}-1)sd_{Ctrl}^2}{n_A + n_{Ctrl} - 2}}

And the Hedges correction:

J(m)=134m1J(m) = 1 - \frac{3}{4m-1}

with :

m=nA+nCtrl2m = n_A + n_{Ctrl} - 2

The sampling variance is:

var(dind)=1nA+1nCtrl+d22(nA+nCtrl)var(d_{ind}) = \frac{1}{n_A} + \frac{1}{n_{Ctrl}} + \frac{d^2}{2(n_A + n_{Ctrl})}

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

References

Gurevitch, J., Morrison, J. A., & Hedges, L. V. (2000). The interaction between competition and predation: a meta-analysis of field experiments. The American Naturalist, 155(4), 435-453.

Morris, W. F., Hufbauer, R. A., Agrawal, A. A., Bever, J. D., Borowicz, V. A., Gilbert, G. S., ... & Vázquez, D. P. (2007). Direct and interactive effects of enemies and mutualists on plant performance: a meta‐analysis. Ecology, 88(4), 1021-1029. https://doi.org/10.1890/06-0442

Examples

data <- data.frame(
  study_id = 1:3,
  control_mean = c(45.2, 52.8, 38.9),
  control_sd = c(8.1, 11.2, 7.3),
  control_n = c(18, 23, 16),
  pollinator_exclusion_mean = c(28.7, 35.4, 22.1),
  pollinator_exclusion_sd = c(6.8, 9.1, 5.9),
  pollinator_exclusion_n = c(20, 22, 18)
)

# With Hedges' correction (default)
result <- SMD_ind(
  data = data,
  Ctrl_mean = "control_mean",
  Ctrl_sd = "control_sd",
  Ctrl_n = "control_n",
  A_mean = "pollinator_exclusion_mean",
  A_sd = "pollinator_exclusion_sd",
  A_n = "pollinator_exclusion_n",
  hedges_correction = TRUE
)

# Without Hedges' correction
result_no_hedges <- SMD_ind(
  data = data,
  Ctrl_mean = "control_mean",
  Ctrl_sd = "control_sd",
  Ctrl_n = "control_n",
  A_mean = "pollinator_exclusion_mean",
  A_sd = "pollinator_exclusion_sd",
  A_n = "pollinator_exclusion_n",
  hedges_correction = FALSE
)

Interaction effect: Standardized mean difference

Description

Computes the interaction effect between factors A and B in factorial data.

Usage

SMD_inter(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  hedges_correction = TRUE,
  Ctrl_mean,
  Ctrl_sd,
  Ctrl_n,
  A_mean,
  A_sd,
  A_n,
  B_mean,
  B_sd,
  B_n,
  AB_mean,
  AB_sd,
  AB_n
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

hedges_correction

Logical. Apply or not Hedges' correction for small-sample bias. Default is TRUE

Ctrl_mean

Mean outcome from the Control treatment

Ctrl_sd

Standard deviation from the control treatment

Ctrl_n

Sample size from the control treatment

A_mean

Mean outcome from the treatment

A_sd

Standard deviation from the treatment

A_n

Sample size from the treatment

B_mean

Mean outcome from the B treatment

B_sd

Standard deviation from the B treatment

B_n

Sample size from the B treatment

AB_mean

Mean outcome from the interaction AxB treatment

AB_sd

Standard deviation from the interaction AxB treatment

AB_n

Sample size from the interaction AxB treatment

Details

The interaction is computed as:

dinter=(XˉABXˉB)(XˉAXˉCtrl)SpooledJ(m)d_{inter} = \frac{ (\bar{X}_{AB} - \bar{X}_B) - (\bar{X}_A - \bar{X}_{Ctrl}) }{S_{pooled}} \cdot J(m)

With the pooled standard deviation:

Spooled=(nA1)sdA2+(nB1)sdB2+(nAB1)sdAB2+(nCtrl1)sdCtrl2nA+nB+nAB+nCtrl4S_{pooled} = \sqrt{ \frac{ (n_A-1)sd_A^2 + (n_B-1)sd_B^2 + (n_{AB}-1)sd_{AB}^2 + (n_{Ctrl}-1)sd_{Ctrl}^2 }{ n_A + n_B + n_{AB} + n_{Ctrl} - 4 } }

And the Hedges correction as:

J(m)=134m1J(m) = 1 - \frac{3}{4m-1}

with:

m=nA+nB+nAB+nCtrl4m = n_A + n_B + n_{AB} + n_{Ctrl} - 4

The sampling variance is computed as:

var(dinter)=1nA+1nB+1nAB+1nCtrl+dinter22(nA+nB+nAB+nCtrl)var(d_{inter}) = \frac{1}{n_A} + \frac{1}{n_B} + \frac{1}{n_{AB}} + \frac{1}{n_{Ctrl}} + \frac{d_{inter}^2}{2(n_A + n_B + n_{AB} + n_{Ctrl})}

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

References

Gurevitch, J., Morrison, J. A., & Hedges, L. V. (2000). The interaction between competition and predation: a meta-analysis of field experiments. The American Naturalist, 155(4), 435-453.

Morris, W. F., Hufbauer, R. A., Agrawal, A. A., Bever, J. D., Borowicz, V. A., Gilbert, G. S., ... & Vázquez, D. P. (2007). Direct and interactive effects of enemies and mutualists on plant performance: a meta‐analysis. Ecology, 88(4), 1021-1029. https://doi.org/10.1890/06-0442

Examples

data <- data.frame(
  study_id = 1:2,
  control_mean = c(24.8, 27.2), control_sd = c(4.1, 4.6), control_n = c(18, 16),
  salinity_mean = c(19.3, 21.7), salinity_sd = c(3.8, 4.2), salinity_n = c(17, 18),
  temperature_mean = c(28.9, 31.4), temperature_sd = c(4.7, 5.1), temperature_n = c(19, 15),
  salt_temp_mean = c(15.2, 17.8), salt_temp_sd = c(3.1, 3.5), salt_temp_n = c(16, 17)
)

result <- SMD_inter(
  data = data,
  Ctrl_mean = "control_mean", Ctrl_sd = "control_sd", Ctrl_n = "control_n",
  A_mean = "salinity_mean", A_sd = "salinity_sd", A_n = "salinity_n",
  B_mean = "temperature_mean", B_sd = "temperature_sd", B_n = "temperature_n",
  AB_mean = "salt_temp_mean", AB_sd = "salt_temp_sd", AB_n = "salt_temp_n"
)

Main effect: Standardized Mean Difference

Description

Computes the main effect of Factor A across levels of Factor B, analogous to the main effect in a factorial ANOVA.

Usage

SMD_main(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  hedges_correction = TRUE,
  Ctrl_mean,
  Ctrl_sd,
  Ctrl_n,
  A_mean,
  A_sd,
  A_n,
  B_mean,
  B_sd,
  B_n,
  AB_mean,
  AB_sd,
  AB_n
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

hedges_correction

Boolean. If TRUE correct for small-sample bias. Default is TRUE.

Ctrl_mean

Mean outcome from the Control treatment

Ctrl_sd

Standard deviation from the control treatment

Ctrl_n

Sample size from the control treatment

A_mean

Mean outcome from the A treatment

A_sd

Standard deviation from the A treatment

A_n

Sample size from the A treatment

B_mean

Mean outcome from the B treatment

B_sd

Standard deviation from the B treatment

B_n

Sample size from the B treatment

AB_mean

Mean outcome from the interaction AxB treatment

AB_sd

Standard deviation from the interaction AxB treatment

AB_n

Sample size from the interaction AxB treatment

Details

The main SMD of Factor A is computed as:

dmain=(XˉA+XˉAB)(XˉB+XˉCtrl)2SpooledJ(m)d_{main} = \frac{ (\bar{X}_A + \bar{X}_{AB}) - (\bar{X}_{B} + \bar{X}_{Ctrl}) }{2S_{pooled}} \cdot J(m)

With the pooled standard deviation:

Spooled=(nA1)sdA2+(nB1)sdB2+(nAB1)sdAB2+(nCtrl1)sdCtrl2nA+nB+nAB+nCtrl4S_{pooled} = \sqrt{ \frac{ (n_A-1)sd_A^2 + (n_B-1)sd_B^2 + (n_{AB}-1)sd_{AB}^2 + (n_{Ctrl}-1)sd_{Ctrl}^2 }{ n_A + n_B + n_{AB} + n_{Ctrl} - 4 } }

And the Hedges correction as:

J(m)=134m1J(m) = 1 - \frac{3}{4m-1}

with:

m=nA+nB+nAB+nCtrl4m = n_A + n_B + n_{AB} + n_{Ctrl} - 4

The sampling variance is computed as:

var(dmain)=14[1nA+1nB+1nAB+1nCtrl+dmain22(nA+nB+nAB+nCtrl)]var(d_{main}) = \frac{1}{4} \left[ \frac{1}{n_A} + \frac{1}{n_B} + \frac{1}{n_{AB}} + \frac{1}{n_{Ctrl}} + \frac{d_{main}^2}{2(n_A + n_B + n_{AB} + n_{Ctrl})} \right]

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

References

Gurevitch, J., Morrison, J. A., & Hedges, L. V. (2000). The interaction between competition and predation: a meta-analysis of field experiments. The American Naturalist, 155(4), 435-453.

Morris, W. F., Hufbauer, R. A., Agrawal, A. A., Bever, J. D., Borowicz, V. A., Gilbert, G. S., ... & Vázquez, D. P. (2007). Direct and interactive effects of enemies and mutualists on plant performance: a meta‐analysis. Ecology, 88(4), 1021-1029. https://doi.org/10.1890/06-0442

Examples

# Main effect of Mycorrhiza in 2x2 factorial design (AMF x Phosphorus)
data <- data.frame(
  study_id = 1:2,
  control_mean = c(12.4, 15.1), control_sd = c(2.8, 3.2), control_n = c(16, 14),
  mycorrhizae_mean = c(18.7, 21.3), mycorrhizae_sd = c(3.4, 3.9), mycorrhizae_n = c(15, 16),
  phosphorus_mean = c(14.9, 17.8), phosphorus_sd = c(3.1, 3.6), phosphorus_n = c(17, 13),
  myco_phos_mean = c(22.1, 25.4), myco_phos_sd = c(4.2, 4.8), myco_phos_n = c(14, 15)
)

result <- SMD_main(
  data = data,
  Ctrl_mean = "control_mean", Ctrl_sd = "control_sd", Ctrl_n = "control_n",
  A_mean = "mycorrhizae_mean", A_sd = "mycorrhizae_sd", A_n = "mycorrhizae_n",
  B_mean = "phosphorus_mean", B_sd = "phosphorus_sd", B_n = "phosphorus_n",
  AB_mean = "myco_phos_mean", AB_sd = "myco_phos_sd", AB_n = "myco_phos_n"
)

Log Coefficient of Variation Ratio: Interaction Between Treatment and Time

Description

lnCVR=ln(CVt1.Exp/CVt1.CtrlCVt0.Exp/CVt0.Ctrl)lnCVR = \ln\left(\frac{CV_{t1.Exp} / CV_{t1.Ctrl}}{CV_{t0.Exp} / CV_{t0.Ctrl}}\right)

Usage

time_lnCVR(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  t0_Ctrl_mean,
  t0_Ctrl_sd,
  t1_Ctrl_mean,
  t1_Ctrl_sd,
  Ctrl_n,
  Ctrl_cor,
  t0_Exp_mean,
  t0_Exp_sd,
  t1_Exp_mean,
  t1_Exp_sd,
  Exp_n,
  Exp_cor
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

t0_Ctrl_mean

Sample mean from the control group at time 0

t0_Ctrl_sd

Standard deviation from the control group at time 0

t1_Ctrl_mean

Sample mean from the control group at time 1

t1_Ctrl_sd

Standard deviation from the control group at time 1

Ctrl_n

Sample size of the control group

Ctrl_cor

Number or numeric vector. Correlation between the means of the control group at t0 and t1

t0_Exp_mean

Sample mean from the experimental group at time 0

t0_Exp_sd

Standard deviation from the experimental group at time 0

t1_Exp_mean

Sample mean from the experimental group at time 1

t1_Exp_sd

Standard deviation from the experimental group at time 1

Exp_n

Sample size of the experimental group

Exp_cor

Number or numeric vector. Correlation between the means of the experimental group at t0 and t1

Details

var(lnCVR)=var(lnRR)+var(lnVR)var(lnCVR) = var(lnRR) + var(lnVR)

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

References

Shinichi Nakagawa and Daniel Noble, personal communication.

Examples

# Pre-post design for coefficient of variation changes over time (Disturbance experiment)
data <- data.frame(
  study_id = 1:2,
  pre_control_mean = c(12.8, 15.4), pre_control_sd = c(2.6, 3.1),
  post_control_mean = c(13.2, 15.9), post_control_sd = c(2.7, 3.2),
  control_n = c(20, 18),
  pre_disturbed_mean = c(12.9, 15.2), pre_disturbed_sd = c(2.5, 3.0),
  post_disturbed_mean = c(8.7, 10.1), post_disturbed_sd = c(3.8, 4.3),
  disturbed_n = c(19, 21)
)

result <- time_lnCVR(
  data = data,
  t0_Ctrl_mean = "pre_control_mean", t0_Ctrl_sd = "pre_control_sd",
  t1_Ctrl_mean = "post_control_mean", t1_Ctrl_sd = "post_control_sd",
  Ctrl_n = "control_n", Ctrl_cor = 0.8,
  t0_Exp_mean = "pre_disturbed_mean", t0_Exp_sd = "pre_disturbed_sd",
  t1_Exp_mean = "post_disturbed_mean", t1_Exp_sd = "post_disturbed_sd",
  Exp_n = "disturbed_n", Exp_cor = 0.5
)

Log Response Ratio: Interaction Between Treatment and Time

Description

lnRR=ln(Xˉt1,Exp/Xˉt1,CtrlXˉt0,Exp/Xˉt0,Ctrl)lnRR = \ln\left(\frac{\bar{X}_{t1,Exp} / \bar{X}_{t1,Ctrl}}{\bar{X}_{t0,Exp} / \bar{X}_{t0,Ctrl}}\right)

Usage

time_lnRR(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  t0_Ctrl_mean,
  t0_Ctrl_sd,
  t1_Ctrl_mean,
  t1_Ctrl_sd,
  Ctrl_n,
  Ctrl_cor,
  t0_Exp_mean,
  t0_Exp_sd,
  t1_Exp_mean,
  t1_Exp_sd,
  Exp_n,
  Exp_cor
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

t0_Ctrl_mean

Sample mean from the control group at time 0

t0_Ctrl_sd

Standard deviation from the control group at time 0

t1_Ctrl_mean

Sample mean from the control group at time 1

t1_Ctrl_sd

Standard deviation from the control group at time 1

Ctrl_n

Sample size of the control group

Ctrl_cor

Number or numeric vector. Correlation between the means of the control group at t0 and t1

t0_Exp_mean

Sample mean from the experimental group at time 0

t0_Exp_sd

Standard deviation from the experimental group at time 0

t1_Exp_mean

Sample mean from the experimental group at time 1

t1_Exp_sd

Standard deviation from the experimental group at time 1

Exp_n

Sample size of the experimental group

Exp_cor

Number or numeric vector. Correlation between the means of the experimental group at t0 and t1

Details

var(lnRR)=(sdt0,Exp2Xˉt1,Exp2+sdt1,Exp2Xˉt0,Exp22rExpXˉt0,ExpXˉt1,Expsdt0,Expsdt1,Exp)nExpXˉt0,Exp2Xˉt1,Exp2+var(\ln RR) = \frac{(sd_{t0,Exp}^2 \bar{X}_{t1,Exp}^2 + sd_{t1,Exp}^2 \bar{X}_{t0,Exp}^2 - 2r_{Exp} \bar{X}_{t0,Exp} \bar{X}_{t1,Exp} sd_{t0,Exp} sd_{t1,Exp})}{n_{Exp} \bar{X}_{t0,Exp}^2 \bar{X}_{t1,Exp}^2} +

(sdt0,Ctrl2Xˉt1,Ctrl2+sdt1,Ctrl2Xˉt0,Ctrl22rCtrlXˉt0,CtrlXˉt1,Ctrlsdt0,Ctrlsdt1,Ctrl)nCtrlXˉt0,Ctrl2Xˉt1,Ctrl2\frac{(sd_{t0,Ctrl}^2 \bar{X}_{t1,Ctrl}^2 + sd_{t1,Ctrl}^2 \bar{X}_{t0,Ctrl}^2 - 2r_{Ctrl} \bar{X}_{t0,Ctrl} \bar{X}_{t1,Ctrl} sd_{t0,Ctrl} sd_{t1,Ctrl})}{n_{Ctrl} \bar{X}_{t0,Ctrl}^2 \bar{X}_{t1,Ctrl}^2}

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

References

Shinichi Nakagawa and Daniel Noble, personal communication.

Examples

data <- data.frame(
  study_id = 1:2,
  pre_control_mean = c(8.4, 10.2),     # Control before restoration
  pre_control_sd = c(1.8, 2.1),
  post_control_mean = c(8.9, 10.7),    # Control after restoration period
  post_control_sd = c(1.9, 2.2),
  control_n = c(22, 18),
  pre_restoration_mean = c(8.6, 10.1), # Restoration sites before
  pre_restoration_sd = c(1.9, 2.0),
  post_restoration_mean = c(15.3, 17.8), # Restoration sites after
  post_restoration_sd = c(3.2, 3.7),
  restoration_n = c(20, 19)
)

result <- time_lnRR(
  data = data,
  t0_Ctrl_mean = "pre_control_mean", t0_Ctrl_sd = "pre_control_sd",
  t1_Ctrl_mean = "post_control_mean", t1_Ctrl_sd = "post_control_sd",
  Ctrl_n = "control_n", Ctrl_cor = 0.7,  # Correlation within control sites
  t0_Exp_mean = "pre_restoration_mean", t0_Exp_sd = "pre_restoration_sd",
  t1_Exp_mean = "post_restoration_mean", t1_Exp_sd = "post_restoration_sd", 
  Exp_n = "restoration_n", Exp_cor = 0.6   # Correlation within restoration sites
)

# Using different correlations for each study
result2 <- time_lnRR(
  data = data,
  t0_Ctrl_mean = "pre_control_mean", t0_Ctrl_sd = "pre_control_sd",
  t1_Ctrl_mean = "post_control_mean", t1_Ctrl_sd = "post_control_sd",
  Ctrl_n = "control_n", Ctrl_cor = c(0.6, 0.8),
  t0_Exp_mean = "pre_restoration_mean", t0_Exp_sd = "pre_restoration_sd",
  t1_Exp_mean = "post_restoration_mean", t1_Exp_sd = "post_restoration_sd", 
  Exp_n = "restoration_n", Exp_cor = c(0.5, 0.7)
)

Log of Variability Ratio: Interaction Between Treatment and Time

Description

\lnVR=ln(sdt1,Exp/sdt1,Ctrlsdt0,Exp/sdt0,Ctrl)\lnVR = \ln\left(\frac{sd_{t1,Exp} / sd_{t1,Ctrl}}{sd_{t0,Exp} / sd_{t0,Ctrl}}\right)

Usage

time_lnVR(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  t0_Ctrl_sd,
  t1_Ctrl_sd,
  Ctrl_n,
  Ctrl_cor,
  t0_Exp_sd,
  t1_Exp_sd,
  Exp_n,
  Exp_cor
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

t0_Ctrl_sd

Standard deviation from the control group at time 0

t1_Ctrl_sd

Standard deviation from the control group at time 1

Ctrl_n

Sample size of the control group

Ctrl_cor

Number or numeric vector. Correlation between the means of the control group at t0 and t1

t0_Exp_sd

Standard deviation from the experimental group at time 0

t1_Exp_sd

Standard deviation from the experimental group at time 1

Exp_n

Sample size of the experimental group

Exp_cor

Number or numeric vector. Correlation between the means of the experimental group at t0 and t1

Details

var(lnVR)=(1rExp2)nExp1+(1rCtrl2)nCtrl1var(\ln VR) = \frac{(1 - r_{Exp}^2)}{n_{Exp} - 1} + \frac{(1 - r_{Ctrl}^2)}{n_{Ctrl} - 1}

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

References

Shinichi Nakagawa and Daniel Noble, personal communication.

Examples

data <- data.frame(
  study_id = 1:2,
  pre_control_sd = c(2.1, 2.4),
  post_control_sd = c(2.2, 2.5),
  control_n = c(24, 19),
  pre_invaded_sd = c(2.0, 2.3),
  post_invaded_sd = c(4.1, 4.6),
  invaded_n = c(21, 22)
)

result <- time_lnVR(
  data = data,
  t0_Ctrl_sd = "pre_control_sd", t1_Ctrl_sd = "post_control_sd",
  Ctrl_n = "control_n", Ctrl_cor = 0.6,
  t0_Exp_sd = "pre_invaded_sd", t1_Exp_sd = "post_invaded_sd",
  Exp_n = "invaded_n", Exp_cor = 0.4
)

Standardized Mean Difference: Interaction Between Treatment and Time

Description

d=(Xˉt1,ExpXˉt1,Ctrl)(Xˉt0,ExpXˉt0,Ctrl)SpooledJd = \frac{(\bar{X}_{t1,Exp} - \bar{X}_{t1,Ctrl}) - (\bar{X}_{t0,Exp} - \bar{X}_{t0,Ctrl})}{S_{pooled}} \cdot J

Usage

time_SMD(
  data,
  col_names = c("yi", "vi"),
  append = TRUE,
  hedges_correction = TRUE,
  t0_Ctrl_mean,
  t0_Ctrl_sd,
  t1_Ctrl_mean,
  t1_Ctrl_sd,
  Ctrl_n,
  Ctrl_cor,
  t0_Exp_mean,
  t0_Exp_sd,
  t1_Exp_mean,
  t1_Exp_sd,
  Exp_n,
  Exp_cor
)

Arguments

data

Data frame containing the variables used.

col_names

Vector of two strings to name the output columns for the effect size and its sampling variance. Default is 'yi' and 'vi'.

append

Logical. Append the results to data. Default is TRUE

hedges_correction

Logical. Apply or not Hedges' correction for small-sample bias. Default is TRUE.

t0_Ctrl_mean

Sample mean from the control group at time 0

t0_Ctrl_sd

Standard deviation from the control group at time 0

t1_Ctrl_mean

Sample mean from the control group at time 1

t1_Ctrl_sd

Standard deviation from the control group at time 1

Ctrl_n

Sample size of the control group

Ctrl_cor

Number or numeric vector. Correlation between the means of the control group at t0 and t1

t0_Exp_mean

Sample mean from the experimental group at time 0

t0_Exp_sd

Standard deviation from the experimental group at time 0

t1_Exp_mean

Sample mean from the experimental group at time 1

t1_Exp_sd

Standard deviation from the experimental group at time 1

Exp_n

Sample size of the experimental group

Exp_cor

Number or numeric vector. Correlation between the means of the experimental group at t0 and t1

Details

Pooled standard deviation:

Spooled=((nExp1)(sdt0,Exp2+sdt1,Exp2)+(nCtrl1)(sdt0,Ctrl2+sdt1,Ctrl2))2(nExp+nCtrl2)S_{pooled} = \sqrt{\frac{((n_{Exp} - 1)(sd_{t0,Exp}^2 + sd_{t1,Exp}^2) + (n_{Ctrl} - 1)(sd_{t0,Ctrl}^2 + sd_{t1,Ctrl}^2))}{2(n_{Exp} + n_{Ctrl} - 2)}}

Sampling variance:

var(d)=2(1rExp)nExp+2(1rCtrl)nCtrl+d22(nExp+nCtrl)var(d) = \frac{2(1 - r_{Exp})}{n_{Exp}} + \frac{2(1 - r_{Ctrl})}{n_{Ctrl}} + \frac{d^2}{2(n_{Exp} + n_{Ctrl})}

where rExpr_{Exp} and rCtrlr_{Ctrl} are the correlations between time points within each group.

Value

A data frame containing the effect sizes and their sampling variance. By default, the columns are named yi (effect size) and vi (sampling variance). If append = TRUE, the results are appended to the input data; otherwise, only the computed effect size columns are returned.

Author(s)

Facundo Decunta - [email protected]

References

Shinichi Nakagawa and Daniel Noble, personal communication.

Examples

# Pre-post design for standardized mean difference with time interaction (Conservation experiment)
data <- data.frame(
  study_id = 1:2,
  pre_control_mean = c(18.3, 21.7), pre_control_sd = c(4.1, 4.8),
  post_control_mean = c(18.8, 22.1), post_control_sd = c(4.2, 4.9),
  control_n = c(16, 14),
  pre_conservation_mean = c(18.1, 21.4), pre_conservation_sd = c(4.0, 4.7),
  post_conservation_mean = c(26.7, 31.2), post_conservation_sd = c(5.8, 6.4),
  conservation_n = c(15, 16)
)

result <- time_SMD(
  data = data,
  t0_Ctrl_mean = "pre_control_mean", t0_Ctrl_sd = "pre_control_sd",
  t1_Ctrl_mean = "post_control_mean", t1_Ctrl_sd = "post_control_sd",
  Ctrl_n = "control_n", Ctrl_cor = 0.9,
  t0_Exp_mean = "pre_conservation_mean", t0_Exp_sd = "pre_conservation_sd",
  t1_Exp_mean = "post_conservation_mean", t1_Exp_sd = "post_conservation_sd",
  Exp_n = "conservation_n", Exp_cor = 0.7,
  hedges_correction = TRUE
)

# Without Hedges' correction
result_no_hedges <- time_SMD(
  data = data,
  t0_Ctrl_mean = "pre_control_mean", t0_Ctrl_sd = "pre_control_sd",
  t1_Ctrl_mean = "post_control_mean", t1_Ctrl_sd = "post_control_sd",
  Ctrl_n = "control_n", Ctrl_cor = 0.9,
  t0_Exp_mean = "pre_conservation_mean", t0_Exp_sd = "pre_conservation_sd",
  t1_Exp_mean = "post_conservation_mean", t1_Exp_sd = "post_conservation_sd",
  Exp_n = "conservation_n", Exp_cor = 0.7,
  hedges_correction = FALSE
)