One of the fundamental motivations for generalized linear models (GLMs) is that they model the data as it is instead of transforming it. So the answer to your question is that there is no transformation, either by you or by the model.
If you want to understand this better, you could consult my book on GLMs with Peter Dunn (Dunn and Smyth, 2018). We discuss transformations of the response variable in Section 3.9 and contrast them with the GLM approach. We discuss transformations of predictor variables in Section 3.10, but that's a separate issue. Tweedie GLMs are covered in Chapter 12. Also see
Why is GLM different than an LM with transformed variable?
The particular Tweedie GLM you have defined (with var_power=1.5
) has mass at zero (i.e., it has exact zeros) but is otherwise continuous on the positive real numbers (Smyth, 1996; Hasan et al, 2012). Think of rainfall as an example. Many days there is no rain at all (exact zero) but, if there is any rain, then the actual amount of rain is continuous and positive. If your data is not like that, then you shouldn't be using this type of Tweedie GLM.
The code that you show however is fundamentally wrong. You cannot mix ordinary least squares (smf.OLS
) with GLM families (sm.families.Tweedie
). Did you perhaps mean smf.glm
instead of smf.ols
? Otherwise I suggest that you ask on the statsmodels forum:
https://groups.google.com/forum/?hl=en#!forum/pystatsmodels
because I think you might be misunderstanding what the functions do.
By the way, the statmodels
function sm.families.Tweedie
is a Python implementation of the tweedie
function in the statmod
R package, available from CRAN.
See
Given a GLM using Tweedie, how do I find the coefficients?
for example code.
References
Dunn, P. K., and Smyth, G. K, (2018). Generalized linear models with examples in R. Springer, New York, NY. https://doi.org/10.1007/978-1-4419-0118-7
Hasan, M.M. and Dunn, P.K. (2012). Understanding the effect of climatology on monthly rainfall amounts in Australia using Tweedie GLMs. International Journal of Climatology, 32(7), pp.1006-1017.
Smyth, G. K. (1996). Regression modelling of quantity data with exact
zeroes. Proceedings of the Second Australia-Japan Workshop on Stochastic Models in Engineering, Technology and Management. Technology Management Centre, University of Queensland,
pp.572–580.
http://www.statsci.org/smyth/pubs/RegressionWithExactZerosPreprint.pdf