as.regexport: Coerce a model to class regexport

View source: R/as.regexport.R

as.regexportR Documentation

Coerce a model to class regexport

Description

Coerce a model to class regexport

Usage

as.regexport(model, ...)

Arguments

model

A regression model or output from a regression function that can be coerced to regexport format

...

Other arguments to be passed to methods

Details

The regexport package uses the classes regexcel and reglist to store all regression outputs needed to make the standard tables in a convenient format that avoids all of the complexity of the standard regression output classes (such as lm or glm). Coercing a model to this class will eliminate much of the complexity of the original model and simplifies the object down to what is needed to output the table.

The regexport package currently includes methods for models of class lm, glm, coeftest (for use with the lmtest package). Output from other packages can easily be used with regexport by creating a list with the required elements and using as.regexport to coerce the list into class regexport.

The regexcel class is a named list with at least three elements:

  • depvar A character vector with one element: the name of the dependent variable

  • coef A data.frame with four columns:

    • var A character vector with names of independent variables

    • est A numeric vector with the mean estimates of the coefficients

    • se A numeric vector with the standard error of the coefficients

    • p A numeric vector with the probability that a coefficient is not equal to zero (the p-value of the t-test)

  • sumstats A named list with summary statistics that can be displayed when a regression is output

Examples

reg <- lm(mpg ~ cyl + disp, data = mtcars)
regx <- as.regexport(reg)

philbastian/regexport documentation built on Sept. 12, 2023, 3:25 p.m.