| Title: | Meta Analysis and Research Synthesis |
|---|---|
| Description: | Includes functions for conducting univariate and multivariate meta-analysis. This includes the estimation of the asymptotic variance-covariance matrix of effect sizes. For more details see Becker (1992) <doi:10.2307/1165128>, Cooper, Hedges, and Valentine (2019) <doi:10.7758/9781610448864>, and Schmid, Stijnen, and White (2020) <doi:10.1201/9781315119403>. |
| Authors: | Brandon LeBeau [aut, cre]
|
| Maintainer: | Brandon LeBeau <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.2 |
| Built: | 2026-05-21 06:38:08 UTC |
| Source: | https://github.com/cran/mars |
This data ...
bcgbcg
A dataframe with 13 rows and 11 columns:
Trial ID
bcgbcg
This data contains data originally collected by Becker in 2009 on ...
becker09becker09
A dataframe with 10 rows and 9 columns:
Study ID
Study sample size
...
Correlation between Cognitive and Performance
Correlation between Somatic and Performance
Correlation between Self Confidence and Performance
Correlation between Somatic and Cognitive
Correlation between Self Confidence and Cognitive
Correlation between Self Confidence and Somatic
becker09becker09
c mat ft
c_mat_ft(model_input, R)c_mat_ft(model_input, R)
model_input |
Model input as a character string. Multiple models need to be on their own line. Model syntax uses lavann like syntax, see details for more details about this syntax. |
R |
A correlation matrix, most likely this will be the average correlation matrix outputted from the metafor package. |
A list.
Br <- matrix(c(1.00000000, -0.09773331, -0.1755029, 0.3186775, -0.09773331, 1.00000000, 0.5271873, -0.4175596, -0.17550292, 0.5271872, 1.0000000, -0.4006848, 0.31867753, -0.41755963, -0.4006848, 1.0000000), nrow = 4, byrow = TRUE) colnames(Br) <- c("Performance", "Self_confidence", "Cognitive", "Somatic" ) rownames(Br) <- colnames(Br) ## Proposed path model model <- "## Regression paths Performance ~ Self_confidence + Cognitive + Somatic Self_confidence ~ Cognitive + Somatic " c_mat_ft(model, Br)Br <- matrix(c(1.00000000, -0.09773331, -0.1755029, 0.3186775, -0.09773331, 1.00000000, 0.5271873, -0.4175596, -0.17550292, 0.5271872, 1.0000000, -0.4006848, 0.31867753, -0.41755963, -0.4006848, 1.0000000), nrow = 4, byrow = TRUE) colnames(Br) <- c("Performance", "Self_confidence", "Cognitive", "Somatic" ) rownames(Br) <- colnames(Br) ## Proposed path model model <- "## Regression paths Performance ~ Self_confidence + Cognitive + Somatic Self_confidence ~ Cognitive + Somatic " c_mat_ft(model, Br)
This function builds a list of correlation matrices from data that are in flat files where a correlation matrix is coded into a single row, a common format for coding correlation matrices.
df_to_corr(data, variables, ID = NULL)df_to_corr(data, variables, ID = NULL)
data |
Data frame input used to convert to correlation matrices. |
variables |
A character vector of variable names representing the columns to convert to a pairwise correlation matrix. Variable names take the following format: "columnname_rowname" where the name prior to the underscore is the column name and the name after the underscore is the row name. |
ID |
A variable name, as a character string, to use as names for the list elements. |
A list of correlation matrices.
becker09 <- read.csv(paste0(system.file('raw_data', package = 'mars'), '/Becker09.csv')) becker09_list <- df_to_corr(becker09, variables = c('Cognitive_Performance', 'Somatic_Performance', 'Selfconfidence_Performance', 'Somatic_Cognitive', 'Selfconfidence_Cognitive', 'Selfconfidence_Somatic'), ID = 'ID')becker09 <- read.csv(paste0(system.file('raw_data', package = 'mars'), '/Becker09.csv')) becker09_list <- df_to_corr(becker09, variables = c('Cognitive_Performance', 'Somatic_Performance', 'Selfconfidence_Performance', 'Somatic_Cognitive', 'Selfconfidence_Cognitive', 'Selfconfidence_Somatic'), ID = 'ID')
The primary estimation function for conducting the optimization. The function is typically called through the mars function, but can be called here directly.
estimation( formula = NULL, effect_name = NULL, studyID = NULL, effectID = NULL, variance = NULL, data, estimation_method = "REML", optim_method = "L-BFGS-B", structure = "UN", varcov_type, weights = NULL, intercept = FALSE, N = NULL, missing = "remove", robustID = NULL, multivariate_covs = NULL, tol = 1e-10, ... )estimation( formula = NULL, effect_name = NULL, studyID = NULL, effectID = NULL, variance = NULL, data, estimation_method = "REML", optim_method = "L-BFGS-B", structure = "UN", varcov_type, weights = NULL, intercept = FALSE, N = NULL, missing = "remove", robustID = NULL, multivariate_covs = NULL, tol = 1e-10, ... )
formula |
The formula used for specifying the fixed and random structure. Used for univariate and multilevel structures. |
effect_name |
Character string representing the name of the effect size column in the data. |
studyID |
Character string representing the study ID |
effectID |
Character string representing the effect size ID |
variance |
Character string representing the name of the variance of the effect size in the data. |
data |
Data used for analysis |
estimation_method |
Type of estimation used, either "REML" or "MLE", REML is the default |
optim_method |
Optimization method that is passed to the optim function. Default is 'L-BFGS-B'. |
structure |
Between studies covariance structure, default is "UN" or unstructured. See details for more specifics. |
varcov_type |
Type of variance covariance matrix computed. Default is 'cor_weighted' for correlations or 'smd_outcome' for standardized mean differences. |
weights |
User specified matrix of weights. |
intercept |
Whether a model intercept should be specified, default is FALSE meaning no intercept. See details for more information. |
N |
Character string representing the sample size of the studies. |
missing |
What to do with missing data, default is 'remove' |
robustID |
A character vector specifying the cluster group to use for computing the robust standard errors. |
multivariate_covs |
A one-sided formula to specify the covariates used in a multivariate analysis. |
tol |
Tolerance for estimating, passed to |
... |
Additional arguments to pass to |
Output is a named list; The output returns the estimated parameters, fit statistics, estimation inputs.
Estimate regression coefficients
find_B(model_input, R)find_B(model_input, R)
model_input |
Model input as a character string. Multiple models need to be on their own line. Model syntax uses lavann like syntax, see details for more details about this syntax. |
R |
A correlation matrix, most likely this will be the average correlation matrix outputted from the metafor package. |
Coming soon.
The output will be the same length as the number of regression equations specified in the model_input argument.
A list of parameter estimates
Br <- matrix(c(1.00000000, -0.09773331, -0.1755029, 0.3186775, -0.09773331, 1.00000000, 0.5271873, -0.4175596, -0.17550292, 0.5271872, 1.0000000, -0.4006848, 0.31867753, -0.41755963, -0.4006848, 1.0000000), nrow = 4, byrow = TRUE) colnames(Br) <- c("Performance", "Self_confidence", "Cognitive", "Somatic" ) rownames(Br) <- colnames(Br) ## Proposed path model model <- "## Regression paths Performance ~ Self_confidence + Cognitive + Somatic Self_confidence ~ Cognitive + Somatic " find_B(model, Br)Br <- matrix(c(1.00000000, -0.09773331, -0.1755029, 0.3186775, -0.09773331, 1.00000000, 0.5271873, -0.4175596, -0.17550292, 0.5271872, 1.0000000, -0.4006848, 0.31867753, -0.41755963, -0.4006848, 1.0000000), nrow = 4, byrow = TRUE) colnames(Br) <- c("Performance", "Self_confidence", "Cognitive", "Somatic" ) rownames(Br) <- colnames(Br) ## Proposed path model model <- "## Regression paths Performance ~ Self_confidence + Cognitive + Somatic Self_confidence ~ Cognitive + Somatic " find_B(model, Br)
Find regression coefficients
find_reg_coef(model_input, R, ...)find_reg_coef(model_input, R, ...)
model_input |
Model input as a character string. Multiple models need to be on their own line. See details for specification. |
R |
A correlation matrix, most likely this will be the average correlation matrix outputted from the metafor package. |
... |
Currently not used |
A vector of regression coefficient estimates.
The primary function used for input and estimation. The function takes the data inputs and routes the estimation and structure type based on data structure. The function can handle univariate, multivariate, longitudinal, and multilevel meta-analytic models.
mars( data, studyID, effectID, sample_size, effectsize_type = NULL, formula = NULL, variable_names = NULL, effectsize_name = NULL, estimation_method = "REML", variance = NULL, varcov_type, weights = NULL, structure = "UN", intercept = FALSE, missing = "remove", optim_method = "L-BFGS-B", robustID = NULL, multivariate_covs = NULL, tol = 1e-10, ... )mars( data, studyID, effectID, sample_size, effectsize_type = NULL, formula = NULL, variable_names = NULL, effectsize_name = NULL, estimation_method = "REML", variance = NULL, varcov_type, weights = NULL, structure = "UN", intercept = FALSE, missing = "remove", optim_method = "L-BFGS-B", robustID = NULL, multivariate_covs = NULL, tol = 1e-10, ... )
data |
Data used for analysis |
studyID |
Character string representing the study ID |
effectID |
Character string representing the effect size ID |
sample_size |
Character string representing the sample size of the studies. |
effectsize_type |
Type of effect size being analyzed |
formula |
The formula used for specifying the fixed and random structure. Used for univariate and multilevel structures. |
variable_names |
Vector of character strings representing the attributes with correlations. The attributes that are correlated should be separated by an underscore. |
effectsize_name |
Character string representing the name of the effect size column in the data. |
estimation_method |
Type of estimation used, either "REML" or "MLE", REML is the default |
variance |
Character string representing the name of the variance of the effect size in the data. |
varcov_type |
Type of variance covariance matrix computed. Default is 'cor_weighted' for correlations or 'smd_outcome' for standardized mean differences. |
weights |
User specified matrix of weights for analysis. |
structure |
Between studies covariance structure, default is "UN" or unstructured. See details for more specifics. |
intercept |
Whether a model intercept should be specified, default is FALSE meaning no intercept. See details for more information. |
missing |
Whether missing data should be removed, or kept. Default is removing. |
optim_method |
Optimization method that is passed to the optim function. Default is 'L-BFGS-B'. |
robustID |
A character vector specifying the cluster group to use for computing the robust standard errors. |
multivariate_covs |
A one-sided formula to specify the covariates used in a multivariate analysis. |
tol |
Tolerance of the optimization, default is 1E-10. |
... |
Not currently used. |
Returns a list of class mars; The returned object contains elements from the estimation.
This data contains correlations on math ...
math_correlationsmath_correlations
A nested list with correlations and sample size:
A list of math correlations
Study sample size
math_correlationsmath_correlations
Model fitting function
model_fit(model_input, R, method_null = "sem", N)model_fit(model_input, R, method_null = "sem", N)
model_input |
Model input as a character string. Multiple models need to be on their own line. See details for specification. |
R |
A correlation matrix, most likely this will be the average correlation matrix outputted from the metafor package. |
method_null |
Unsure |
N |
Sample size |
A list of fit indices.
Br <- matrix(c(1.00000000, -0.09773331, -0.1755029, 0.3186775, -0.09773331, 1.00000000, 0.5271873, -0.4175596, -0.17550292, 0.5271872, 1.0000000, -0.4006848, 0.31867753, -0.41755963, -0.4006848, 1.0000000), nrow = 4, byrow = TRUE) colnames(Br) <- c("Performance", "Self_confidence", "Cognitive", "Somatic" ) rownames(Br) <- colnames(Br) ## Proposed path model model <- "## Regression paths Performance ~ Self_confidence + Cognitive + Somatic Self_confidence ~ Cognitive + Somatic " N <- 573 model_fit(model_input = model, R = Br, method_null = "sem", N) model_fit(model_input = model, R = Br, method_null = "sem", N )Br <- matrix(c(1.00000000, -0.09773331, -0.1755029, 0.3186775, -0.09773331, 1.00000000, 0.5271873, -0.4175596, -0.17550292, 0.5271872, 1.0000000, -0.4006848, 0.31867753, -0.41755963, -0.4006848, 1.0000000), nrow = 4, byrow = TRUE) colnames(Br) <- c("Performance", "Self_confidence", "Cognitive", "Somatic" ) rownames(Br) <- colnames(Br) ## Proposed path model model <- "## Regression paths Performance ~ Self_confidence + Cognitive + Somatic Self_confidence ~ Cognitive + Somatic " N <- 573 model_fit(model_input = model, R = Br, method_null = "sem", N) model_fit(model_input = model, R = Br, method_null = "sem", N )
Mul R2
Mul_R2(model_input, R)Mul_R2(model_input, R)
model_input |
Model input as a character string. Multiple models need to be on their own line. Model syntax uses lavann like syntax, see details for more details about this syntax. |
R |
A correlation matrix, most likely this will be the average correlation matrix outputted from the metafor package. |
A vector of names
Computational function to compute the Olkin & Siotani (1976) variance-covariance matrix for correlation matrices. It allows the user to specify three different computations.
olkin_siotani(data, n, type = c("average", "weighted", "simple"))olkin_siotani(data, n, type = c("average", "weighted", "simple"))
data |
A correlation matrix or a list of correlation matrices. |
n |
Sample size |
type |
The type of Olkin and Siotani correction to make. |
The three possible computations that can be specified are:
average: Average all the correlations element-wise to pool into a single correlation matrix. The variance-covariance is computed from the averaged correlation matrix, then divided by study specific sample sizes.
weighted: Same as the average process-wise, but uses a weighted average to pool into a single correlation matrix.
simple: Computes the variance-covariance for each individual correlation matrix, then divide these by the study specific sample sizes.
List of matrices, same length as the number of studies or number of correlation matrices.
Becker, B. J. (1992). Using results from replicated studies to estimate linear models. Journal of Educational Statistics, 17(4), 341-362. Olkin, I. (1976). Asymptotic distribution of functions of a correlation matrix. Essays in provability and statistics: A volume in honor of Professor Junjiro Ogawa.
Computation for the numerator of the variance-covariance matrix.
OS(data)OS(data)
data |
A correlation matrix. |
A matrix representing the variance-covariance matrix.
This function fits the path model and returns adjusted standard errors.
path_model( mars_object, model, num_obs = NULL, adjust_se = TRUE, method_null = "sem", ... )path_model( mars_object, model, num_obs = NULL, adjust_se = TRUE, method_null = "sem", ... )
mars_object |
The mars fitted object. |
model |
This is model syntax specified in the format by lavaan. |
num_obs |
Number of observations |
adjust_se |
Adjust the standard errors to reflect the ... |
method_null |
Unsure |
... |
Currently not used. |
The input is the coefficients and the variance covariance matrix returned from the mars function.
List output with class path; The output is the parameter estimates from the fitted path model.
This data ...
schoolschool
A dataframe with 56 rows and 5 columns:
District ID
schoolschool
This data ...
smd_datasmd_data
A dataframe with 14 rows and 7 columns:
Study ID
smd_datasmd_data