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 coxme, 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" and values larger than 1 - threshold are displayed as "> 1 - threshold". Default = 0.001.

Value

A character matrix representing a manuscript-ready table.

Details

P-values for coxph objects if weights are used are calculated using the Huber–White sandwich estimator1,2 . P-values for lmerModLmerTest objects are calculated using the Kenward–Roger method3.

References

  1. Huber, P., 1967. The behavior of maximum likelihood estimates under nonstandard conditions. In: Proceedings of the fifth Berkeley symposium on mathematical statistics and probability, 1(1), pp. 221–233. Berkeley: University of California Press.

  2. White, H., 1980. A heteroskedasticity-consistent covariance matrix estimator and a direct test for heteroskedasticity. Econometrica: Journal of the Econometric Society, pp. 817–838.

  3. 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"