Joseph Wagner has problems using -tabulate, exact- with an ordered
categorical dataset and Richard Williams reminded that alternatives are
available for this type of data.
Both variables in the table are at least ordinal in this latest case.
Someday, StataCorp might incorporate into -tabulate- a procedure analogous
to SAS's PROC FREQ with the CMH option, which would nonparametrically handle
ordinal-by-ordinal datasets like this one. In the meantime, you can use
parametric modeling with John Hendrickx's -desmat- and look at the linear
contrast.
Joseph Coveney
clear
set more off
input str5 age byte cou5 byte cou4 byte cou3 byte cou2 byte cou1
"65-70" 29 41 44 3 0
"70-74" 20 50 45 5 1
"74-78" 19 44 51 7 0
"78-95" 9 38 56 12 0
end
reshape long cou, i(age) j(sco)
label define Score 5 Excellent 4 "Very Good" 3 Good 2 Fair 1 Poor
label values sco Score
label variable sco Status
label variable age "Age Group"
tabulate age sco [fweight=cou], taub gamma
xi: ologit sco i.age [fweight=cou], or nolog
encode age, generate(sag) label(Age)
char sag[pzat] orp(3)
* You can restrict the contrast to just the linear component
* by stating -orp(1)- in the line above.
desmat: ologit sco sag [fweight=cou], desrep(exp all) verbose or nolog
* Or use one of Stata's alternatives to proportional odds ordinal logistic
* regression (-gologit-, -mclest-, -ocratio-, -rc2-, -sneop-, -soreg-)
* as warranted by theory, preference or circumstance
exit
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/