Hi all. The book by Vittinghoff et al (Regression Methods in Biostatistics: Linear, Logistic, Survival, and Repeated Measures Models, 2nd edition) on Page 174 includes Fig 5.4 (attached) to demonstrate the linearity of Logit CHD Risk and Age. A sample of the data is here.
------------------ copy up to and including the previous line ------------------
The full dataset is available online at https://regression.ucsf.edu/sites/g/.../data/wcgs.dta.
I want to replicate Figure 5.4.
Can someone please help me write the code for Figure 5.4?
The plotted points are the empirical log odds of the outcome for each of the unique values of age observed in the sample.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte(age chd69) 50 0 51 0 59 0 51 0 44 0 47 0 40 0 41 0 50 0 43 0 59 0 54 0 48 0 39 1 49 0 55 0 44 0 56 0 42 0 44 0 45 0 42 0 44 0 55 0 49 0 45 1 45 0 54 0 44 0 40 0 41 0 46 0 57 0 40 1 54 0 43 0 40 0 50 0 39 0 45 0 44 0 41 0 46 0 43 0 53 0 52 0 55 0 44 1 40 0 47 0 54 0 39 0 49 1 54 0 58 0 48 0 48 0 43 0 45 0 43 0 41 0 55 1 41 0 44 0 54 0 55 0 57 0 52 0 41 0 54 0 52 0 54 0 51 0 40 0 40 0 49 0 50 0 39 0 43 0 51 0 48 0 49 0 50 0 48 0 39 0 40 0 59 0 46 0 47 0 43 1 47 0 49 0 45 0 42 0 55 0 54 0 56 0 50 1 39 0 51 0 52 0 50 0 55 0 55 0 51 0 57 0 53 0 42 0 51 0 42 0 50 0 49 0 48 1 52 0 47 0 56 1 42 0 47 0 45 0 40 0 44 0 39 0 49 0 56 1 48 0 47 0 45 1 47 0 51 0 54 0 39 0 56 0 57 0 42 0 44 0 41 0 42 1 53 0 55 0 40 0 49 0 42 0 42 0 51 0 52 0 44 0 39 0 55 0 51 0 41 0 46 1 44 0 56 0 48 0 44 0 44 1 46 0 39 0 41 0 41 0 48 0 53 0 51 1 52 1 58 0 49 0 39 0 43 0 46 0 42 0 50 0 47 0 49 0 39 0 53 0 42 0 44 0 40 0 45 0 56 1 47 0 42 0 43 0 39 0 53 0 53 0 44 1 51 1 58 0 59 1 55 0 55 1 46 0 39 0 59 0 46 0 46 0 53 0 55 0 41 0 48 0 49 1 50 0 51 0 50 0 56 0 52 1 44 0 59 0 49 1 46 0 40 0 46 0 50 0 44 0 42 0 49 0 41 0 43 0 40 0 43 0 52 0 51 1 44 0 59 0 42 0 50 0 40 0 48 0 44 0 43 0 44 0 48 0 44 0 39 0 51 1 40 0 42 0 57 0 54 0 40 0 48 0 40 0 47 0 51 0 53 0 54 1 48 0 54 0 46 0 39 0 57 0 50 0 42 0 45 0 54 0 47 0 39 0 50 0 55 1 39 0 55 1 39 0 52 0 45 1 46 0 47 0 46 0 54 0 45 0 43 0 43 0 40 0 42 0 52 0 54 0 41 0 57 0 49 0 58 0 51 0 47 0 41 0 40 0 52 0 59 0 41 0 49 0 43 0 48 0 44 0 57 0 46 0 43 0 39 0 40 0 43 0 45 0 45 0 45 0 42 0 43 0 51 0 41 0 56 0 51 0 40 0 56 1 41 0 54 0 53 0 44 0 39 0 46 0 41 0 49 0 48 0 44 1 40 0 42 0 47 0 52 0 42 0 45 0 53 0 45 0 40 0 40 0 47 0 56 0 46 0 47 0 40 0 49 0 43 0 53 0 50 0 46 1 54 0 51 0 56 0 47 0 40 0 44 0 46 0 47 0 49 0 59 0 50 0 43 0 42 0 59 0 45 0 44 0 52 0 44 0 49 1 49 0 41 0 41 0 57 0 52 0 47 0 39 0 41 0 44 0 49 0 41 1 41 0 42 1 50 0 48 0 59 1 46 0 53 1 40 0 40 0 55 0 48 0 55 0 45 0 46 0 50 0 43 0 39 0 44 0 58 0 56 1 39 0 41 0 48 0 53 1 45 0 48 0 52 1 48 1 44 0 46 0 56 0 41 0 55 1 39 0 48 0 39 0 50 0 46 0 43 0 41 0 52 0 40 0 40 0 56 0 52 1 49 0 48 0 39 0 55 0 50 0 59 1 39 0 47 0 45 0 42 0 56 0 41 0 42 0 44 0 39 0 43 0 40 1 45 0 49 0 54 0 48 0 42 0 44 0 40 0 46 0 46 0 40 0 42 0 45 1 47 1 42 0 39 0 39 0 47 0 51 0 58 0 51 0 52 0 46 0 44 0 44 0 53 1 40 0 44 0 48 0 46 0 52 0 39 0 52 0 58 0 48 0 55 0 59 0 44 0 52 0 52 0 39 0 44 0 47 0 48 1 46 0 45 0 50 0 40 0 42 0 50 0 43 0 55 0 41 0 46 0 49 1 53 0 56 0 39 0 40 0 45 0 43 0 59 0 56 1 40 0 44 0 56 0 39 0 41 0 44 0 41 0 53 0 end label values chd69 yesno label def yesno 0 "No", modify label def yesno 1 "Yes", modify
The full dataset is available online at https://regression.ucsf.edu/sites/g/.../data/wcgs.dta.
I want to replicate Figure 5.4.
Can someone please help me write the code for Figure 5.4?
The plotted points are the empirical log odds of the outcome for each of the unique values of age observed in the sample.
Comment