Learn R Programming

texreg (version 1.39.4)

createTexreg: Constructor for texreg objects

Description

Constructor for texreg objects.

Usage

createTexreg(
  coef.names,
  coef,
  se = numeric(0),
  pvalues = numeric(0),
  ci.low = numeric(0),
  ci.up = numeric(0),
  gof.names = character(0),
  gof = numeric(0),
  gof.decimal = logical(0),
  model.name = character(0)
)

Value

A texreg object representing the statistical model.

Arguments

coef.names

The names for the covariates in a model as a character vector (= row names).

coef

The coefficients as a numeric vector. Can have length zero.

se

The standard errors as a numeric vector. Can have length zero.

pvalues

The p-values as a numeric vector. Can have length zero.

ci.low

The lower bounds of the confidence intervals as a numeric vector. Can have length zero.

ci.up

The upper bounds of the confidence intervals as a numeric vector. Can have length zero.

gof.names

Names of the goodness-of-fit statistics as a character vector. Can have length zero.

gof

Goodness-of-fit statistics as a numeric vector. Can have length zero.

gof.decimal

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).

model.name

A name for the statistical model. Can be a character vector of length zero if there is no model name.

Author

Philip Leifeld

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. tools:::Rd_expr_doi("10.18637/jss.v055.i08").

See Also

extract

Examples

Run this code
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)

Run the code above in your browser using DataLab