******************************************************************** * exer4-2-do.txt * * * * PURPOSE: logistic regression analysis of ALC * * * * DATE: 01/04/30 * * * ******************************************************************** *** *** input, recode & label *** infile age alc tob y count using NewTuyns.dat label variable age "Age Group" label variable alc "Alcohol" label variable tob "Tobacco" label variable y "Case/Control Status" label define agegps 1 "25-34" 2 "35-44" 3 "45-54" 4 "55-64" 5 "65-74" 6 "75+" label define alcgps 1 "<40g/day" 2 "40-79g/day" 3 "80-119g/day" 4 "120+g/day" label define tobgps 1 "0-9g/day" 2 "10-19g/day" 3 "20-29g/day" 4 "30+g/day" label define status 1 "Case" 0 "Control" label values age agegps label values alc alcgps label values tob tobgps label values y status generate newage=age recode newage 1/2=1 3=2 4=3 5=4 6=5 label define newgps 1 "25-44" 2 "45-54" 3 "55-64" 4 "65-74" 5 "75+" label values newage newgps tabulate y alc [freq=count], chi2 tabodds y alc [freq=count] tabodds y alc [freq=count], or drop if count==0 expand count *** *** logistic regression of "grouped linear" ALC *** logistic y alc logit lrtest, saving(1) *** *** logistic regression of ALC using dummy variables *** xi: logistic y i.alc logit lrtest, saving(2) *** *** logistic regression using linear ALC and two dummies *** generate alc3 = alc==3 generate alc4 = alc==4 logistic y alc alc3 alc4 logit lrtest, saving(3) *** *** likelihood ratio tests for linear vesus dummy variable *** lrtest, using(2) model(1) lrtest, using(3) model(1) *** *** Age adjustment -- is linear age adjustment adequate? *** xi: logistic y alc i.age logit lrtest, saving(4) logistic y alc age logit lrtest, saving(5) lrtest, using(4) model(5)