Stata-like Regression Functionality

This is a work-in-progress to explore how to design Stata-like regression modelling tools for R, namely those that allow plug-and-play variance-covariance estimation procedures and also to provide arguments to modelling functions in data-formula order (rather than the traditional formula-data order) thus enabling easy use in data analysis pipelines via %>%.

Contributions and feedback are welcome on GitHub.

Code Examples

options(width = 120)
knitr::opts_chunk$set(comment = "", warning = FALSE, message = FALSE, echo = TRUE, tidy = TRUE, size="small", fig.width = 10, fig.height = 10)

In addition to plug-and-play variance-covariance procedures, the reg() function also provides pretty print methods.

library("reggie")

# reg
reg(ChickWeight, weight ~ Time + Diet)

# reg
reg(ChickWeight, weight ~ Time + Diet, vcov_type = "const")

# reg, vce(robust)
reg(ChickWeight, weight ~ Time + Diet, vcov_type = "HC0")

# reg, vce(boot)
reg(ChickWeight, weight ~ Time + Diet, vcov_type = "boot")

# reg, vce(cluster Chick)
reg(ChickWeight, weight ~ Time + Diet, vcov_cluster = ~ Chick)

# bootstrap, cluster(Chick) reps(5000): reg

#reg(ChickWeight, weight ~ Time + Diet, vcov_cluster = ~ Chick, vcov_type = "boot")

# DOESN'T CURRENTLY WORK, BUT WHY?

# svy: reg
library("survey")
data(api)
dstrat <- svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)
reg(dstrat, api00 ~ ell + meals + mobility)

The "model" object class contains the underlying model object as its model argument, and methods for various commonly used generic functions (coef(), vcov(), plot(), terms(), predict()) are provided that behave like those operations on a standard modelling object.

Installation

CRAN Downloads Travis Build Status Appveyor Build Status codecov.io

This package is not yet on CRAN. To install the latest development version you can pull a potentially unstable version directly from GitHub:

if (!require("remotes")) {
    install.packages("remotes")
}
remotes::install_github("leeper/reggie")


leeper/reggie documentation built on May 12, 2019, 12:31 a.m.