[英]Extracting the t-value for only one predictor variable in a large series of lm's using R
[英]Stargazer in R reporting t-value in addition to standard error and estimates
我想在方括號中的標准誤差下方添加 t 值,如何使用 Stargazer 完成此操作?
school.reg1 <- lm(math~income+students+english, data=CASchools)
school.reg2 <- lm(read~income+students+english, data=CASchools)
stargazer(school.reg1, school.reg2, type="latex",
covariate.labels = c("Number of Students at School", "Median Income of Parents", "% of Non-Native English Speakers", "Total School Spending", "Percent Qualifying for CalWorks "),
dep.var.labels = c("Math", "Reading"),
keep.stat=c("n", "adj.rsq"),
add.lines = list(c("AIC", round(AIC(school.reg1),2), round(AIC(school.reg2),2) )) )
目前表格看起來像這樣
源代碼取自https://bookdown.org/ejvanholm/WorkingWithData/attractive-output.html
也許您也可以使用“t=”代替方括號。 使用report
選項。
library(AER)
data("CASchools")
school.reg1 <- lm(math~income+students+english, data=CASchools)
school.reg2 <- lm(read~income+students+english, data=CASchools)
library(stargazer)
stargazer(school.reg1, school.reg2, type="text",
covariate.labels = c("Number of Students at School", "Median Income of Parents", "% of Non-Native English Speakers", "Total School Spending", "Percent Qualifying for CalWorks "),
dep.var.labels = c("Math", "Reading"),
keep.stat=c("n", "adj.rsq"),
report = "vc*st",
add.lines = list(c("AIC", round(AIC(school.reg1),2), round(AIC(school.reg2),2) )) )
=============================================================
Dependent variable:
----------------------------
Math Reading
(1) (2)
-------------------------------------------------------------
Number of Students at School 1.498*** 1.501***
(0.083) (0.074)
t = 18.137 t = 20.177
Median Income of Parents 0.0001 -0.0001
(0.0002) (0.0001)
t = 0.408 t = -0.739
% of Non-Native English Speakers -0.406*** -0.569***
(0.035) (0.031)
t = -11.632 t = -18.101
Total School Spending 636.628*** 641.224***
(1.590) (1.431)
t = 400.498 t = 448.017
-------------------------------------------------------------
AIC 3248.6 3160.46
Observations 420 420
Adjusted R2 0.625 0.735
=============================================================
Note: *p<0.1; **p<0.05; ***p<0.01
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.