Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: stset for grouped data


From   Steven Samuels <[email protected]>
To   [email protected]
Subject   Re: st: stset for grouped data
Date   Fri, 15 Apr 2011 21:56:41 -0400

Mukesh-

There are many ways to do this in Stata:

**************************CODE BEGINS**************************

capture log close
set more off
local pname test
log using `pname', replace text

clear
input region year str10 agegp cases population
1 1994 0-4 2 5000
1 1994 5-9 5 2548
1 1994 10-14 6 2547
1 1994 15-19 15 7521
1 1994 20-24 75 7896
end
gen     agex= 1 if agegp=="0-4"
replace agex= 2 if agegp=="5-9"
replace agex= 3 if agegp=="10-14"
replace agex= 4 if agegp=="15-19"
replace agex= 5 if agegp=="20-24"

gen rate = 1000*cases/population  //direct calculation
list age* rate

// compare to:
gen popx =population/1000
poisson cases ibn.agex, exposure(popx) nocons irr  //"help factor variables"
// in earlier versions of Stata:
xi, noomit: poisson cases i.agex , exposure(popx) nocons irr
***************************CODE ENDS***************************

With a sufficient number of data lines, see help for
nbreg
ztp



Steve

Steven J. Samuels
Consulting Statistician
18 Cantine's Island
Saugerties, NY 12477 USA
Voice: 845-246-0774
Fax:   206-202-4783 
[email protected]


On Apr 13, 2011, at 12:06 PM, Dherani, Mukesh wrote:

Dear Stata experts,
I have grouped data and want to estimate incidence rate each year.  How can I set 'stset' when I don't have individual level data.  Do I need to expand data with certain assumptions?  

region year agegp cases population
1 1994 0-4 2 5000
1 1994 5-9 5 2548
1 1994 10-14 6 2547
1 1994 15-19 15 7521
1 1994 20-24 75 7896

I am using stata 10. 

Sorry for brevity of message but cannot think what else information should I provide. 
Thanks for your help.
Mukesh
University of Liverpool.
UK
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index