************************************************************** * cfkids.do * ************************************************************** * * * PURPOSE: analysis of FEV1 among CF kids * * * * AUTHOR: P. Heagerty * * * * DATE: 31 March 2005 * * 04 April 2006 * ************************************************************** infile id fev1 age gender pseudoA f508 pancreat using NewCFkids.data * * ID = patient id * FEV1 = percent-predicted forced expiratory volume in 1 second * AGE = age (years) * GENDER = sex (1=male, 2=female) * PSEUDOA = infection with Pseudo Aeruginosa (0=no, 3=yes) * F508 = genotype (1=homozygous, 2=heterozygous, 3=none) * PANCREAT = pancreatic enzyme supplmentation (0,1=no, 2=yes) * label variable age "Age (years)" recode gender 1=0 2=1 label variable gender "female" recode pseudoA 3=1 recode pancreat 1=0 2=1 recode f508 1=2 2=1 3=0 save NewCFkids, replace *** *** some exploratory data analysis -- observation level *** summarize fev1 gen y8 = fev1 recode y8 (min/max=.) if age > 8.75 recode y8 (min/max=.) if age < 7.25 gen y10 = fev1 recode y10 (min/max=.) if age > 10.75 recode y10 (min/max=.) if age < 9.25 gen y12 = fev1 recode y12 (min/max=.) if age > 12.75 recode y12 (min/max=.) if age < 11.25 gen y14 = fev1 recode y14 (min/max=.) if age > 14.75 recode y14 (min/max=.) if age < 13.25 gen y16 = fev1 recode y16 (min/max=.) if age > 16.75 recode y16 (min/max=.) if age < 15.25 gen y18 = fev1 recode y18 (min/max=.) if age > 18.75 recode y18 (min/max=.) if age < 17.25 gen y20 = fev1 recode y20 (min/max=.) if age > 20.75 recode y20 (min/max=.) if age < 19.25 ***** the following creates a single record per kid: collapse (mean) f508 gender y8 y10 y12 y14 y16 y18 y20, by(id) ***** look at means over these ages: summarize sort f508 by f508: summarize sort gender by gender: summarize ***** information on correlation corr y8 y10 y12 corr y12 y14 y16 corr y16 y18 y20 graph twoway (scatter y14 y8) graph export c:/COURSES/CORRELATED/Intro/cfkids-y14y8.ps, as(eps) replace graph twoway (scatter y12 y8) graph export c:/COURSES/CORRELATED/Intro/cfkids-y12y8.ps, as(eps) replace graph twoway (scatter y10 y8) graph export c:/COURSES/CORRELATED/Intro/cfkids-y10y8.ps, as(eps) replace graph twoway (scatter y16 y10) graph export c:/COURSES/CORRELATED/Intro/cfkids-y16y10.ps, as(eps) replace graph twoway (scatter y14 y10) graph export c:/COURSES/CORRELATED/Intro/cfkids-y14y10.ps, as(eps) replace graph twoway (scatter y12 y10) graph export c:/COURSES/CORRELATED/Intro/cfkids-y12y10.ps, as(eps) replace *** *** some exploratory data analysis -- person level *** clear use NewCFkids collapse (min) age f508 gender, by(id) tab f508 tab gender tab f508 gender *** *** add the age-at-entry to the data *** gen age0 = age drop age f508 gender ***** save data with just ID and age0 save NewCFage0, replace ***** return to original data, and merge clear use NewCFkids sort id merge id using NewCFage0 list in 1/4 ***** create ageL and save gen ageL = age - age0 save NewCFkids, replace *** *** plot some individual series *** graph twoway (lowess fev1 age) (scatter fev1 age) /// if (id<=101799), by(id) graph export c:/COURSES/CORRELATED/Intro/cfkids-series1.ps, as(eps) replace graph twoway (lowess fev1 age) (scatter fev1 age) /// if (id>101799 & id<=103399), by(id) graph export c:/COURSES/CORRELATED/Intro/cfkids-series2.ps, as(eps) replace *** *** plot some fitted lines *** graph twoway (lfit fev1 age) (scatter fev1 age) /// if (id<=101799), by(id) graph export c:/COURSES/CORRELATED/Intro/cfkids-lines1.ps, as(eps) replace graph twoway (lfit fev1 age) (scatter fev1 age) /// if (id>101799 & id<=103399), by(id) graph export c:/COURSES/CORRELATED/Intro/cfkids-lines2.ps, as(eps) replace