Constructor for texreg objects.
Arguments
- coef.names
The names for the covariates in a model as a
charactervector (= row names).- coef
The coefficients as a
numericvector. Can have length zero.- se
The standard errors as a
numericvector. Can have length zero.- pvalues
The p-values as a
numericvector. Can have length zero.- ci.low
The lower bounds of the confidence intervals as a
numericvector. Can have length zero.- ci.up
The upper bounds of the confidence intervals as a
numericvector. Can have length zero.- gof.names
Names of the goodness-of-fit statistics as a
charactervector. Can have length zero.- gof
Goodness-of-fit statistics as a
numericvector. Can have length zero.- gof.decimal
A
logicalvector with as many elements as thegofargument, indicating whether the respective GOF statistic is a double (TRUE) or integer (FALSE) number.- model.name
A name for the statistical model. Can be a
charactervector of length zero if there is no model name.
Value
A texreg object representing the statistical model.
Details
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.
References
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 .
Examples
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)