Skip to contents

Format regression results into manuscript-ready tables.

Usage

AS.format(
  fit,
  name = NULL,
  hetero.name = NULL,
  digits.fixed = 2,
  digits.sig = 2,
  sig.thresh = 0.001
)

Arguments

fit

A fitted object of class coxph, glm, glmerMod, gls, lm, or lmerModLmerTest.

name

Optional string vector of coefficient names.

hetero.name

Optional string vector of heteroscedasticity parameter names.

digits.fixed

Number of decimal places for summaries. Default = 2.

digits.sig

Number of significant figures for p-values. Default = 2.

sig.thresh

Threshold below which p-values are displayed as "< threshold". Default = 0.001.

Value

A character matrix representing a manuscript-ready table.

Details

P-values for lmerModLmerTest objects are calculated using the Kenward–Roger method¹.

References

  1. Kenward, M.G. and Roger, J.H., 1997. Small sample inference for fixed effects from restricted maximum likelihood. Biometrics, pp. 983–997.

Examples

# See GitHub README for further examples:
# https://github.com/hongconsulting/AutoScript
library(AutoScript)
library(survival)
data <- survival::veteran
fit <- coxph(Surv(data$time, data$status) ~ as.factor(data$trt))
print(AS.format(fit, name = "Treatment"))
#>      [,1]        [,2]                  [,3]  
#> [1,] ""          "HR (95%CI)"          "p"   
#> [2,] "Treatment" "1.02 (0.71 to 1.45)" "0.92"