version 9.2 log using C:\Teaching\IGP\log\13.transformation.log, replace * Chapter 13 Transformation * modified on Feb. 13, 2007 by Leena Choi *************************************************************************************** * Section 13.2 *************************************************************************************** * Data in Table 13.1 use "C:\Teaching\IGP\data\betaTG.dta", clear * put all label and define values label variable diabetics "Diabetics" label define diabeticslab 0 "Normals" 1 "Diabetics" label values diabetics diabeticslab * draw dotplot to compare the spreadness of measurements in each group dotplot betaTG, over(diabetics) * take log transformation (defaul is natural logarithm) gen lbetaTG = log(betaTG) * dotplot again using the log transformed values dotplot lbetaTG, over(diabetics) * observe the s.d of the values for the orinal scale and the log transformed sort diabetics by diabetics: sum betaTG by diabetics: sum lbetaTG * run t-test using the transformed values ttest lbetaTG, by(diabetics) * transform back the mean for the normal subjects to the orinal scale di exp(2.433349) di exp(2.811517) di exp(2.055181) * transform back the difference of menas to the orinal scale di exp(-.9572788) di exp(-.4353973) di exp( -1.47916) log close