************************************************************** * HivnetIC.do * ************************************************************** * * * PURPOSE: analysis of HIVNET Informed Consent Data * * * * AUTHOR: P. Heagerty * * * * DATE: 02 May 2005 * ************************************************************** infile id group education age cohort ICgroup will0 know0 /// q4safe0 q4safe6 q4safe12 /// nurse0 nurse6 nurse12 using HivnetWide.raw *** *** recode and label variables *** gen knowhigh = know0 recode knowhigh min/7=0 8/max=1 gen knowbins = know0 recode knowbins min/0=0 1/3=1 4/6=2 7/max=3 gen msm = group recode msm 2/4=0 gen school = education recode school 1/2=0 3/6=1 gen agecat = age recode agecat min/29=0 30/39=1 40/max=2 label variable will0 "willingness" label variable knowhigh "knowledge high" label variable knowbins "knowledge level" label variable msm "risk group" label variable cohort "recruitment cohort" label variable school "education" label define ylab 0 "< def. willing" 1 "definitely willing" label define klab 0 "know6 <=7" 1"know6 >=8" label define klab2 0 "know6 <=0" 1 "know6 (1-3)" 2 "know6 (4-6)" 3 "know6 (7-10)" label define glab 0 "IDU+Women" 1 "MSM" label define clab 0 "old cohort" 1 "new cohort" label define slab 0 "<= high school" 1 "some college +" label values will0 ylab label values knowhigh klab label values msm glab label values cohort clab label values school slab *** *** univariate summaries *** tabulate q4safe0 tabulate q4safe6 tabulate q4safe12 *** *** bivariate summaries *** tabulate ICgroup q4safe0, row chi logit q4safe0 ICgroup tabulate ICgroup q4safe6, row chi logit q4safe6 ICgroup tabulate ICgroup q4safe12, row chi logit q4safe12 ICgroup *** *** correlation *** sort ICgroup by ICgroup: corr q4safe0 q4safe6 q4safe12 *** *** transitions *** tabulate q4safe0 q4safe6, row chi tabulate q4safe6 q4safe12, row chi ****************************************************************** *** create "long" format data *** ****************************************************************** *** this command takes variables that end in numbers (times), *** such as q4safe0 q4safe6 q4safe12 and then "stacks" these *** into a single variable (truncating the numbers from the names) *** and creating a new variable which records the truncated numbers, *** or times for the outcome. reshape long q4safe, i(id) j(month) list id q4safe month ICgroup education in 1/8 ****************************************************************** *** GEE Analysis *** ****************************************************************** gen month6 = (month==6) gen ICgroupXmonth6 = month6 * ICgroup gen month12 = (month==12) gen ICgroupXmonth12 = month12 * ICgroup *** [1] Baseline and Month 6 Only xtgee q4safe ICgroup month6 ICgroupXmonth6 if month<=6, /// i(id) corr(exchangeable) family(binomial) link(logit) xtgee q4safe ICgroup month6 ICgroupXmonth6 if month<=6, /// i(id) corr(exchangeable) family(binomial) link(logit) robust xtcorr *** [2] Baseline, Month 6, and Month 12 xtgee q4safe ICgroup month6 month12 ICgroupXmonth6 ICgroupXmonth12, /// i(id) corr(unstructured) t(month) family(binomial) link(logit) xtgee q4safe ICgroup month6 month12 ICgroupXmonth6 ICgroupXmonth12, /// i(id) corr(unstructured) t(month) family(binomial) link(logit) robust xtcorr test ICgroupXmonth6 ICgroupXmonth12 test ICgroup ICgroupXmonth6 ICgroupXmonth12 lincom ICgroupXmonth12 - ICgroupXmonth6 ***alternative parameterization gen post = (month>0) gen ICgroupXpost = post * ICgroup *xtgee q4safe ICgroup post month12 ICgroupXpost ICgroupXmonth12, /// * i(id) corr(unstructured) t(month) family(binomial) link(logit) robust *** ANCOVA type analysis *xtgee q4safe post month12 ICgroupXpost ICgroupXmonth12, /// * i(id) corr(unstructured) t(month) family(binomial) link(logit) robust *test ICgroupXpost ICgroupXmonth12 ***adjustment for baseline covariates xi: xtgee q4safe ICgroup post month12 ICgroupXpost ICgroupXmonth12 /// msm cohort school i.agecat, /// i(id) corr(unstructured) t(month) family(binomial) link(logit) robust xtcorr test ICgroupXpost ICgroupXmonth12 test ICgroup ICgroupXpost ICgroupXmonth12