QuickReg: QuickReg

Description Usage Arguments Examples

Description

The QuickReg package provides an easy interface for linear regression in R. This includes the option to request robust and clustered standard errors, automatic labeling, and an easy way to specify multiple regression specifications simulatenously, and a compact html or latex output (relying on the widely used "stargazer" package). It also includes several functionalities to speed up computation, including a special implementation of the method of alternating projections that may reduce calculation time by more than 50 percent for analysis with a large number of fixed effects, and whose performance gain is increasing in the number of specifications passed to the function simultaneously. Written by Sondre U. Solstad (ssolstad@princeton.edu).

Usage

1
2
3
4
5
QuickReg(data, iv.vars, iv.vars.names, dv.vars, dv.vars.names, specifications,
  fixed.effects, fixed.effects.names, fixed.effects.specifications, robust.se,
  cluster, cluster.names, table.title, out.name, dynamic.out.name, html.only,
  silent, save.fits, no.out.file, demeaning.acceleration, digits = 2,
  type = "latex", omit = NULL, ...)

Arguments

data

Data frame in which all model variables are located.

iv.vars

Vector of independent variable names in dataset (e.g. c("gdppc", "pop"))

iv.vars.names

(Optional) Vector of desired independent variable names in table output (e.g. c("GDP per capita", "Population")). Defaults to values in "iv.vars" if none provided.

dv.vars

Vector of dependent variable in dataset (e.g. c("democracy", "war"))

dv.vars.names

(Optional) Vector of desired dependent variable names in table output (e.g. c("Democracy (Boix-Rosato-Miller 2012)", "War (with at least 1000 battle deaths)")). Defaults to values in "dv.vars" if none provided.

specifications

(Optional) List of desired regression specifications (selections of independent variables). The list of regression specifications are applied to all dependent variables. E.g. list(c(1), c(1,2), c(2))).

fixed.effects

(Optional) Vector of desired fixed effect variable names in dataset (e.g. c("region", "year"))

fixed.effects.names

(Optional) Vector of desired fixed effects labels in table output (e.g. c("Region FE", "Year FE")). Defaults to values in "fixed.effects" if none provided.

fixed.effects.specifications

(Optional) List of desired fixed effect specifications (selections of independent variables). These specifications are applied in sequence from the first to last model. If the number of specifications is less than the number of models, all fixed effects are applied in the remaining columns by default. If none provided, defaults to all fixed effects in all models.

robust.se

(Optional) If TRUE, returns robust standard errors calculated using a sandwich estimator from the "sandwich" package. Defaults to FALSE (i.e. normal standard errors).

cluster

(Optional) Name of variable in dataset by which cluster-robust standard errors should be computed using the cluster.vcov command of the multiwayvcov package.

cluster.names

(Optional) Desired name or label of clustering variable to be reported in table output (e.g. "Country" yields a note on the bottom of the table reading "Country-Clustered Standard Errors in Parenthesis"). If cluster specified but no "cluster.names" provided, "Cluster-Robust Standard Errors in Parenthesis" is reported.

table.title

(Optional) Specifies the title of the table with regression output. Defaults to "QuickReg" plus the date and time of creation in parenthesis.

out.name

(Optional) Specifies the output file name. Defaults to "QuickReg.html".

dynamic.out.name

(Optional) If TRUE, adds date and time of creation in brackets between the out.name and the file extension (e.g. QuickReg (2017-04-05-14-01-27).html)

html.only

(Optional) If TRUE, no latex output produced (only HTML table). Defaults to FALSE.

silent

(Optional) If TRUE, no messages are returned by the function. Defaults to FALSE.

save.fits

(Optional) If TRUE, saves fitted lm objects in a list by the name "QuickReg.fits" adding an integer if an object by this name already exists. Defaults to FALSE.

no.out.file

(Optional) If TRUE, does not save html table to working directory.

demeaning.acceleration

(Optional) If TRUE, attempts to speed up regression by the method of alternating projections. In particular, it utilizes the "demeanlist" function of the "lfe" package to create a matrix of all covariates demeaned by all fixed effects, and then fits the different regression specifications on this demeaned matrix. Time saved is increasing in the number of fixed effects, specifications and observations, and this method is slower when all these are low. If there are thousands of fixed effects and many specifications, time saved is potentially quite large. Note: Overrides fixed.effects.specifications, always including all variables specified in fixed.effects, and does not supply R-squared or other model statistics. Defaults to FALSE.

type

(Optional) Specifies the type of table output that will be requested from Stargazer. Possible values are: "latex", "html", and "text". Defaults to "latex". Defaults to "latex"

...

Various options passed to the stargazer function. See ?stargazer.

Examples

1
Please see: github.com/sondreus/QuickReg

sondreus/QuickReg documentation built on May 30, 2019, 6:27 a.m.