reg: regress y on x with robust standard errors, clustered...

Description Usage Arguments Value Examples

Description

regress y on x with robust standard errors, clustered standard errors, HAC standard errors, panel fixed effects, etc.

Usage

1
2
reg(y, x, subset = NULL, effect = NULL, robust = TRUE, hac, cluster,
  rtype = 1)

Arguments

y

name of the dependent variable

x

names of the independent variables in "x1 x2 x3" format. To include a variable as a categorical variable (when you would use "i.state" to get state dummies in Stata), include it as "factor(state)".

subset

conditions to subset the data

effect

either "twoways", "individual", or "time" for fixed effects. Dataset must already have been xtset.

robust

whether to use robust standard errors

hac

which variable to order by to compute heteroskedastic and auto correlation standard errors (if unspecified, do not do HAC correction)

cluster

a variable list giving the names of the variables to cluster by in producing clustered standard errors

rtype

gives the type of heteroskedasticity correction to make. By default, it is "1" to implement HC1 which is the same as Stata's small sample corrected standard errors. rtype can be any integer from 0 to 3 with each value corresponding to a different heteroskedastic correction (HCx). See documention for vcovHC in package sandwich.

Value

b coefficient vector

V covariance matrix of coefficients

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(plm)
data(Produc)
use(Produc, clear=TRUE)
r = reg(emp, unemp)
r
xtset(year,state)
r = reg(emp, unemp, hac=year)
r
r = reg(emp, unemp, cluster=year)
r

genvar documentation built on Jan. 21, 2020, 9:07 a.m.