Thanks as always to Kit Baum, a new transplot package is now downloadable from SSC using
Stata 8 is the minimum requirement. That said, I have not tested this in Stata 8 but I imagine that people may shout out if there are problems running it in any old version of Stata.
transplot is to draw plots trying out transformations. It grows out of a long-term personal interest in transformations, an odd topic in that statistically experienced people seem to vary greatly in their willingness to transform.
That said, often a researcher just knows from experience or theory that a particular transformation (including here link function) should make sense.
But sometimes you need to try out a transformation before you can be sure that it is a good idea -- or see that it is useless, or changes matters so little that it is pointless -- or even to spot that it is a bad idea.
The immediate stimulus for this command came when I focused on why I never (well, hardly ever) use any of the official commands ladder, gladder, qladder. What I wanted instead was typically a focused comparison of what the data look like on the original scale and using one or at most a few different transformed scales. Most commonly, the question can just be: is taking logarithms a good idea?
I gave a talk centred on transplot at the London Stata conference in September 2019 but did not release the code (or a help file, which I had not even written at the time). Marination has allowed some further modest extensions of functionality.
The slides are accessible at https://www.stata.com/meeting/uk19/slides/uk19_cox.pptx
The help file is fairly detailed so a few examples of the command at work should be enough for now.
First, the command is used in one-way mode with named (a) distribution plotting command (b) variables (c) transformations (@ is symbol for a variable on original form). The unsurprising big picture here is that each variable shown is strongly positively skewed and would be easier to work with when logged.

Second, an example in which we play with logarithmic and reciprocal versions of a response variable:

Third you can try transforming the predictor too:
Code:
ssc install transplot
transplot is to draw plots trying out transformations. It grows out of a long-term personal interest in transformations, an odd topic in that statistically experienced people seem to vary greatly in their willingness to transform.
That said, often a researcher just knows from experience or theory that a particular transformation (including here link function) should make sense.
But sometimes you need to try out a transformation before you can be sure that it is a good idea -- or see that it is useless, or changes matters so little that it is pointless -- or even to spot that it is a bad idea.
The immediate stimulus for this command came when I focused on why I never (well, hardly ever) use any of the official commands ladder, gladder, qladder. What I wanted instead was typically a focused comparison of what the data look like on the original scale and using one or at most a few different transformed scales. Most commonly, the question can just be: is taking logarithms a good idea?
I gave a talk centred on transplot at the London Stata conference in September 2019 but did not release the code (or a help file, which I had not even written at the time). Marination has allowed some further modest extensions of functionality.
The slides are accessible at https://www.stata.com/meeting/uk19/slides/uk19_cox.pptx
The help file is fairly detailed so a few examples of the command at work should be enough for now.
First, the command is used in one-way mode with named (a) distribution plotting command (b) variables (c) transformations (@ is symbol for a variable on original form). The unsurprising big picture here is that each variable shown is strongly positively skewed and would be easier to work with when logged.
Code:
set scheme s1color webuse grunfeld, clear transplot qnorm invest mvalue kstock, trans(@ log10) ms(Oh) combine(colfirst)
Second, an example in which we play with logarithmic and reciprocal versions of a response variable:
Code:
sysuse auto, clear transplot scatter mpg weight, ytrans(@ log10 100/@) ms(Oh)
Third you can try transforming the predictor too:
Code:
transplot scatter mpg weight, ytrans(@ log10 100/@) xtrans(@ log10) ms(Oh) combine(colfirst)
Comment