I have a regression output in the form of a dataset. How can I input the estimates and standard errors into stargazer
manually? Such that, stargazer
creates its typical regression table?
term estimate std.error statistic p.value
1 rho 0.56782511824 0.016618530837 34.168190 0.000000e+00
2 (Intercept) -4.10698330735 0.537699847356 -7.638059 2.198242e-14
4 Unemployment_Rate 0.02288489900 0.016412419393 1.394365 1.632075e-01
5 pop_sq_mi 0.00020135202 0.000045361286 4.438852 9.044016e-06
6 prcntHS 0.13303000437 0.006002571434 22.162169 0.000000e+00
7 prcntBA 0.03698563228 0.012723399878 2.906899 3.650316e-03
8 prcntBlack 0.00877367484 0.004458885465 1.967683 4.910448e-02
9 prcntMulti 0.01404154066 0.004182210799 3.357445 7.866653e-04
10 prcntHisp 0.04316697336 0.003523552546 12.250980 0.000000e+00
11 prcntForeignBorn 0.02229836451 0.009707563865 2.297009 2.161824e-02
12 medianIncome -0.00002809549 0.000002933667 -9.576917 0.000000e+00
13 per_gop_2016 -0.02366390363 0.002698813668 -8.768261 0.000000e+00
I have tried to use the following method (as an example) without much luck.
X1 <- sample(seq(1,100,1), 100,replace= T)
X2 <- sample(seq(1,100,1), 100,replace= T)
Y <- sample(seq(1,100,1), 100,replace= T)
df <- data.frame(Y, X1, X2)
Results <- lm(Y ~ X1 + X2, data = df)
library(broom)
Results_DF <- data.frame(tidy(Results))
stargazer(type = "text",
coef = list(Results_DF$estimate, Results_DF$estimate),
se = list(Results_DF$std.error, Results_DF$std.error),
omit.table.layout = "s")
Error in if (substr(inside[i], 1, nchar("list(")) == "list(") { :
missing value where TRUE/FALSE needed
Any advice would be greatly appreciated. Thank You!