当我有三个二分法时,我正在尝试为DV创建一个汇总统计表(mean,sd)。使用命令tab IV1 Iv2, sum (DV)
我可以仅为两个IV变量创建汇总统计表,但不能为三个变量创建。但是,我需要三个IV及其相互作用的摘要统计数据。有什么办法吗?另一个命令?谢谢!
答案 0 :(得分:3)
你可以像这样制作一个互动变量:
webuse nlswork
egen interaction = group(race nev_mar union), label
tab interaction, sum(ln_wage)
答案 1 :(得分:1)
在这里,我使用与Dimitriy相同的精选沙盒。
webuse nlswork, clear
quietly statsby n=r(N) mean=r(mean) sd=r(sd), by(race nev_mar union) subsets clear: summarize ln_wage
egen nvars = rownonmiss(race nev_mar union )
sort nvars race nev_mar union
format mean sd %4.3f
l race-sd, sepby(nvars) noobs
+-------------------------------------------------+
| race nev_mar union n mean sd |
|-------------------------------------------------|
| . . . 28534 1.675 0.478 |
|-------------------------------------------------|
| white . . 13590 1.796 0.464 |
| black . . 5426 1.647 0.458 |
| other . . 211 1.890 0.510 |
| . 0 . 15509 1.758 0.466 |
| . 1 . 3718 1.740 0.477 |
| . . 0 14720 1.702 0.466 |
| . . 1 4507 1.927 0.432 |
|-------------------------------------------------|
| white 0 . 11399 1.794 0.462 |
| white 1 . 2191 1.808 0.474 |
| white . 0 10774 1.753 0.465 |
| white . 1 2816 1.961 0.422 |
| black 0 . 3955 1.651 0.455 |
| black 1 . 1471 1.634 0.467 |
| black . 0 3779 1.551 0.432 |
| black . 1 1647 1.867 0.440 |
| other 0 . 155 1.893 0.553 |
| other 1 . 56 1.881 0.369 |
| other . 0 167 1.865 0.510 |
| other . 1 44 1.983 0.507 |
| . 0 0 11936 1.707 0.464 |
| . 0 1 3573 1.930 0.429 |
| . 1 0 2784 1.682 0.474 |
| . 1 1 934 1.914 0.444 |
|-------------------------------------------------|
| white 0 0 9071 1.751 0.462 |
| white 0 1 2328 1.961 0.423 |
| white 1 0 1703 1.766 0.479 |
| white 1 1 488 1.958 0.420 |
| black 0 0 2745 1.556 0.433 |
| black 0 1 1210 1.867 0.429 |
| black 1 0 1034 1.536 0.430 |
| black 1 1 437 1.866 0.469 |
| other 0 0 120 1.856 0.550 |
| other 0 1 35 2.020 0.553 |
| other 1 0 47 1.888 0.391 |
| other 1 1 9 1.842 0.235 |
+-------------------------------------------------+
因此,您可以紧凑地获得所有三向组合,所有双向组合,所有单向和整体摘要。此外,此摘要集现在是内存中的数据集,因此您可以进一步操作它,导出它等等。