A2.10 Transforming variables

use "https://tdmize.github.io/data/data/gss", clear
(gss.dta | GSS 1972 - 2016 Data | DMV Workshop)
gladder wages, title("[2.5.e] Distributions of Various Transformations of Wage
s")

Histograms of wages under nine transformations from cubic to inverse cubic; the log and square root versions look most normal.

use "https://tdmize.github.io/data/data/cda_ah4", clear
(cda_ah4.dta | Add Health Wave 4 - | )
clonevar exercisSS2 = exercisSS
(5 missing values generated)
replace exercisSS2 = exercisSS2 + 1
(5,109 real changes made)
gladder exercisSS2, title("[2.5.f] Distributions of Various Transformations") 
///
    subtitle("Activity Scale: Times Active in Last Week")

Histograms of the activity scale under nine transformations; none look normal because of a large spike at the lowest value.

*None of the transformations do a great job for this variable—largely because there is a large peak at zero (the modal person reports no physical activity). The best way to deal with this variable as a DV would be a count model (more on that later in the semester!)

Back to top