latex - svy后如何将表格输出到LaTeX:两种方式制表
问题描述
我试图在使用svy: tab
. 考虑这个例子:
use https://www.stata-press.com/data/r16/nhanes2f, clear
svyset psuid [pweight=finalwgt], strata(stratid)
eststo sexrace: svy, subpop(rural): tab sex race, row percent format(%9.3g)
esttab sexrace
但这只给了我单元格百分比,而不是行百分比。我跑了ereturn list
,似乎根本没有存储这些行百分比;它们仅用于显示结果。
我也试过:
tabout sex race using table2.tex, replace c(row) layout(row) svy stats(chi2) percent
但我得到不同的数字。
注意:如果您尚未安装estout
和tabout
,要运行上述命令,您需要安装这两个包:
ssc install estout
ssc install tabout
解决方案
以下对我有用:
use https://www.stata-press.com/data/r16/nhanes2f, clear
svyset psuid [pweight=finalwgt], strata(stratid)
svy, subpop(rural): tab sex race, row percent format(%9.3g)
--------------------------------------
1=male, | 1=white, 2=black, 3=other
2=female | White Black Other Total
----------+---------------------------
Male | 94.3 3.87 1.79 100
Female | 96.1 2.87 .993 100
|
Total | 95.2 3.37 1.4 100
--------------------------------------
Key: row percentage
Pearson:
Uncorrected chi2(2) = 19.0178
Design-based F(1.81, 52.45) = 2.1654 P = 0.1294
tabout sex race if rural == 1 using table2.tex, style(tex) ///
replace c(row) svy stats(chi2) f(3) mult(100)
1=white, 2=black, 3=other
White Black Other Total
% % % %
1=male, 2=female
Male 94.346 3.865 1.789 100.000
Female 96.137 2.870 0.993 100.000
Total 95.231 3.373 1.396 100.000
Pearson: Uncorrected chi2(2)= 19.018
Design-based F(1.81, 52.45)= 2.165
P-value= 0.129
推荐阅读
- reactjs - React + axios + redux 拦截器
- c# - Outlook VSTO 加载项:无法解析收件人名称
- javascript - 如何使用 JQuery 过滤表。使用 OR 和 AND 条件
- javascript - 在 selectize.js 中选择项目时如何设置显示的文本?
- highcharts - 在 HighChart xAxis 上仅显示月份标签
- c# - 日期时间在 asp.net MVC 中显示为无效的日期时间
- c# - C# .NET:抓取动态 (JS) 网站
- css - 折叠时居中 BS 切换菜单
- php - PHP CLI - 错误:在分配给网络的默认值中找不到可用的、不重叠的 IPv4 地址池
- c# - C# 使用 lambda 表达式将参数传递给方法