Dear Stata Experts,
I calculate with a variable which is highly skewed to the right. (Skewness 4.910018; Kurtosis 37.58021; 50% .15802 Mean .4333288).
What I did because of that was to use the natural log of the variable. When I plotted the model via marginsplot this resulted in a partially negative y scale which for the topic does not make sense and the scale of course is not interpretable.
The code reads as follows:
svy: reg lndepvar i.var1##i.var2
margins, over(var 1 var2) predict(xb)
marginsplot
The second code reads as follows:
svy: glm depvar i.var1##i.var2, family(gamma) link(log)
margins, over(var 1 var2) predict(xb) vsquish
marginsplot
The problem is: With the glm code, I get the same result as if I use the first code but with the original variable which is not log transformed. The estimators however, differ between the models. it is just the plots.
Is there anything wrong with the margins command in my second code?
What would you recommend? Should I use the natural log and waive the interpretable scale or should i use gamma log link.
Very happy for your help.
Thank you so much!!
I calculate with a variable which is highly skewed to the right. (Skewness 4.910018; Kurtosis 37.58021; 50% .15802 Mean .4333288).
What I did because of that was to use the natural log of the variable. When I plotted the model via marginsplot this resulted in a partially negative y scale which for the topic does not make sense and the scale of course is not interpretable.
The code reads as follows:
svy: reg lndepvar i.var1##i.var2
margins, over(var 1 var2) predict(xb)
marginsplot
The second code reads as follows:
svy: glm depvar i.var1##i.var2, family(gamma) link(log)
margins, over(var 1 var2) predict(xb) vsquish
marginsplot
The problem is: With the glm code, I get the same result as if I use the first code but with the original variable which is not log transformed. The estimators however, differ between the models. it is just the plots.
Is there anything wrong with the margins command in my second code?
What would you recommend? Should I use the natural log and waive the interpretable scale or should i use gamma log link.
Very happy for your help.
Thank you so much!!
Comment