# st: Re: test for trend from table data?

 From "Scott Merryman" To Subject st: Re: test for trend from table data? Date Mon, 16 Jun 2003 08:35:30 -0500

```----- Original Message -----
From: "Copeland, Laurel" <Laurel.Copeland@med.va.gov>
To: <statalist@hsphsun2.harvard.edu>
Sent: Monday, June 16, 2003 7:59 AM
Subject: st: test for trend from table data?

> A pharmacist asked me if I could do a test for trend over time from this
> table:
>
> Year Pharm Clin
> 1997 400 44
> 1998 221 54
> 1999 187 69
> 2000 123 63
> 2001 74 42
> 2002 145 149
>
> The table represents the number of reports of adverse events made by
> pharmacists (Pharm) and by clinicians (Clin), respectively.  She observes
> that the number of reports declined until 2002 (there was an intervention
at
> the beginning of 2002), and that the proportion of reports made by
> pharmacists seems to dwindle.  She wants a test statistic for either of
> these observations.
>
> Do I need to -expand- by pharm and clin? Or is there an immediate test
that
> might work?  I am having trouble seeing how to approach this.
>
> All ideas are welcome!
>
> Thank you,
> Laurel
>

-findit trend- brings several options.  In particular you may be interest in
the FAQ "Does Stata provide a test for trend?"
(http://www.stata.com/support/faqs/stat/trend.html) and Patrick
Royston's -ptrend- for  trend analysis of proportions.

-ptrend- would give you this:

. ptrend phar clin  year

pharm   clin   _prop   year
|-----------------------------|
1.    400     44   0.901   1997
2.    221     54   0.804   1998
3.    187     69   0.730   1999
4.    123     63   0.661   2000
5.     74     42   0.638   2001
6.    145    149   0.493   2002

Trend analysis for proportions

Regression of p = pharm/(pharm+clin) on year:
Slope = -.07784, std. error =  .00606, Z =  12.837

Overall chi2(5) =       167.206,  pr>chi2 = 0.0000
Chi2(1) for trend =     164.789,  pr>chi2 = 0.0000
Chi2(4) for departure =   2.416,  pr>chi2 = 0.6597

Hope this helps,
Scott

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