Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • plotting a fitted line on log scale graph

    Dear all,

    Hello, I ran log(y) on log(x), and I'm graphing a scatter plot of y against x ON LOG SCALE, and I'd like to graph the fitted line (i.e., exp(a + b*log(x))) against x, all on one graph.

    I'm not sure how to graph the fitted line on log scale graph.

    I'd appreciate any and all help. Thank you very much!

    Best,


    John

  • #2
    Here is a silly example for what I think you're doing. Note the importance of showing a data example and code that you've used to get a good response.

    In my experience, Stata's not very good at nice default labels for logarithmic scales. That's something I've been working on intermittently, but I don't have a helper program to make public yet.

    Code:
    webuse grunfeld, clear 
    
    scatter mvalue kstock , ysc(log) xsc(log)
    gen logm = log(mvalue)
    gen logk = log(kstock)
    regress logm logk
    predict raw
    gen exp = exp(raw)
    
    scatter mvalue exp kstock , ysc(log) xsc(log) c(. l) ms(Oh none) sort /// 
    yti(mvalue) xti(kstock) ///
    yla(5000 2000 1000 500 200 100 50, ang(h)) xla(1 10 100 1000) /// 
    legend(order(2 "power function fit") pos(11) ring(0) nobox)
    Click image for larger version

Name:	powerfunction.png
Views:	1
Size:	12.5 KB
ID:	1359325


    Comment

    Working...
    X