Description Usage Arguments Value Examples
This function returns a formatted table of generalized linear model results.
1 2 3 4 5 6 7 8 9 10 11 | glm_table(fit, digits = 4, p.digits = digits + 1, se = "normal",
intercept = FALSE, fmt = FALSE, fun_coef = if (class(fit)[1] == "lm" ||
fit$family$link == c("identity")) I else exp, id, ...)
fmt.glm_table(glm_tbl, tbl_colnames = c(colnames(glm_tbl)[1], "95% CI",
"p-value"), tbl_rownames = rownames(glm_tbl), digits = 2,
p.digits = digits + 1, p_fmt = function(p)
format.pval(round(as.numeric(p), p.digits), eps = 0.001),
beta_fmt = function(b) format(as.numeric(b), digits = digits, nsmall =
digits), ci_fmt = function(col1, col2) paste0(beta_fmt(col1), " to ",
beta_fmt(col2)))
|
fit |
An glm fit object of class |
digits |
Integer. The number of significant digits to return in coefficients |
p.digits |
Integer. The numeric of significant digits to return in p-values |
se |
Character. The type of standard error to use, "normal" or "robust". |
intercept |
Logical. Whether or not to include the intercept row in the returned table. |
fmt |
Logical. If true, passes the returned table to |
fun_coef |
Function to apply to the coefficients. By default, |
... |
Arguments passed to |
A matrix with coefficients, 95% confidence intervals, and p-values.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Basic logistic regression example
n <- 50
x <- rnorm(n)
y <- sample(c(TRUE, FALSE), size=n, replace=TRUE)
fit <- glm(y~x, family=binomial)
glm_table(fit)
## Use se="robust" to get risk ratios from poisson regression
fit <- glm(y~x, family=poisson)
glm_table(fit, se="robust")
## Get a nicely formatted table
glm_table(fit, fmt=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.