R/modelsum.R
modelsum.Rd
Fit and summarize models for each independent (x) variable with a response variable (y), with options to adjust by variables for each model.
modelsum( formula, family = "gaussian", data, adjust = NULL, na.action = NULL, subset = NULL, weights = NULL, id, strata, control = NULL, ... )
formula | an object of class |
---|---|
family | similar mechanism to |
data | an optional data.frame, list or environment (or object coercible by |
adjust | an object of class |
na.action | a function which indicates what should happen when the data contain |
subset | an optional vector specifying a subset of observations (rows of |
weights | an optional vector specifying the weights to apply to each data observation (rows of |
id | A vector to identify clusters. Only used for |
strata | a vector of strata to separate model summaries by an additional group. Note that for families like "clog",
the "usual" strata term to indicate subject groupings should be given in the |
control | control parameters to handle optional settings within |
... | additional arguments to be passed to internal |
An object with class c("modelsum", "arsenal_table")
Jason Sinnwell, Patrick Votruba, Beth Atkinson, Gregory Dougherty, and Ethan Heinzen, adapted from SAS Macro of the same name
#> #> #> | |estimate |std.error |p.value |adj.r.squared |Nmiss | #> |:------------|:--------|:---------|:-------|:-------------|:-----| #> |(Intercept) |27.491 |0.181 |< 0.001 |0.004 |33 | #> |sex Female |-0.731 |0.290 |0.012 | | | #> |(Intercept) |26.424 |0.752 |< 0.001 |0.000 |33 | #> |Age in Years |0.013 |0.012 |0.290 | | | #>tab2 <- modelsum(alk.phos ~ arm + ps + hgb, adjust = ~ age + sex, family = "gaussian", data = mockstudy) summary(tab2, text = TRUE)#> #> #> | |estimate |std.error |p.value |adj.r.squared |Nmiss | #> |:-----------------------|:--------|:---------|:-------|:-------------|:-----| #> |(Intercept) |175.548 |20.587 |< 0.001 |-0.001 |266 | #> |Treatment Arm F: FOLFOX |-13.701 |8.730 |0.117 | | | #> |Treatment Arm G: IROX |-2.245 |9.860 |0.820 | | | #> |Age in Years |-0.017 |0.319 |0.956 | | | #> |sex Female |3.016 |7.521 |0.688 | | | #> |(Intercept) |148.391 |19.585 |< 0.001 |0.045 |266 | #> |ps |46.721 |5.987 |< 0.001 | | | #> |Age in Years |-0.084 |0.311 |0.787 | | | #> |sex Female |1.169 |7.343 |0.874 | | | #> |(Intercept) |336.554 |32.239 |< 0.001 |0.031 |266 | #> |hgb |-13.845 |2.137 |< 0.001 | | | #> |Age in Years |0.095 |0.314 |0.763 | | | #> |sex Female |-5.980 |7.516 |0.426 | | | #>#> #> #> | |estimate |std.error |p.value |adj.r.squared |Nmiss | #> |:-----------------------|:--------|:---------|:-------|:-------------|:-----| #> |Treatment Arm F: FOLFOX |-13.701 |8.730 |0.117 |-0.001 |266 | #> |Treatment Arm G: IROX |-2.245 |9.860 |0.820 | | | #> |Age in Years |-0.017 |0.319 |0.956 | | | #> |sex Female |3.016 |7.521 |0.688 | | | #> |ps |46.721 |5.987 |< 0.001 |0.045 |266 | #> |Age in Years |-0.084 |0.311 |0.787 | | | #> |sex Female |1.169 |7.343 |0.874 | | | #> |hgb |-13.845 |2.137 |< 0.001 |0.031 |266 | #> |Age in Years |0.095 |0.314 |0.763 | | | #> |sex Female |-5.980 |7.516 |0.426 | | | #>#> y.term y.label strata.term adjustment model term #> 1 alk.phos alk.phos adjusted1 1 (Intercept) #> 2 alk.phos alk.phos adjusted1 1 armF: FOLFOX #> 3 alk.phos alk.phos adjusted1 1 armG: IROX #> 4 alk.phos alk.phos adjusted1 1 age #> 5 alk.phos alk.phos adjusted1 1 sexFemale #> label term.type estimate std.error p.value #> 1 (Intercept) Intercept 175.54808014 20.5866451 4.343327e-17 #> 2 Treatment Arm F: FOLFOX Term -13.70061548 8.7296300 1.168035e-01 #> 3 Treatment Arm G: IROX Term -2.24497807 9.8600363 8.199294e-01 #> 4 Age in Years Adjuster -0.01740894 0.3187823 9.564575e-01 #> 5 sex Female Adjuster 3.01598411 7.5209656 6.884824e-01 #> adj.r.squared Nmiss #> 1 -0.0006968528 266 #> 2 -0.0006968528 266 #> 3 -0.0006968528 266 #> 4 -0.0006968528 266 #> 5 -0.0006968528 266