【发布时间】:2021-11-23 12:28:54
【问题描述】:
我创建了以下针对异方差进行调整的线性模型:
library(sandwich)
library(stargazer)
df <- data.frame(A = rnorm(1000, 500, 10), B = rnorm(1000, 500, 10), C = rnorm(1000, 500, 10), D = rnorm(1000, 500, 10))
mod <- lm(A ~ B + C + D, df)
vcov <- vcovHC(mod, type= "HC1")
# Creating robust standard-erros
robust_se <- sqrt(diag(vcov))
robust_se <- list(robust_se[1:3]) # Keeping the robust se for the intercept and variables B and C only, since I don't want to display D in the regression table
stargazer(mod,
summary = TRUE,
keep = c("B", "C"),
keep.stat = c("n", "f", "rsq", "adj.rsq"),
notes.align = "l",
dep.var.labels=c("Value"),
covariate.labels=c("B", "C"),
se = robust_se,
out="directory.html")
我正在使用“survey”包处理调查数据。
即使我指定要显示 R²、调整后的 R² 和 F 统计量,打印的回归表也仅显示观察数:
% Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: sex, out 01, 2021 - 20:58:05
\begin{table}[!htbp] \centering
\caption{}
\label{}
\begin{tabular}{@{\extracolsep{5pt}}lc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& \multicolumn{1}{c}{\textit{Dependent variable:}} \\
\cline{2-2}
\\[-1.8ex] & Value \\
\hline \\[-1.8ex]
B & 0.013 \\
& (0.032) \\
& \\
C & $-$0.019 \\
& (0.031) \\
& \\
Constant & 497.270$^{***}$ \\
& (27.587) \\
& \\
\hline \\[-1.8ex]
Observations & 1,000 \\
\hline
\hline \\[-1.8ex]
\textit{Note:} & \multicolumn{1}{l}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
\end{tabular}
\end{table}
为什么会这样?
【问题讨论】: