This function will prepare heteroskedasticity-robust standard errors for stargazer. Currently, it does not handle cluster-robust standard errors because there is no nice way to pass model-specific vectors of clusters.

makerobustseslist(..., type = "HC2")

Arguments

...

a series of model fits, separated by commas

type

A string indicating the type of heterskedasticty-robust standard errors to be estimated. Is ignored if clust_var is specificed. Is "HC2" by default, because these are equivalent to Neyman standard errors (See Aronow and Samii).

Value

A list of vectors of robust standard errors.

Examples

library(randomizr) library(stargazer) Z_1 <- complete_ra(100) Y_1 <- 10 + 5*Z_1 + rnorm(100) Z_2 <- complete_ra(100) Y_2 <- 10 + 2*Z_2 + rnorm(100) fit_1 <- lm(Y_1 ~ Z_1) fit_2 <- lm(Y_2 ~ Z_2) stargazer(fit_1, fit_2, se = makerobustseslist(fit_1, fit_2), p = makerobustpslist(fit_1, fit_2))
#> #> % Table created by stargazer v.5.1 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu #> % Date and time: Tue, Jun 20, 2017 - 17:32:43 #> \begin{table}[!htbp] \centering #> \caption{} #> \label{} #> \begin{tabular}{@{\extracolsep{5pt}}lcc} #> \\[-1.8ex]\hline #> \hline \\[-1.8ex] #> & \multicolumn{2}{c}{\textit{Dependent variable:}} \\ #> \cline{2-3} #> \\[-1.8ex] & Y\_1 & Y\_2 \\ #> \\[-1.8ex] & (1) & (2)\\ #> \hline \\[-1.8ex] #> Z\_1 & 5.034$^{***}$ & \\ #> & (0.202) & \\ #> & & \\ #> Z\_2 & & 1.835$^{***}$ \\ #> & & (0.206) \\ #> & & \\ #> Constant & 9.878 & 10.183 \\ #> & (0.128) & (0.152) \\ #> & & \\ #> \hline \\[-1.8ex] #> Observations & 100 & 100 \\ #> R$^{2}$ & 0.864 & 0.447 \\ #> Adjusted R$^{2}$ & 0.863 & 0.441 \\ #> Residual Std. Error (df = 98) & 1.008 & 1.031 \\ #> F Statistic (df = 1; 98) & 623.403$^{***}$ & 79.152$^{***}$ \\ #> \hline #> \hline \\[-1.8ex] #> \textit{Note:} & \multicolumn{2}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\ #> \end{tabular} #> \end{table}