Constructor for texreg objects.
The names for the covariates in a model as a
character vector (= row names).
The coefficients as a numeric vector. Can have length
zero.
The standard errors as a numeric vector. Can have length
zero.
The p-values as a numeric vector. Can have length zero.
The lower bounds of the confidence intervals as a
numeric vector. Can have length zero.
The upper bounds of the confidence intervals as a
numeric vector. Can have length zero.
Names of the goodness-of-fit statistics as a
character vector. Can have length zero.
Goodness-of-fit statistics as a numeric vector. Can have
length zero.
A logical vector with as many elements as the
gof argument, indicating whether the respective GOF statistic is a
double (TRUE) or integer (FALSE) number or whether it is a
character entry (NA).
A name for the statistical model. Can be a character
vector of length zero if there is no model name.
A texreg object representing the statistical model.
This function creates a texreg object. A texreg
object contains information about coefficients, standard errors, p-values
(optional), and about goodness-of-fit statistics. Instead of standard
errors and p-values, a texreg object may also contain upper and
lower bounds of a confidence interval. texreg objects are used
by the texreg function to create LaTeX tables and other
representations of the model results.
Leifeld, Philip (2013). texreg: Conversion of Statistical Model Output in R to LaTeX and HTML Tables. Journal of Statistical Software 55(8): 1-24. doi:10.18637/jss.v055.i08 .
library("nlme") # load library for fitting linear mixed effects models
model <- lme(distance ~ age, data = Orthodont, random = ~ 1) # estimate
coefficient.names <- rownames(summary(model)$tTable) # extract coef names
coefficients <- summary(model)$tTable[, 1] # extract coefficient values
standard.errors <- summary(model)$tTable[, 2] # extract standard errors
significance <- summary(model)$tTable[, 5] #extract p-values
lik <- summary(model)$logLik # extract log likelihood
aic <- summary(model)$AIC # extract AIC
bic <- summary(model)$BIC # extract BIC
n <- nobs(model) # extract number of observations
gof <- c(aic, bic, lik, n) # create a vector of GOF statistics
gof.names <- c("AIC", "BIC", "Log Likelihood", "Num. obs.") # names of GOFs
decimal.places <- c(TRUE, TRUE, TRUE, FALSE) # last one is a count variable
# create the texreg object
tr <- createTexreg(coef.names = coefficient.names,
coef = coefficients,
se = standard.errors,
pvalues = significance,
gof.names = gof.names,
gof = gof,
gof.decimal = decimal.places)