options ls=80 ps=300 nodate; data cholst; infile "cholst.dat" firstobs=2; input newid id cholst sex age year; gender=sex; cage = age - 42.56; run; /* title "Framingham data: mixed model without covariates"; proc mixed data=cholst; class newid; model cholst = year / s; random intercept year / type=un subject=newid g; repeated / type=vc subject=newid; run; title "Framingham data: mixed model without covariates + AR(1) error"; proc mixed data=cholst covtest; class newid; model cholst = year / s; random intercept year / type=un subject=newid g; repeated / type=ar(1) subject=newid; run; title "Framingham data: mixed model without covariates + AR(1) error + meas error"; proc mixed data=cholst covtest; class newid; model cholst = year / s; random intercept year / type=un subject=newid g; repeated / type=ar(1) subject=newid local; run; title "Framingham data: mixed model without covariates + sp(pow) error"; proc mixed data=cholst covtest; class newid; model cholst = year / s; random intercept year / type=un subject=newid g; repeated / type=sp(pow)(year) subject=newid; run; title "Framingham data: longitudinal effect vs. cohort effect"; proc mixed data=cholst; class newid; model cholst = year cage cage*year / s; random intercept year / type=un subject=newid g; repeated / type=vc subject=newid; estimate "long-cross" year 1 cage -1; run; */ title "Framingham data: how baseline cholesterol level and"; title2" change rate depend on sex and baseline age"; proc mixed data=cholst; class newid; model cholst = sex age year sex*year age*year / s; random intercept year / type=un subject=newid g s; repeated / type=vc subject=newid; estimate "rate-diff" sex*year 1 age*year -10; run; endsas; title "Framingham data: do males have more stable (true) baseline"; title2 "cholesterol level and change rate than females?"; proc mixed data=cholst; class newid gender; model cholst = sex year sex*year / s; random intercept year / type=un subject=newid group=gender g; repeated / type=vc subject=newid; run; title "Framingham data under H0: males and femals have the same variance"; title2 "matrices of baseline cholesterol level and change rate"; proc mixed data=cholst; class newid gender; model cholst = sex year sex*year / s; random intercept year / type=un subject=newid g; repeated / type=vc subject=newid; run; title "Framingham data: do males have more stable (true) baseline cholesterol"; title2 "level and change rate than females adjusting for sex and baseline age"; proc mixed data=cholst; class newid gender; model cholst = sex age year sex*year age*year / s; random intercept year / type=un subject=newid group=gender g; repeated / type=vc subject=newid; run; title "Framingham data: are errors independent?"; proc mixed data=cholst covtest; class newid; model cholst = sex age year sex*year age*year / s; random intercept year / type=un subject=newid g; repeated / type=ar(1) subject=newid; run; title "Using GEE to fit Framingham data"; proc mixed data=cholst empirical; class newid; model cholst = sex age year sex*year age*year / s; random intercept year / type=un subject=newid; repeated / type=vc subject=newid; run;