📄 tabulate_twoway.hlp
字号:
{smcl}
{* 29mar2005}{...}
{cmd:help tabulate}, {cmd:help tabi}, {cmd:help tab2}{...}
{right: dialogs: {bf:{dialog tabulate2:tabulate} {dialog tab2} {dialog tabi}}}
{hline}
{title:Title}
{p2colset 5 28 30 2}{...}
{p2col:{hi:[R] tabulate twoway} {hline 2}}Two-way tables of frequencies{p_end}
{p2colreset}{...}
{title:Syntax}
{pstd}
Two-way tables
{p 8 17 2}
{cmdab:ta:bulate}
{it:{help varname:varname1}} {it:{help varname:varname2}}
{ifin}
{weight}
[{cmd:,} {it:options}]
{pstd}
Two-way tables for all possible combinations {c -} a convenience tool
{p 8 17 2}
{cmd:tab2}
{varlist}
{ifin}
{weight}
[{cmd:,} {it:options}]
{pstd}
Immediate form of two-way tabulations
{p 8 17 2}
{cmd:tabi} {it:#11} {it:#12} [{it:...}] {cmd:\} {it:#21} {it:#22}
[{it:...}] [{cmd:\} {it:...}] [{cmd:,} {opt replace} {it:options}]
{synoptset 20 tabbed}{...}
{synopthdr}
{synoptline}
{syntab:Main}
{synopt:{opt ch:i2}}report Pearson's chi-squared
{p_end}
{synopt:{opt e:xact}[{opt (#)}]}report Fisher's exact test
{p_end}
{synopt:{opt g:amma}}report Goodman and Kruskal's gamma
{p_end}
{synopt:{opt lr:chi2}}report likelihood-ratio chi-squared
{p_end}
{synopt:{opt t:aub}}report Kendall's tau-b
{p_end}
{synopt:{opt V}}report Cramer's V
{p_end}
{synopt:{opt cchi:2}}report Pearson's chi-squared in each cell
{p_end}
{synopt:{opt co:lumn}}report relative frequency within its column of each cell
{p_end}
{synopt:{opt r:ow}}report relative frequency within its row of each cell
{p_end}
{synopt:{opt clr:chi2}}report likelihood-ratio chi-squared in each cell
{p_end}
{synopt:{opt ce:ll}}report the relative frequency of each cell
{p_end}
{synopt:{opt exp:ected}}report expected frequency in each cell
{p_end}
{synopt:{opt nof:req}}do not display frequencies
{p_end}
{synopt:{opt m:issing}}treat missing values like other values
{p_end}
{synopt:{opt w:rap}}do not wrap wide tables
{p_end}
{synopt:[{opt no}]{opt key}}report/suppress cell contents key
{p_end}
{synopt:{opt nol:abel}}display numeric codes rather than value labels
{p_end}
{syntab:Advanced}
{synopt:{opt matcell(matname)}}save frequencies in {it:matname};
programmer's option
{p_end}
{synopt:{opt matrow(matname)}}save unique values of
{it:{help varname:varname1}} in {it:matname}
{p_end}
{synopt:{opt matcol(matname)}}save unique values of
{it:{help varname:varname2}} in {it:matname}
{p_end}
{p2coldent:+ {opt a:ll}}equivalent to specifying {cmd:chi2 lrchi2 V gamma taub}
{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}
+ {opt all} does not appear in the dialog box.{p_end}
{p 4 6 2}
{opt by} may be used with {opt tabulate2} and {opt tab2},
but not with {opt tabi}; see {helpb by}.{p_end}
{p 4 6 2}
{opt fweight}s, {opt aweight}s, and {opt iweight}s are allowed by
{opt tabulate}. {opt fweight}s are allowed by {opt tab2}. See {help weight}.{p_end}
{title:Description}
{pstd}
{cmd:tabulate} produces two-way tables of frequency counts, along
with various measures of association, including the common Pearson
chi-squared, the likelihood-ratio chi-squared, Cram{c e'}r's V, Fisher's exact
test, Goodman and Kruskal's gamma, and Kendall's tau-b.
{pstd}
Line size is respected. That is, if you resize the Results window (in
windowed versions of Stata) before running {opt tabulate}, the resulting
two-way tabulation will take advantage of the available horizontal space.
Stata for Unix(console) users can instead use the {helpb linesize:set linesize}
command to take advantage of this feature.
{pstd}
{opt tab2} produces all possible two-way tabulations of the variables
specified in {varlist}.
{pstd}
{opt tabi} displays the r x c table using the values specified; rows are
separated by '{cmd:\}'. If no options are specified, it is as if {opt exact}
were specified for 2 x 2 tables and {opt chi2} were specified otherwise. See
{help immed} for a general description of immediate commands.
{pstd}
See {help tabulate oneway} if you want one-way tables of frequencies.
See {helpb table} and {helpb tabstat} if you want one-, two-, or n-way
tables of frequencies and a wide variety of statistics. See
{help tabulate summarize} for a description of {opt tabulate} with the
{opt summarize()} option; it produces tables (breakdowns) of means and
standard deviations. {opt table} is better than
{cmd:tabulate, summarize()}, but {cmd:tabulate, summarize()} is faster.
See {help epitab} for 2 x 2 tables with statistics of interest to
epidemiologists.
{title:Options}
{dlgtab:Main}
{phang}
{opt chi2} calculates and displays Pearson's chi-squared for the
hypothesis that the rows and columns in a two-way table are independent.
{opt chi2} may not be specified if {opt aweight}s or {opt iweight}s are
specified.
{phang}
{opt exact}[{opt (#)}] displays the significance
calculated by Fisher's exact test and may be applied to r x c as well as to 2 x 2
tables. In the case of 2 x 2 tables, both one- and two-sided probabilities
are displayed. The optional positive integer {it:#} is a multiplier on the
amount of memory that the command is permitted to consume. The default is 1.
This option should not be necessary for reasonable r x c tables. If the
command terminates with error 911, try {cmd:exact(2)}.
{phang}
{opt gamma} displays Goodman and Kruskal's gamma along with its
asymptotic standard error. {opt gamma} is appropriate only when both variables
are ordinal. {opt gamma} may not be specified if {opt aweight}s or
{opt iweight}s are specified.
{phang}
{opt lrchi2} displays the likelihood-ratio chi-squared statistic. The
request is ignored if any cell of the table contains no observations.
{opt lrchi2} may not be specified if {opt aweight}s or {opt iweight}s are
specified.
{phang}
{opt taub} displays Kendall's tau-b along with its asymptotic standard
error. {opt taub} is appropriate only when both variables are ordinal.
{opt taub} may not be specified if {opt aweight}s or {opt iweight}s are
specified.
{phang}
{opt V} (note capitalization) displays Cram{c e'}r's V. {opt V} may
not be specified if {opt aweight}s or {opt iweight}s are specified.
{phang}
{opt cchi2} displays the contribution to Pearson's chi-squared in
each cell of a two-way table.
{phang}
{opt column} displays of each cell in a two-way table the relative
frequency of that cell within its column.
{phang}
{opt row} displays in each cell of a two-way table the relative frequency of
that cell within its row.
{phang}
{opt clrchi2} displays the contribution to the likelihood-ratio
chi-squared in each cell of a two-way table.
{phang}
{opt cell} displays the relative frequency of each cell in a two-way
table.
{phang}
{opt expected} displays the expected frequency in each cell of a two-way table.
{phang}
{opt nofreq} suppresses printing the frequencies.
{phang}
{opt missing} requests that missing values be treated like other values
in calculations of counts, percentages, and other statistics.
{phang}
{opt wrap} requests that Stata take no action on wide, two-way tables
to make them readable. Unless {opt wrap} is specified, wide tables are broken
into pieces to enhance readability.
{phang}
[{opt no}]{opt key} suppresses or forces the display of a key above two-way tables.
The default is to display the key if more than one cell statistic is
requested, and otherwise to omit it. {opt key} forces the display of the key.
{opt nokey} suppresses its display.
{phang}
{opt nolabel} causes the numeric codes to be displayed rather than the value labels.
{dlgtab:Advanced}
{phang}
{opt matcell(matname)} saves the reported frequencies in
{it:matname}. This option is for use by programmers.
{phang}
{opt matrow(matname)} saves the numeric values of the r x 1
row stub in {it:matname}. This option is for use by programmers.
{opt matrow()} may not be specified if the row variable is a string.
{phang}
{opt matcol(matname)} saves the numeric values of the 1 x c
column stub in {it:matname}. This option is for use by programmers.
{opt matcol()} may not be specified if the column variable is a string.
{phang}
{opt replace} indicates that the immediate data specified as arguments to the
{opt tabi} command be left as the current data in place of whatever data there
were.
{pstd}
The following option is available with {opt tabulate} but is not shown in the
dialog box:
{phang}
{opt all} is equivalent to specifying {cmd:chi2 lrchi2 V gamma taub}.
Note the omission of {opt exact}. When {opt all} is specified, {opt no} may
be placed in front of the other options. {opt all noV} requests all
association measures except Cram{c e'}r's V (and Fisher's exact).
{opt all exact} requests all association measures including Fisher's exact
test. {opt all} may not be specified if {opt aweight}s or {opt iweight}s are
specified.
{title:Examples}
{phang}{cmd:. tabulate sex race}
{phang}{cmd:. tabulate sex race, row}
{phang}{cmd:. tabulate sex race, row col chi2}
{phang}{cmd:. tabulate dose function, all exact}
{phang}{cmd:. tabulate region agecat [freq=pop]}
{phang}{cmd:. tab2 sex race age}
{phang}{cmd:. tabi 30 18 \ 18 14}
{phang}{cmd:. tabi 30 18 38 \ 13 7 22, chi2 exact}
{phang}{cmd:. tabi 30 13 \ 18 7 \ 38 22, all exact col}
{title:Also see}
{psee}
Manual: {bf:[R] tabulate twoway}
{psee}
Online:
{helpb collapse},
{helpb encode},
{help epitab},
{help "svy: tabulate oneway"},
{help "svy: tabulate twoway"},
{helpb table},
{helpb tabstat},
{help tabulate oneway},
{help tabulate summarize},
{helpb xtdes},
{helpb xttab}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -