Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: tabulate


From   Roger Newson <[email protected]>
To   [email protected]
Subject   st: Re: tabulate
Date   Mon, 26 Jan 2004 17:31:15 +0000

At 17:18 26/01/04 +0100, Elisa wrote:
Why can't one use chi2 (or all in general) command with tabulate and weight?

     tabulate var1 var2 [aweight=divwt], chi2

the error in this case is:

     option chi2 not allowed
You should have used -fweight- instead of -aweight-. See -[R] weight- or online help for -weight-. As in this example:

. tab rep78 foreign [fwei=mpg], chi

Repair |
Record | Car type
1978 | Domestic Foreign | Total
-----------+----------------------+----------
1 | 42 0 | 42
2 | 153 0 | 153
3 | 513 70 | 583
4 | 166 224 | 390
5 | 64 237 | 301
-----------+----------------------+----------
Total | 938 531 | 1,469

Pearson chi2(4) = 570.7234 Pr = 0.000

-fweight- specifies frequency weights. Here, we assume that each model is represented in the original sample by a number of cars equal to -mpg-, presumably because cars that do more miles per gallon are more popular.

I hope this helps.

Roger


--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Website: http://www.kcl-phs.org.uk/rogernewson

Opinions expressed are those of the author, not the institution.

*
* 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/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index