sca_lm is used to run specification curve analysis using linear regression. Fits every possible model for your specified dependent variable, predictor variables, and covariates

sca_lm(data, dv, ivs, covariates = NULL)

Arguments

data

dataframe

dv

dependent variable (outcome variable) (character)

ivs

independent variable(s) or predictor(s) (character)

covariates

covariates (character)

Value

A tibble/data.table with results

Details

Details to follow

References

References to follow

Examples

# model with 1 covariate m1 <- sca_lm(data = mtcars, dv = "mpg", ivs = c("cyl", "carb"), covariates = c("vs")) m1[, c("modelformula", "term", "estimate", "p.value")] # model, term, beta, p value
#> modelformula term estimate p.value #> 1: mpg ~ carb (Intercept) 25.872 0.000 #> 2: mpg ~ carb carb -2.056 0.001 #> 3: mpg ~ carb + vs (Intercept) 20.061 0.000 #> 4: mpg ~ carb + vs carb -0.954 0.126 #> 5: mpg ~ carb + vs vs 6.199 0.003 #> 6: mpg ~ cyl (Intercept) 37.885 0.000 #> 7: mpg ~ cyl cyl -2.876 0.000 #> 8: mpg ~ cyl + carb (Intercept) 37.813 0.000 #> 9: mpg ~ cyl + carb cyl -2.625 0.000 #> 10: mpg ~ cyl + carb carb -0.526 0.215 #> 11: mpg ~ cyl + carb + vs (Intercept) 41.107 0.000 #> 12: mpg ~ cyl + carb + vs cyl -2.981 0.000 #> 13: mpg ~ cyl + carb + vs carb -0.636 0.155 #> 14: mpg ~ cyl + carb + vs vs -1.786 0.385 #> 15: mpg ~ cyl + vs (Intercept) 39.625 0.000 #> 16: mpg ~ cyl + vs cyl -3.091 0.000 #> 17: mpg ~ cyl + vs vs -0.939 0.638
# model without covariates m2 <- sca_lm(data = mtcars, dv = "mpg", ivs = c("cyl", "gear")) m2[, c("modelformula", "term", "estimate", "es.r")] # es.r is effect size
#> modelformula term estimate es.r #> 1: mpg ~ cyl (Intercept) 37.885 0.958 #> 2: mpg ~ cyl cyl -2.876 0.852 #> 3: mpg ~ cyl + gear (Intercept) 34.659 0.793 #> 4: mpg ~ cyl + gear cyl -2.743 0.806 #> 5: mpg ~ cyl + gear gear 0.652 0.133 #> 6: mpg ~ gear (Intercept) 5.623 0.204 #> 7: mpg ~ gear gear 3.923 0.480