/* Predict EQ-5D from SF-12 summary scores September 3, 2015 This code uses the parameters presented in Table 2 of Perraillon MC, Ya-Chen Tina Shih, Ronald A. Thisted. "Predicting the EQ-5D Preference Index from the SF-12 Health Survey: A finite Mixture Approach.", Medical Decision Making, October 2015 vol. 35 no. 7 888-901. Inputs: age (in years), and SF-12 MCS and PCS scores. */ * Center covariates gen mcsc = mcs - 50 gen pcsc = pcs - 50 gen agec = age - 65 * Prediction of latent normal gen u1 = .2308311 -.0020312*mcsc -.0045566*pcsc gen u2 = .6449207 -.0046078*mcsc -.0095772*pcsc * Censored predictions gen u1c = normal(u1/.0547989)*( /// u1+.0547989*normalden(u1/.0547989)/normal(u1/.0547989)) gen u2c = normal(u2/.1521847)*( /// u2+.1521847*normalden(u2/.1521847)/normal(u2/.1521847)) * Probabilities gen m1 = 1.563787 -.1483147*mcsc -.2152055*pcsc + .0263548*agec gen m2 = -1.954959 -.2490964*mcsc -.3208357 *pcsc + .0212149 *agec gen p1 = exp(m1) / (1+exp(m1)+ exp(m2)) gen p2 = exp(m2) / (1+exp(m1)+ exp(m2)) gen p3 = 1 - p1 - p2 * Classify egen _pmax = rowmax(p1 p2 p3) gen _class = 0 if _pmax == p3 replace _class = 1 if _pmax == p1 replace _class = 2 if _pmax == p2 gen _eqhat = 0 if _class==0 replace _eqhat = u1c if _class==1 replace _eqhat = u2c if _class==2 gen eq5d = 1 - _eqhat drop u1 u2 u1c u2c m1 m2 p1 p2 p3 _*