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

st: RE: NPTREND problem


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: NPTREND problem
Date   Mon, 11 Nov 2002 16:58:21 -0000

Paul O'Brien
> 
> I have not been able to get the table layout right to do a 
> test for trend
> (NPTREND) with the following data:
> 
> WEIGHT   EE20mcg EE30mcg
> gained     48     24
> stable    210    114
> lost       38     18
> 
> What I get is this:
> 
> . tabi 48 24\210 114\38 18
> 
>            |          col
>        row |         1          2 |     Total
> -----------+----------------------+----------
>          1 |        48         24 |        72
>          2 |       210        114 |       324
>          3 |        38         18 |        56
> -----------+----------------------+----------
>      Total |       296        156 |       452
> 
>           Pearson chi2(2) =   0.2483   Pr = 0.883
> 
> . list
> 
>           row       col           pop
>   1.        1         1            48
>   2.        1         2            24
>   3.        2         1           210
>   4.        2         2           114
>   5.        3         1            38
>   6.        3         2            18
> 
> . nptrend row, by(col)
> 
>        col     score       obs      sum of ranks
>          1         1         3          10.5
>          2         2         3          10.5
> 
>           z  =  0.00
>   Prob > |z| =  1.00
> 
> 
> 
> The correct answer is:
> One sided P = .2965
> Two sided P = .593
> 
> Where am I going wrong?

The problem is that Stata does not 
know that it should look at your -pop- variable. 

Try 

. nptrend pop, by(row) 

Incidentally, a graph created with 

. ordplot row [w=pop] , by(col) 

supports the idea that these groups 
of responses are similar. 

(For -ordplot-, type -ssc desc ordplot-.) 

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/



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