The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » General » Codes for Survival Analysis
Codes for Survival Analysis [message #5650] Fri, 19 June 2015 16:59 Go to next message
waqas is currently offline  waqas
Messages: 19
Registered: June 2015
Location: Islamabad, Pakistan
Member

I am trying to apply cox regression for predicting the full vaccination coverage among (12-23 months) children. In this regard i made following sytax



____________________________________________________________ _______________
dates for survival analysis
____________________________________________________________ __________


Compute CMCB= ((H2Y-1900) * 12) + H2M.
Compute CMCD1= ((H3Y-1900) * 12) + H3M.
Compute CMCD2= ((H5Y-1900) * 12) + H5M.
Compute CMCD3= ((H7Y-1900) * 12) + H7M.
Compute CMCP1= ((H4Y-1900) * 12) + H4M.
Compute CMCP2= ((H6Y-1900) * 12) + H6M.
Compute CMCP3= ((H8Y-1900) * 12) + H8M.
Compute CMCM= ((H9Y-1900) * 12) + H9M.
COMPUTE BAGE=CMCB-B3.
COMPUTE D1AGE=CMCD1-B3.
COMPUTE D2AGE=CMCD2-B3.
COMPUTE D3AGE=CMCD3-B3.
COMPUTE P1AGE=CMCP1-B3.
COMPUTE P2AGE=CMCP2-B3.
COMPUTE P3AGE=CMCP3-B3.
COMPUTE MAGE=CMCM-B3.
Var Lab CMCB "Century Month Code of age at BCG".
Var Lab CMCD1 "Century Month Code of age at DPT1".
Var Lab CMCD2 "Century Month Code of age at DPT2".
Var Lab CMCD3 "Century Month Code of age at DPT3".
Var Lab CMCP1 "Century Month Code of age at POLIO1".
Var Lab CMCP2 "Century Month Code of age at POLIO2".
Var Lab CMCP3 "Century Month Code of age at POLIO3".
Var Lab CMCM "Century Month Code of age at MEASLES".
Var Lab BAGE "Age in months at BCG".
Var Lab P1AGE "Age in months at Polio1".
Var Lab P2AGE "Age in months at Polio2".
Var Lab P3AGE "Age in months at Polio3".
Var Lab D1AGE "Age in months at DPT1".
Var Lab D2AGE "Age in months at DPT2".
Var Lab D3AGE "Age in months at DPT3".
Var Lab MAGE "Age in months at Measles".
EXECUTE.


____________________________________________________________ _______________________________________________________
For calculating the age of child when he/she complete its vaccine course of eight doses i developed the following
____________________________________________________________ _______________________________________________________


Method1.

Compute AGEF=Max(BAGE,P1AGE,P2AGE,P3AGE,D1AGE,D2AGE,D3AGE,MAGE).
Exe.

Method2.

Compute AGEFIS=MAGE.
if AGEFIS<BAGE AGEFIS=CMCB.
if AGEFIS<P1AGE AGEFIS=P1AGE.
if AGEFIS<P2AGE AGEFIS=P2AGE.
if AGEFIS<P3AGE AGEFIS=P3AGE.
if AGEFIS<D1AGE AGEFIS=D1AGE.
if AGEFIS<D2AGE AGEFIS=D2AGE.
if AGEFIS<D3AGE AGEFIS=D3AGE.
VAR LAB AGEFIS "AGE OF CHILD AT FULL IMMUNIZATION".
EXECUTE.


but none of above two producing the correct estimated. I am unable to develop variable showing age of child at which he/she complete his vaccine course of eight doses.


Someone please help me. Its Urgent


Waqas Imran
Re: Codes for Survival Analysis [message #6663 is a reply to message #5650] Tue, 23 June 2015 10:47 Go to previous message
Liz-DHS
Messages: 1516
Registered: February 2013
Senior Member
Dear User,
Here is a response from one of our experts, Dr. Tom Pullum:
Quote:
I use Stata, rather than SPSS. In Stata, your command for agef would not work because the maximum value would be calculated just for non-missing values. If a child has not had the measles immunization, for example, then the date of that immunization, and the child's age at that immunization, would be missing and therefore would be ignored. The command will give the maximum age at receiving the immunizations THAT HAVE BEEN RECEIVED, not necessarily the age at receiving ALL immunizations. I suspect that the "max" command in SPSS works the same way (sorry if I'm wrong about that!).
There are two ways around this. One would be the following. If the child has not (or not yet) received an immunization, set the age to a high numeric value such as 1000. Then the children who have not yet received all immunizations would have agef=1000. Alternatively, after the line to calculate agef, add another line to replace it with a missing value if any of the components (bage, etc.) is missing. In Stata, the lines would be as follows:

egen agef=rowmax(bage p1age p2age p3age d1age d2age d3age mage)
replace agef=. if bage==. | p1age==. | p2age==. | p3age==. | d1age==. | d2age==. | d3age==. | mage==. 

Quote:
As a minor comment, your labels for the CMC variables are misleading. For example, "Var Lab CMCB "Century Month Code of age at BCG." should be "Var Lab CMCB "Century Month Code for month of BCG." These variables are a recoding of dates, not of ages.

Previous Topic: Categorization of Occupations
Next Topic: Single Parent Families
Goto Forum:
  


Current Time: Thu Aug 11 10:15:58 Coordinated Universal Time 2022