compute_dmod_npar: Function for computing non-parametric \mjeqnd_Modd_Mod effect...

Description Usage Arguments Details Value Examples

View source: R/compute_dmod.R

Description

\loadmathjax

This function computes non-parametric \mjeqnd_Modd_Mod effect sizes from user-defined descriptive statistics and regression coefficients, using a distribution of observed scores as weights. This non-parametric function is best used when the assumption of normally distributed predictor scores is not reasonable and/or the distribution of scores observed in a sample is likely to represent the distribution of scores in the population of interest. If one has access to the full raw data set, the dMod function may be used as a wrapper to this function so that the regression equations and descriptive statistics can be computed automatically within the program.

Usage

1
2
3
4
5
6
7
8
compute_dmod_npar(
  referent_int,
  referent_slope,
  focal_int,
  focal_slope,
  focal_x,
  referent_sd_y
)

Arguments

referent_int

Referent group's intercept.

referent_slope

Referent group's slope.

focal_int

Focal group's intercept.

focal_slope

Focal group's slope.

focal_x

Focal group's vector of predictor scores.

referent_sd_y

Referent group's criterion standard deviation.

Details

The \mjeqnd_Mod_Signedd_Mod_Signed effect size (i.e., the average of differences in prediction over the range of predictor scores) is computed as \mjdeqnd_Mod_Signed=\frac\sum_i=1^mn_i\left[X_i\left(b_1_1-b_1_2\right)+b_0_1-b_0_2\right]SD_Y_1\sum_i=1^mn_i,d_Mod_Signed = sum(n_i * [X_i * (b_1_1 - b_1_2) + b_0_1 - b_0_2]) / (SD_Y_1 * sum(n_i)), where

The \mjeqnd_Mod_Underd_Mod_Under and \mjeqnd_Mod_Overd_Mod_Over effect sizes are computed using the same equation as \mjeqnd_Mod_Signedd_Mod_Signed, but \mjeqnd_Mod_Underd_Mod_Under is the weighted average of all scores in the area of underprediction (i.e., the differences in prediction with negative signs) and \mjeqnd_Mod_Overd_Mod_Over is the weighted average of all scores in the area of overprediction (i.e., the differences in prediction with negative signs).

The \mjeqnd_Mod_Unsignedd_Mod_Unsigned effect size (i.e., the average of absolute differences in prediction over the range of predictor scores) is computed as \mjdeqnd_Mod_Unsigned=\frac\sum_i=1^mn_i\left|X_i\left(b_1_1-b_1_2\right)+b_0_1-b_0_2\right|SD_Y_1\sum_i=1^mn_i.d_Mod_Unsigned = sum(n_i * |X_i * (b_1_1 - b_1_2) + b_0_1 - b_0_2]| / (SD_Y_1 * sum(n_i)).

The \mjeqnd_Mind_Min effect size (i.e., the smallest absolute difference in prediction observed over the range of predictor scores) is computed as \mjdeqnd_Min=\frac1SD_Y_1Min\left[\left|X\left(b_1_1-b_1_2\right)+b_0_1-b_0_2\right|\right].d_Min = 1/SD_Y_1 * Min[X * (b_1_1 - b_1_2) + b_0_1 - b_0_2].

The \mjeqnd_Maxd_Max effect size (i.e., the largest absolute difference in prediction observed over the range of predictor scores)is computed as \mjdeqnd_Max=\frac1SD_Y_1Max\left[\left|X\left(b_1_1-b_1_2\right)+b_0_1-b_0_2\right|\right].d_Max = 1/SD_Y_1 * Max[X * (b_1_1 - b_1_2) + b_0_1 - b_0_2]. Note: When \mjeqnd_Mind_Min and \mjeqnd_Maxd_Max are computed in this package, the output will display the signs of the differences (rather than the absolute values of the differences) to aid in interpretation.

Value

A vector of effect sizes (\mjeqnd_Mod_Signedd_Mod_Signed, \mjeqnd_Mod_Unsignedd_Mod_Unsigned, \mjeqnd_Mod_Underd_Mod_Under, \mjeqnd_Mod_Overd_Mod_Over), proportions of under- and over-predicted criterion scores, minimum and maximum differences (i.e., \mjeqnd_Mod_Underd_Mod_Under and \mjeqnd_Mod_Overd_Mod_Over), and the scores associated with minimum and maximum differences.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Generate some hypothetical data for a referent group and three focal groups:
set.seed(10)
refDat <- MASS::mvrnorm(n = 1000, mu = c(.5, .2),
                        Sigma = matrix(c(1, .5, .5, 1), 2, 2), empirical = TRUE)
foc1Dat <- MASS::mvrnorm(n = 1000, mu = c(-.5, -.2),
                         Sigma = matrix(c(1, .5, .5, 1), 2, 2), empirical = TRUE)
foc2Dat <- MASS::mvrnorm(n = 1000, mu = c(0, 0),
                         Sigma = matrix(c(1, .3, .3, 1), 2, 2), empirical = TRUE)
foc3Dat <- MASS::mvrnorm(n = 1000, mu = c(-.5, -.2),
                         Sigma = matrix(c(1, .3, .3, 1), 2, 2), empirical = TRUE)
colnames(refDat) <- colnames(foc1Dat) <- colnames(foc2Dat) <- colnames(foc3Dat) <- c("X", "Y")

# Compute a regression model for each group:
refRegMod <- lm(Y ~ X, data.frame(refDat))$coef
foc1RegMod <- lm(Y ~ X, data.frame(foc1Dat))$coef
foc2RegMod <- lm(Y ~ X, data.frame(foc2Dat))$coef
foc3RegMod <- lm(Y ~ X, data.frame(foc3Dat))$coef

# Use the subgroup regression models to compute d_mod for each referent-focal pairing:

# Focal group #1:
compute_dmod_npar(referent_int = refRegMod[1], referent_slope = refRegMod[2],
             focal_int = foc1RegMod[1], focal_slope = foc1RegMod[2],
             focal_x = foc1Dat[,"X"], referent_sd_y = 1)

# Focal group #2:
compute_dmod_npar(referent_int = refRegMod[1], referent_slope = refRegMod[2],
             focal_int = foc2RegMod[1], focal_slope = foc1RegMod[2],
             focal_x = foc2Dat[,"X"], referent_sd_y = 1)

# Focal group #3:
compute_dmod_npar(referent_int = refRegMod[1], referent_slope = refRegMod[2],
             focal_int = foc3RegMod[1], focal_slope = foc3RegMod[2],
             focal_x = foc3Dat[,"X"], referent_sd_y = 1)

psychmeta documentation built on June 1, 2021, 9:13 a.m.