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

st: Re: RE: Re: RE: Re: RE: one-sample chi square test


From   "Wendell Joice" <wjoice@erols.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: RE: Re: RE: Re: RE: one-sample chi square test
Date   Mon, 3 Feb 2003 16:30:46 -0500

Ooops!
Nick, You are absolutely right. I have now installed the uptodate version
of -chitest- and it works like a charm. Also, I have taken note of and will
work with your other comments. Thanks again!!
----- Original Message -----
From: "Nick Cox" <n.j.cox@durham.ac.uk>
To: <statalist@hsphsun2.harvard.edu>
Sent: Monday, February 03, 2003 4:57 AM
Subject: st: RE: Re: RE: Re: RE: one-sample chi square test


> Wendell Joice
>
> > chitest  rep78, count
> >       count invalid
> >       r(198);
>
> My guess is that this is because you are using an
> out-of-date copy of -chitest-. Perhaps you downloaded
> the program from http://www.stata.com/users/njc/tab_chi
> which holds an older version (supposedly, for any remaining
> users of Stata 5.0; any such on Statalist?).
>
> The version on SSC allows the -count- option, which is
> why it worked for me.
>
> > I have no data with '0' observed values.
>
> You will, some day!
>
> > DO FILE
> > .do chitest SEX "& racewbh==3 & csample==1"
> >
> >    .forval i = 0/5 {
> >         2. qui count if  `1'== `i' `2'
> >         3. if r(N)==0 {
> >         4. continue
> >         5. }
> >         6. local counts "`counts' `r(N)'"
> >         7. }
> >
> >    . di "`counts'
> >        950 767
> >
> >    . chitesti `counts'
> >
> >       Chi-square test:
> >           observed frequencies from keyboard
> >           expected frequencies equal
> >
> >                Pearson chi2(1) =  19.5044   Pr =  0.000
> >       likelihood-ratio chi2(1) =  19.5415   Pr =  0.000
> >
> >                                          residuals
> >             observed    expected     classic     Pearson
> >         1.       950     858.500      91.500       3.123
> >         2.       767     858.500     -91.500      -3.123
> >
> >    . macro drop _counts
> >
> >    . end of do-file
>
> The macro will get dropped anyway, as it
> is local, and thus invisible outside the .do file,
> but this does no harm.
>
> Nick
> n.j.cox@durham.ac.uk
>
> *
> *   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/
>



*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index