Title: | Multivariate Profile Analysis |
---|---|
Description: | R functions for criterion profile analysis, Davison and Davenport (2002) <doi:10.1037/1082-989X.7.4.468> and meta-analytic criterion profile analysis, Wiernik, Wilmot, Davison, and Ones (2020) <doi:10.1037/met0000305>. Sensitivity analyses to aid in interpreting criterion profile analysis results are also included. |
Authors: | Brenton M. Wiernik [aut, cre] |
Maintainer: | Brenton M. Wiernik <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.5 |
Built: | 2024-11-13 04:12:45 UTC |
Source: | https://github.com/bwiernik/configural |
Overview of the configural package.
The configural package provides tools for conducting configural and profile analyses. It currently supports criterion profile analysis (Davison & Davenport, 2002) and meta-analytic criterion profile analysis (Wiernik et al., 2019). Functions are provided to calculate criterion patterns and CPA variance decomposition, as well as for computing confidence intervals, shrinkage corrections, and fungible patterns.
Maintainer: Brenton M. Wiernik [email protected]
Useful links:
Report bugs at https://github.com/bwiernik/configural/issues
Calculate the quadratic form
A %&% x
A %&% x
A |
A square matrix |
x |
A vector or matrix |
The quadratic product
diag(5) %&% 1:5
diag(5) %&% 1:5
Estimate shrinkage for regression models
adjust_Rsq(Rsq, n, p, adjust = c("fisher", "pop", "cv"))
adjust_Rsq(Rsq, n, p, adjust = c("fisher", "pop", "cv"))
Rsq |
Observed model R-squared |
n |
Sample size |
p |
Number of predictors |
adjust |
Which adjustment to apply. Options are "fisher" for the Adjusted R-squared method used in |
An adjusted R-squared value.
Shieh, G. (2008). Improved shrinkage estimation of squared multiple correlation coefficient and squared cross-validity coefficient. Organizational Research Methods, 11(2), 387–407. doi:10.1177/1094428106292901
adjust_Rsq(.55, 100, 6, adjust = "pop")
adjust_Rsq(.55, 100, 6, adjust = "pop")
Makes a matrix symmetric by averaging the elements of the matrix and its
transpose. When This function fills in NA
elements of a matrix with the corresponding
value from the matrix transpose, if available
complete_matrix(m, na.rm = TRUE)
complete_matrix(m, na.rm = TRUE)
m |
Numeric matrix to complete. |
na.rm |
Logical. Should missing values be dropped? (default: |
A completed matrix.
predictors <- c('auto', 'skill_var', 'task_var', 'task_sig', 'task_id', 'fb_job', 'job_comp', 'interdep', 'fb_others', 'soc_support') m <- jobchar$sevar_r[c('perform', predictors), c('perform', predictors)] complete_matrix(m)
predictors <- c('auto', 'skill_var', 'task_var', 'task_sig', 'task_id', 'fb_job', 'job_comp', 'interdep', 'fb_others', 'soc_support') m <- jobchar$sevar_r[c('perform', predictors), c('perform', predictors)] complete_matrix(m)
Calculate the asymptotic sampling covariance matrix for the unique elements of a correlation matrix
cor_covariance(r, n)
cor_covariance(r, n)
r |
A correlation matrix |
n |
The sample size |
The asymptotic sampling covariance matrix
Based on an internal function from the fungible package by Niels Waller
Nel, D. G. (1985). A matrix derivation of the asymptotic covariance matrix of sample correlation coefficients. Linear Algebra and Its Applications, 67, 137–145. doi:10.1016/0024-3795(85)90191-0
cor_covariance(matrix(c(1, .2, .3, .2, 1, .3, .3, .3, 1), ncol = 3), 100)
cor_covariance(matrix(c(1, .2, .3, .2, 1, .3, .3, .3, 1), ncol = 3), 100)
Estimate the asymptotic sampling covariance matrix for the unique elements of a meta-analytic correlation matrix
cor_covariance_meta( r, n, sevar, source = NULL, rho = NULL, sevar_rho = NULL, n_overlap = NULL )
cor_covariance_meta( r, n, sevar, source = NULL, rho = NULL, sevar_rho = NULL, n_overlap = NULL )
r |
A meta-analytic matrix of observed correlations (can be full or lower-triangular). |
n |
A matrix of total sample sizes for the meta-analytic correlations in |
sevar |
A matrix of estimated sampling error variances for the meta-analytic correlations in |
source |
A matrix indicating the sources of the meta-analytic correlations in |
rho |
A meta-analytic matrix of corrected correlations (can be full or lower-triangular). |
sevar_rho |
A matrix of estimated sampling error variances for the meta-analytic corrected correlations in |
n_overlap |
A matrix indicating the overlapping sample size for the unique (lower triangular) values in |
If both source
and n_overlap
are NULL
, it is assumed that all meta-analytic correlations come from the the same source.
The estimated asymptotic sampling covariance matrix
Nel, D. G. (1985). A matrix derivation of the asymptotic covariance matrix of sample correlation coefficients. Linear Algebra and Its Applications, 67, 137–145. doi:10.1016/0024-3795(85)90191-0
Wiernik, B. M. (2018). Accounting for dependency in meta-analytic structural equations modeling: A flexible alternative to generalized least squares and two-stage structural equations modeling. Unpublished manuscript.
cor_covariance_meta(r = mindfulness$r, n = mindfulness$n, sevar = mindfulness$sevar_r, source = mindfulness$source)
cor_covariance_meta(r = mindfulness$r, n = mindfulness$n, sevar = mindfulness$sevar_r, source = mindfulness$source)
This function returns a vector of labels for the unique correlations between pairs of variables from a supplied vector of variable names
cor_labels(var_names)
cor_labels(var_names)
var_names |
A character vector of variable names |
A vector of correlation labels
cor_labels(colnames(mindfulness$r))
cor_labels(colnames(mindfulness$r))
Conduct criterion profile analysis using a correlation matrix
cpa_mat( formula, cov_mat, n = NULL, se_var_mat = NULL, se_beta_method = c("normal", "lm"), adjust = c("fisher", "pop", "cv"), conf_level = 0.95, ... )
cpa_mat( formula, cov_mat, n = NULL, se_var_mat = NULL, se_beta_method = c("normal", "lm"), adjust = c("fisher", "pop", "cv"), conf_level = 0.95, ... )
formula |
Regression formula with a single outcome variable on the left-hand side and one or more predictor variables on the right-hand side (e.g., Y ~ X1 + X2). |
cov_mat |
Correlation matrix containing the variables to be used in the regression. |
n |
Sample size. Used to compute adjusted R-squared and, if |
se_var_mat |
Optional. The sampling error covariance matrix among the unique elements of |
se_beta_method |
Method to use to estimate the standard errors of standardized regression (beta) coefficients. Current options include "normal" (use the Jones-Waller, 2015, normal-theory approach) and "lm" (estimate standard errors using conventional regression formulas). |
adjust |
Method to adjust R-squared for overfitting. See |
conf_level |
Confidence level to use for confidence intervals. |
... |
Additional arguments. |
An object of class "cpa" containing the criterion pattern vector and CPA variance decomposition
Jones, J. A., & Waller, N. G. (2015). The normal-theory and asymptotic distribution-free (ADF) covariance matrix of standardized regression coefficients: Theoretical extensions and finite sample behavior. Psychometrika, 80(2), 365–378. doi:10.1007/s11336-013-9380-y
Revelle, W., Condon, D. M., Wilt, J., French, J. A., Brown, A., & Elleman, L. G. (2017). Web- and phone-based data collection using planned missing designs. In N. G. Fielding, R. M. Lee, & G. Blank, The SAGE Handbook of Online Research Methods (pp. 578–594). SAGE Publications. doi:10.4135/9781473957992.n33
Wiernik, B. M., Wilmot, M. P., Davison, M. L., & Ones, D. S. (2019). Meta-analytic criterion profile analysis. Psychological Methods doi:10.1037/met0000305
sevar <- cor_covariance_meta(mindfulness$r, mindfulness$n, mindfulness$sevar_r, mindfulness$source) cpa_mat(mindfulness ~ ES + A + C + Ex + O, cov_mat = mindfulness$r, n = NULL, se_var_mat = sevar, adjust = "pop")
sevar <- cor_covariance_meta(mindfulness$r, mindfulness$n, mindfulness$sevar_r, mindfulness$source) cpa_mat(mindfulness ~ ES + A + C + Ex + O, cov_mat = mindfulness$r, n = NULL, se_var_mat = sevar, adjust = "pop")
Compute CPA level and pattern scores for a set of data
cpa_scores( cpa_mod, newdata = NULL, augment = TRUE, cpa_names = c("cpa_lev", "cpa_pat"), scale = FALSE, scale_center = TRUE, scale_scale = TRUE )
cpa_scores( cpa_mod, newdata = NULL, augment = TRUE, cpa_names = c("cpa_lev", "cpa_pat"), scale = FALSE, scale_center = TRUE, scale_scale = TRUE )
cpa_mod |
A model returned from |
newdata |
A data frame or matrix containing columns with the same names as
the predictors in |
augment |
Should be CPA score columns be added to |
cpa_names |
Character vector of length 2 giving the variable names to assign to the CPA score columns. |
scale |
Logical. Should the variables in |
scale_center |
If |
scale_scale |
If |
A data frame containing the CPA score variables.
sevar <- cor_covariance_meta(mindfulness$r, mindfulness$n, mindfulness$sevar_r, mindfulness$source) cpa_mod <- cpa_mat(mindfulness ~ ES + A + C + Ex + O, cov_mat = mindfulness$r, n = NULL, se_var_mat = sevar, adjust = "pop") newdata <- data.frame(ES = c(4.2, 3.2, 3.4, 4.2, 3.8, 4.0, 5.6, 2.8, 3.4, 2.8), A = c(4.0, 4.2, 3.8, 4.6, 4.0, 4.6, 4.6, 2.6, 3.6, 5.4), C = c(2.8, 4.0, 4.0, 3.0, 4.4, 5.6, 4.4, 3.4, 4.0, 5.6), Ex = c(3.8, 5.0, 4.2, 3.6, 4.8, 5.6, 4.2, 2.4, 3.4, 4.8), O = c(3.0, 4.0, 4.8, 3.2, 3.6, 5.0, 5.4, 4.2, 5.0, 5.2) ) newdata_cpa <- cpa_scores(cpa_mod, newdata, augment = FALSE) newdata_augment <- cpa_scores(cpa_mod, newdata, augment = TRUE)
sevar <- cor_covariance_meta(mindfulness$r, mindfulness$n, mindfulness$sevar_r, mindfulness$source) cpa_mod <- cpa_mat(mindfulness ~ ES + A + C + Ex + O, cov_mat = mindfulness$r, n = NULL, se_var_mat = sevar, adjust = "pop") newdata <- data.frame(ES = c(4.2, 3.2, 3.4, 4.2, 3.8, 4.0, 5.6, 2.8, 3.4, 2.8), A = c(4.0, 4.2, 3.8, 4.6, 4.0, 4.6, 4.6, 2.6, 3.6, 5.4), C = c(2.8, 4.0, 4.0, 3.0, 4.4, 5.6, 4.4, 3.4, 4.0, 5.6), Ex = c(3.8, 5.0, 4.2, 3.6, 4.8, 5.6, 4.2, 2.4, 3.4, 4.8), O = c(3.0, 4.0, 4.8, 3.2, 3.6, 5.0, 5.4, 4.2, 5.0, 5.2) ) newdata_cpa <- cpa_scores(cpa_mod, newdata, augment = FALSE) newdata_augment <- cpa_scores(cpa_mod, newdata, augment = TRUE)
Big Five intercorrelations from Davies et al. (2015). Big Five–psychological disorder correlations from Kotov et al. (2010). Note that there were several duplicate or missing values in the reported data table in the published article. These results are based on corrected data values.
data(disorders)
data(disorders)
list with entries r
(mean observed correlations), rho
(mean
corrected correlations), n
(sample sizes), sevar_r
(sampling error
variances for mean observed correlations), sevar_rho
(sampling error
variances for mean corrected correlations), and source
(character labels
indicating which meta-analytic correlations came from the same source)
Davies, S. E., Connelly, B. L., Ones, D. S., & Birkland, A. S. (2015). The general factor of personality: The “Big One,” a self-evaluative trait, or a methodological gnat that won’t go away? Personality and Individual Differences, 81, 13–22. doi:10.1016/j.paid.2015.01.006
Kotov, R., Gamez, W., Schmidt, F., & Watson, D. (2010). Linking “big” personality traits to anxiety, depressive, and substance use disorders: A meta-analysis. Psychological Bulletin, 136(5), 768–821. doi:10.1037/a0020327
data(disorders)
data(disorders)
Generates fungible regression weights (Waller, 2008) and related results using the method by Waller and Jones (2010).
fungible( object, theta = 0.005, Nstarts = 1000, MaxMin = c("min", "max"), silent = FALSE, ... )
fungible( object, theta = 0.005, Nstarts = 1000, MaxMin = c("min", "max"), silent = FALSE, ... )
object |
A fitted model object. Currently supported classes are: "cpa" |
theta |
A vector of values to decrement from R-squared to compute families of fungible coefficients. |
Nstarts |
Maximum number of (max) minimizations from random starting configurations. |
MaxMin |
Should the cosine between the observed and alternative weights be maximized ("max") to find the maximally similar coefficients or minimized ("min") to find the maximally dissimilar coefficients? |
silent |
Should current optimization values be printed to the console ( |
... |
Additional arguments |
A list containing the alternative weights and other fungible weights estimation parameters
Niels Waller, Jeff Jones, Brenton M. Wiernik. Adapted from fungible::fungibleExtrema()
.
Waller, N. G. (2008). Fungible weights in multiple regression. Psychometrika, 73(4), 691–703. doi:10.1007/s11336-008-9066-z
Waller, N. G., & Jones, J. A. (2009). Locating the extrema of fungible regression weights. Psychometrika, 74(4), 589–602. doi:10.1007/s11336-008-9087-7
mind <- cpa_mat(mindfulness ~ ES + A + C + Ex + O, cov_mat = mindfulness$r, n = harmonic_mean(vechs(mindfulness$n)), se_var_mat = cor_covariance_meta(mindfulness$r, mindfulness$n, mindfulness$sevar_r, mindfulness$source), adjust = "pop") mind_fung <- fungible(mind, Nstarts = 100)
mind <- cpa_mat(mindfulness ~ ES + A + C + Ex + O, cov_mat = mindfulness$r, n = harmonic_mean(vechs(mindfulness$n)), se_var_mat = cor_covariance_meta(mindfulness$r, mindfulness$n, mindfulness$sevar_r, mindfulness$source), adjust = "pop") mind_fung <- fungible(mind, Nstarts = 100)
Identify maximally similar or dissimilar criterion patterns in criterion profile analysis
## S3 method for class 'cpa' fungible( object, theta = 0.005, Nstarts = 1000, MaxMin = c("min", "max"), silent = FALSE, ... )
## S3 method for class 'cpa' fungible( object, theta = 0.005, Nstarts = 1000, MaxMin = c("min", "max"), silent = FALSE, ... )
object |
A fitted model object of class "cpa". |
theta |
A vector of values to decrement from R-squared to compute families of fungible coefficients. |
Nstarts |
Maximum number of (max) minimizations from random starting configurations. |
MaxMin |
Should the cosine between the observed and alternative weights be maximized ("max") to find the maximally similar coefficients or minimized ("min") to find the maximally dissimilar coefficients? |
silent |
Should current optimization values be printed to the console ( |
... |
Additional arguments |
A list containing the alternative weights and other fungible weights estimation parameters
Wiernik, B. M., Wilmot, M. P., Davison, M. L., & Ones, D. S. (2020). Meta-analytic criterion profile analysis. Psychological Methods. doi:10.1037/met0000305
mind <- cpa_mat(mindfulness ~ ES + A + C + Ex + O, cov_mat = mindfulness$r, n = harmonic_mean(vechs(mindfulness$n)), se_var_mat = cor_covariance_meta(mindfulness$r, mindfulness$n, mindfulness$sevar_r, mindfulness$source), adjust = "pop") mind_fung <- fungible(mind, Nstarts = 100)
mind <- cpa_mat(mindfulness ~ ES + A + C + Ex + O, cov_mat = mindfulness$r, n = harmonic_mean(vechs(mindfulness$n)), se_var_mat = cor_covariance_meta(mindfulness$r, mindfulness$n, mindfulness$sevar_r, mindfulness$source), adjust = "pop") mind_fung <- fungible(mind, Nstarts = 100)
Identify maximally similar or dissimilar sets of fungible standardized regression coefficients from an OLS regression model
## S3 method for class 'lm' fungible( object, theta = 0.005, Nstarts = 1000, MaxMin = c("min", "max"), silent = FALSE, ... )
## S3 method for class 'lm' fungible( object, theta = 0.005, Nstarts = 1000, MaxMin = c("min", "max"), silent = FALSE, ... )
object |
A fitted model object of class "lm" or "summary.lm". |
theta |
A vector of values to decrement from R-squared to compute families of fungible coefficients. |
Nstarts |
Maximum number of (max) minimizations from random starting configurations. |
MaxMin |
Should the cosine between the observed and alternative weights be maximized ("max") to find the maximally similar coefficients or minimized ("min") to find the maximally dissimilar coefficients? |
silent |
Should current optimization values be printed to the console ( |
... |
Additional arguments |
A list containing the alternative weights and other fungible weights estimation parameters
Waller, N. G., & Jones, J. A. (2009). Locating the extrema of fungible regression weights. Psychometrika, 74(4), 589–602. doi:10.1007/s11336-008-9087-7
lm_mtcars <- lm(mpg ~ cyl + disp + hp + drat + wt + qsec + vs + am + gear + carb, data = mtcars) lm_mtcars_fung <- fungible(lm_mtcars, Nstarts = 100)
lm_mtcars <- lm(mpg ~ cyl + disp + hp + drat + wt + qsec + vs + am + gear + carb, data = mtcars) lm_mtcars_fung <- fungible(lm_mtcars, Nstarts = 100)
Correlations between GRE subtests and graduate student GPA from Kuncel et al. (2001).
data(gre)
data(gre)
list with entries r
(mean observed correlations), rho
(mean
corrected correlations), n
(sample sizes), sevar_r
(sampling error
variances for mean observed correlations), sevar_rho
(sampling error
variances for mean corrected correlations), and source
(character labels
indicating which meta-analytic correlations came from the same source)
GRE–GPA correlations in rho
are corrected for direct range restriction on
the GRE and unreliability in GPA. Subtest intercorrelations in rho
are
observed correlations computed among applicant norm samples. These values are
also used in r
. Due to compensatory selection on GRE scores, these values
will not accurately reflect subtest intercorrelations in selected-student
(range-restricted) samples. sevar_rho
andsevar_r
for GRE subtest
intercorrelations are computed with an assumed
SDρ = .02.
Kuncel, N. R., Hezlett, S. A., & Ones, D. S. (2001). A comprehensive meta-analysis of the predictive validity of the graduate record examinations: Implications for graduate student selection and performance. Psychological Bulletin, 127(1), 162–181. doi:10.1037/0033-2909.127.1.162
data(gre)
data(gre)
The harmonic mean is merely the reciprocal of the arithmetic mean of the reciprocals.
harmonic_mean(x, na.rm = TRUE, zero = TRUE)
harmonic_mean(x, na.rm = TRUE, zero = TRUE)
x |
A vector, matrix, or data.frame |
na.rm |
Logical. If |
zero |
Logical, If |
The harmonic mean of x
Adapted from psych::harmonic.mean()
by William Revelle
harmonic_mean(1:10)
harmonic_mean(1:10)
Human resource management practice–organizational financial performance correlations from Combs et al. (2006). Intercorrelations among HRM practices from Guest et al. (2004).
data(hrm)
data(hrm)
list with entries r
(mean observed correlations), rho
(mean
corrected correlations), n
(sample sizes), sevar_r
(sampling error
variances for mean observed correlations), sevar_rho
(sampling error
variances for mean corrected correlations), and source
(character labels
indicating which meta-analytic correlations came from the same source)
Combs, J., Liu, Y., Hall, A., & Ketchen, D. (2006). How much do high-performance work practices matter? A meta-analysis of their effects on organizational performance. Personnel Psychology, 59(3), 501–528. doi:10.1111/j.1744-6570.2006.00045.x
Guest, D., Conway, N., & Dewe, P. (2004). Using sequential tree analysis to search for ‘bundles’ of HR practices. Human Resource Management Journal, 14(1), 79–96. doi:10.1111/j.1748-8583.2004.tb00113.x
data(hrm)
data(hrm)
Self-rated job characteristics intercorrelations and correlations with other-rated job performance and self-rated job satisfaction from Humphrey et al. (2007).
data(jobchar)
data(jobchar)
list with entries r
(mean observed correlations), rho
(mean
corrected correlations), n
(sample sizes), sevar_r
(sampling error
variances for mean observed correlations), sevar_rho
(sampling error
variances for mean corrected correlations), and source
(character labels
indicating which meta-analytic correlations came from the same source)
Humphrey, S. E., Nahrgang, J. D., & Morgeson, F. P. (2007). Integrating motivational, social, and contextual work design features: A meta-analytic summary and theoretical extension of the work design literature. Journal of Applied Psychology, 92(5), 1332–1356. doi:10.1037/0021-9010.92.5.1332
data(jobchar) predictors <- c('auto', 'skill_var', 'task_var', 'task_sig', 'task_id', 'fb_job', 'job_comp', 'interdep', 'fb_others', 'soc_support') sevar_jobchar_perf <- cor_covariance_meta( r = jobchar$r[c('perform', predictors), c('perform', predictors)], n = jobchar$n[c('perform', predictors), c('perform', predictors)], sevar = jobchar$sevar_r[c('perform', predictors), c('perform', predictors)], rho = jobchar$rho[c('perform', predictors), c('perform', predictors)], sevar_rho = jobchar$sevar_rho[c('perform', predictors), c('perform', predictors)], source = jobchar$source[c('perform', predictors), c('perform', predictors)]) cpa_jobchar_perf <- cpa_mat(perform ~ auto + skill_var + task_var + task_sig + task_id + fb_job + job_comp + interdep + fb_others + soc_support, cov_mat = jobchar$rho, n = harmonic_mean(as.vector(jobchar$n[c('perform', predictors), c('perform', predictors)])), se_var_mat = sevar_jobchar_perf, adjust = "pop", conf_level = .95)
data(jobchar) predictors <- c('auto', 'skill_var', 'task_var', 'task_sig', 'task_id', 'fb_job', 'job_comp', 'interdep', 'fb_others', 'soc_support') sevar_jobchar_perf <- cor_covariance_meta( r = jobchar$r[c('perform', predictors), c('perform', predictors)], n = jobchar$n[c('perform', predictors), c('perform', predictors)], sevar = jobchar$sevar_r[c('perform', predictors), c('perform', predictors)], rho = jobchar$rho[c('perform', predictors), c('perform', predictors)], sevar_rho = jobchar$sevar_rho[c('perform', predictors), c('perform', predictors)], source = jobchar$source[c('perform', predictors), c('perform', predictors)]) cpa_jobchar_perf <- cpa_mat(perform ~ auto + skill_var + task_var + task_sig + task_id + fb_job + job_comp + interdep + fb_others + soc_support, cov_mat = jobchar$rho, n = harmonic_mean(as.vector(jobchar$n[c('perform', predictors), c('perform', predictors)])), se_var_mat = sevar_jobchar_perf, adjust = "pop", conf_level = .95)
Big Five intercorrelations from Davies et al. (2015). Big Five–Mindfulness correlations from Hanley and Garland (2017). Coefficient alpha for mindfulness measures taken from Giluk (2009).
data(mindfulness)
data(mindfulness)
list with entries r
(mean observed correlations), rho
(mean
corrected correlations), n
(sample sizes), sevar_r
(sampling error
variances for mean observed correlations), sevar_rho
(sampling error
variances for mean corrected correlations), and source
(character labels
indicating which meta-analytic correlations came from the same source)
Davies, S. E., Connelly, B. L., Ones, D. S., & Birkland, A. S. (2015). The general factor of personality: The “Big One,” a self-evaluative trait, or a methodological gnat that won’t go away? Personality and Individual Differences, 81, 13–22. doi:10.1016/j.paid.2015.01.006
Giluk, T. L. (2009). Mindfulness, Big Five personality, and affect: A meta-analysis. Personality and Individual Differences, 47(8), 805–811. doi:10.1016/j.paid.2009.06.026
Hanley, A. W., & Garland, E. L. (2017). The mindful personality: A meta-analysis from a cybernetic perspective. Mindfulness, 8(6), 1456–1470. doi:10.1007/s12671-017-0736-8
data(mindfulness)
data(mindfulness)
Estimate an effective sample size for a statistic given the observed statistic and the estimated sampling error variance (cf. Revelle et al., 2017).
n_effective_R2(R2, var_R2, p)
n_effective_R2(R2, var_R2, p)
R2 |
Observed R^2^ value |
var_R2 |
Estimated sampling error variance for R^2^ |
p |
Number of predictors in the regression model |
n_effective_R2
estimates the effective sample size for the R^2^ value from
an OLS regression model, using the sampling error variance formula from Cohen
et al. (2003).
An effective sample size.
Revelle, W., Condon, D. M., Wilt, J., French, J. A., Brown, A., & Elleman, L. G. (2017). Web- and phone-based data collection using planned missing designs. In N. G. Fielding, R. M. Lee, & G. Blank, The SAGE Handbook of Online Research Methods (pp. 578–594). SAGE Publications. doi:10.4135/9781473957992.n33
Cohen, J., Cohen, P., West, S. G., & Aiken, L. S. (2003). Applied multiple regression/correlation analysis for the behavioral sciences (3rd ed.). Routledge. doi:10.4324/9780203774441
n_effective_R2(0.3953882, 0.0005397923, 5)
n_effective_R2(0.3953882, 0.0005397923, 5)
Correlations among study design moderators and study design moderator–observed prejudice reduction effect sizes from Pettigrew and Tropp (2008). Note that correlations with effect size have been reverse-coded so that a positive correlation indicates that a higher level of the moderator is associated with larger prejudice reduction.
data(prejudice)
data(prejudice)
list with entries r
(observed correlations among moderators) and
k
(number of samples in meta-analysis)
Pettigrew, T. F., & Tropp, L. R. (2006). A meta-analytic test of intergroup contact theory. Journal of Personality and Social Psychology, 90(5), 751–783. doi:10.1037/0022-3514.90.5.751
data(prejudice)
data(prejudice)
Team process intercorrelations and team process–team performance/affect correlations from LePine et al. (2008).
data(team)
data(team)
list with entries r
(mean observed correlations), rho
(mean
corrected correlations), n
(sample sizes), sevar_r
(sampling error
variances for mean observed correlations), sevar_rho
(sampling error
variances for mean corrected correlations), and source
(character labels
indicating which meta-analytic correlations came from the same source)
Note that LePine et al. (2008) did not report confidence intervals, sampling error variances, or heterogeneity estimates for correlations among team processes; included sampling error variances in this list are based on total sample size only and do not include uncertainty stemming from any effect size heterogeneity.
LePine, J. A., Piccolo, R. F., Jackson, C. L., Mathieu, J. E., & Saul, J. R. (2008). A meta-analysis of teamwork processes: tests of a multidimensional model and relationships with team effectiveness criteria. Personnel Psychology, 61(2), 273–307. doi:10.1111/j.1744-6570.2008.00114.x
data(team)
data(team)
Estimate the sampling error variance for criterion profile analysis parameters
var_error_cpa( Rxx, rxy, n = NULL, se_var_mat = NULL, adjust = c("fisher", "pop", "cv") )
var_error_cpa( Rxx, rxy, n = NULL, se_var_mat = NULL, adjust = c("fisher", "pop", "cv") )
Rxx |
An intercorrelation matrix among the predictor variables |
rxy |
A vector of predictor–criterion correlations |
n |
The sample size. If NULL and |
se_var_mat |
A matrix of sampling covariance values for the elements of |
adjust |
Method to adjust R-squared for overfitting. See |
A list containing sampling covariance matrices or sampling error variance estimates for CPA parameters
var_error_cpa(mindfulness$rho[1:5, 1:5], mindfulness$rho[1:5, 6], n = 17060)
var_error_cpa(mindfulness$rho[1:5, 1:5], mindfulness$rho[1:5, 6], n = 17060)
cvec
returns the column-wise vectorization of an input matrix (stacking
the columns on one another). rvec
returns the row-wise vectorization of an
input matrix (concatenating the rows after each other). vech
returns the
column-wise half-vectorization of an input matrix (stacking the lower
triangular elements of the matrix, including the diagonal). vechs
returns
the strict column-wise half-vectorization of an input matrix (stacking the
lower triangular elements of the matrix, excluding the diagonal). All
functions return the output as a vector.
vech(x) vechs(x) cvec(x) rvec(x)
vech(x) vechs(x) cvec(x) rvec(x)
x |
A matrix |
A vector of values
Based on functions from the the OpenMx package
cvec(matrix(1:9, 3, 3)) rvec(matrix(1:9, 3, 3)) vech(matrix(1:9, 3, 3)) vechs(matrix(1:9, 3, 3)) vechs(matrix(1:12, 3, 4))
cvec(matrix(1:9, 3, 3)) rvec(matrix(1:9, 3, 3)) vech(matrix(1:9, 3, 3)) vechs(matrix(1:9, 3, 3)) vechs(matrix(1:12, 3, 4))
These functions return the symmetric matrix that produces the given half-vectorization result.
vech2full(x) vechs2full(x, diagonal = 1)
vech2full(x) vechs2full(x, diagonal = 1)
x |
A vector |
diagonal |
A value or vector of values to enter on the diagonal for |
The input consists of a vector of the elements in the lower triangle
of the resulting matrix (for vech2full
, including the elements along the diagonal
of the matrix, as a column vector), filled column-wise. For vechs2full
,
the diagonal values are filled as 1 by default, alternative values can be
specified using the diag
argument. The inverse half-vectorization takes a
vector and reconstructs a symmetric matrix such that vech2full(vech(x)) is
identical to x if x is symmetric.
A symmetric matrix
Based on functions from the the OpenMx package
vech2full(c(1, 2, 3, 5, 6, 9)) vechs2full(c(2, 3, 6), diagonal = 0)
vech2full(c(1, 2, 3, 5, 6, 9)) vechs2full(c(2, 3, 6), diagonal = 0)
Compute the weighted covariance among variables in a matrix or between the variables in two separate matrices/vectors.
wt_cov( x, y = NULL, wt = NULL, as_cor = FALSE, use = c("everything", "listwise", "pairwise"), unbiased = TRUE, df_type = c("count", "sum_wts") ) wt_cor(x, y = NULL, wt = NULL, use = "everything")
wt_cov( x, y = NULL, wt = NULL, as_cor = FALSE, use = c("everything", "listwise", "pairwise"), unbiased = TRUE, df_type = c("count", "sum_wts") ) wt_cor(x, y = NULL, wt = NULL, use = "everything")
x |
Vector or matrix of x variables. |
y |
Vector or matrix of y variables |
wt |
Vector of weights |
as_cor |
Logical scalar that determines whether the covariances should be standardized (TRUE) or unstandardized (FALSE). |
use |
Method for handling missing values. "everything" uses all values and does not account for missingness, "listwise" uses only complete cases, and "pairwise" uses pairwise deletion. |
unbiased |
Logical scalar determining whether variance should be unbiased (TRUE) or maximum-likelihood (FALSE). |
df_type |
Character scalar determining whether the degrees of freedom for unbiased estimates should be based on numbers of cases (n - 1; "count"; default) or squared sums of weights (1 - sum(w^2); "sum_wts"). |
Scalar, vector, or matrix of covariances.
Jeffrey A. Dahlke
wt_cov(x = c(1, 0, 2), y = c(1, 2, 3), wt = c(1, 2, 2), as_cor = FALSE, use = "everything") wt_cov(x = c(1, 0, 2), y = c(1, 2, 3), wt = c(1, 2, 2), as_cor = TRUE, use = "everything") wt_cov(x = cbind(c(1, 0, 2), c(1, 2, 3)), wt = c(1, 2, 2), as_cor = FALSE, use = "everything") wt_cov(x = cbind(c(1, 0, 2), c(1, 2, 3)), wt = c(1, 2, 2), as_cor = TRUE, use = "everything") wt_cov(x = cbind(c(1, 0, 2, NA), c(1, 2, 3, 3)), wt = c(1, 2, 2, 1), as_cor = FALSE, use = "listwise") wt_cov(x = cbind(c(1, 0, 2, NA), c(1, 2, 3, 3)), wt = c(1, 2, 2, 1), as_cor = TRUE, use = "listwise")
wt_cov(x = c(1, 0, 2), y = c(1, 2, 3), wt = c(1, 2, 2), as_cor = FALSE, use = "everything") wt_cov(x = c(1, 0, 2), y = c(1, 2, 3), wt = c(1, 2, 2), as_cor = TRUE, use = "everything") wt_cov(x = cbind(c(1, 0, 2), c(1, 2, 3)), wt = c(1, 2, 2), as_cor = FALSE, use = "everything") wt_cov(x = cbind(c(1, 0, 2), c(1, 2, 3)), wt = c(1, 2, 2), as_cor = TRUE, use = "everything") wt_cov(x = cbind(c(1, 0, 2, NA), c(1, 2, 3, 3)), wt = c(1, 2, 2, 1), as_cor = FALSE, use = "listwise") wt_cov(x = cbind(c(1, 0, 2, NA), c(1, 2, 3, 3)), wt = c(1, 2, 2, 1), as_cor = TRUE, use = "listwise")
Compute the weighted mean and variance of a vector of numeric values. If no weights are supplied, defaults to computing the unweighted mean and the unweighted maximum-likelihood variance.
wt_dist( x, wt = rep(1, length(x)), unbiased = TRUE, df_type = c("count", "sum_wts") ) wt_mean(x, wt = rep(1, length(x))) wt_var( x, wt = rep(1, length(x)), unbiased = TRUE, df_type = c("count", "sum_wts") )
wt_dist( x, wt = rep(1, length(x)), unbiased = TRUE, df_type = c("count", "sum_wts") ) wt_mean(x, wt = rep(1, length(x))) wt_var( x, wt = rep(1, length(x)), unbiased = TRUE, df_type = c("count", "sum_wts") )
x |
Vector of values to be analyzed. |
wt |
Weights associated with the values in x. |
unbiased |
Logical scalar determining whether variance should be unbiased (TRUE) or maximum-likelihood (FALSE). |
df_type |
Character scalar determining whether the degrees of freedom for unbiased estimates should be based on numbers of cases ("count"; default) or sums of weights ("sum_wts"). |
The weighted mean is computed as
where x is a numeric vector and w is a vector of weights.
The weighted variance is computed as
and the unbiased weighted variance is estimated by multiplying by
.
A weighted mean and variance if weights are supplied or an unweighted mean and variance if weights are not supplied.
Jeffrey A. Dahlke
wt_dist(x = c(.1, .3, .5), wt = c(100, 200, 300)) wt_mean(x = c(.1, .3, .5), wt = c(100, 200, 300)) wt_var(x = c(.1, .3, .5), wt = c(100, 200, 300))
wt_dist(x = c(.1, .3, .5), wt = c(100, 200, 300)) wt_mean(x = c(.1, .3, .5), wt = c(100, 200, 300)) wt_var(x = c(.1, .3, .5), wt = c(100, 200, 300))