regress y on x with robust standard errors, clustered standard errors, HAC standard errors, panel fixed effects, etc.
reg(y, x, subset = NULL, effect = NULL, robust = TRUE, hac = NULL,
cluster = NULL, rtype = 1)
name of the dependent variable
names of the independent variables in either "x1 x2 x3" format or ~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)".
conditions to subset the data
either "twoways", "individual", or "time" for fixed effects. Dataset must already have been xtset
.
whether to use robust standard errors
which variable to order by to compute heteroskedastic and auto correlation standard errors (if unspecified, do not do HAC correction)
a variable list giving the names of the variables to cluster by in producing clustered standard errors
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
.
b coefficient vector
V covariance matrix of coefficients