Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/leeper/reggie

Stata-like Regression Functionality for R
https://github.com/leeper/reggie

r regression stata work-in-progress

Last synced: about 2 months ago
JSON representation

Stata-like Regression Functionality for R

Awesome Lists containing this project

README

        

# 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](https://github.com/leeper/reggie/issues).

## Code Examples

```{r opts, echo=FALSE}
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.

```{r load}
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](https://www.r-pkg.org/badges/version/reggie)](https://cran.r-project.org/package=reggie)
![Downloads](https://cranlogs.r-pkg.org/badges/reggie)
[![Travis Build Status](https://travis-ci.org/leeper/reggie.png?branch=master)](https://travis-ci.org/leeper/reggie)
[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/PROJECTNUMBER?svg=true)](https://ci.appveyor.com/project/leeper/reggie)
[![codecov.io](https://codecov.io/github/leeper/reggie/coverage.svg?branch=master)](https://codecov.io/github/leeper/reggie?branch=master)

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

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