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)
data | dataframe |
---|---|
dv | dependent variable (outcome variable) (character) |
ivs | independent variable(s) or predictor(s) (character) |
covariates | covariates (character) |
A tibble/data.table with results
Details to follow
References to follow
Hause Lin
# 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 ~ cyl + carb + vs (Intercept) 41.107 0.000 #> 2: mpg ~ cyl + carb + vs cyl -2.981 0.000 #> 3: mpg ~ cyl + carb + vs carb -0.636 0.155 #> 4: mpg ~ cyl + carb + vs vs -1.786 0.385 #> 5: mpg ~ cyl + carb (Intercept) 37.813 0.000 #> 6: mpg ~ cyl + carb cyl -2.625 0.000 #> 7: mpg ~ cyl + carb carb -0.526 0.215 #> 8: mpg ~ cyl + vs (Intercept) 39.625 0.000 #> 9: mpg ~ cyl + vs cyl -3.091 0.000 #> 10: mpg ~ cyl + vs vs -0.939 0.638 #> 11: mpg ~ cyl (Intercept) 37.885 0.000 #> 12: mpg ~ cyl cyl -2.876 0.000 #> 13: mpg ~ carb + vs (Intercept) 20.061 0.000 #> 14: mpg ~ carb + vs carb -0.954 0.126 #> 15: mpg ~ carb + vs vs 6.199 0.003 #> 16: mpg ~ carb (Intercept) 25.872 0.000 #> 17: mpg ~ carb carb -2.056 0.001# 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 + gear (Intercept) 34.659 0.79 #> 2: mpg ~ cyl + gear cyl -2.743 -0.81 #> 3: mpg ~ cyl + gear gear 0.652 0.13 #> 4: mpg ~ cyl (Intercept) 37.885 0.96 #> 5: mpg ~ cyl cyl -2.876 -0.85 #> 6: mpg ~ gear (Intercept) 5.623 0.20 #> 7: mpg ~ gear gear 3.923 0.48