Hello,
I have to plot a simple fitted line for exports relative to GDP (the variable is called "norm_exports") on the y axis and bilateral distance (variable "km") on the x axis. However, I am having problems, since I have to depict the y axis in log scale. I know that I can therefore not use the standard twoway lfit command:
twoway (scatter norm_exports km)(lfit norm_exports km)
Therefore I tried to use predict for a regression of the log of my export variable on distance:
quietly reg log_norm_exports km
predict gr
label var gr "Linear prediction"
twoway (scatter norm_exports km)(line gr km, sort), yscale(log)
However, the code I used is not working. I would be really thankful if one could tell me where my mistake was.
Thanks a lot.
Related Posts with Plotting a fitted Line for log scale axis
Splitting a string variable in to two parts Hello... I have a string variable that has 3-5 words. I want to split it into two parts. Here's the…
Interpreting coefficients of a three-level mixed modelDear Stata-listers, I have a three-level mixed model and I am struggling on the specific interpreta…
How to reshapeI have a problem with reshaping, I don't know how to do this. Can someone help please? I have this: …
Text analysis - find frequency of several keywords within several strings + stop words removal + sentiment analysisHello! I am a new user of Stata and I have a problem with a task I have to solve. As a part of my th…
Gravity Model: reverse causality LEAD variableHi, I am trying to test for potential reverse causality between RTAs using a gravity model. RTA = …
Subscribe to:
Post Comments (Atom)
0 Response to Plotting a fitted Line for log scale axis
Post a Comment