Announcement

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

  • Change x axis labels from f to 1/f values

    Dear researchers,

    Could you advise if there is any way to plot periodogram with labels of an x-axis, not in f but 1/f values?
    I'm trying to perform spectral analysis and periodogram with a number of years/period on the x-axis is more informative than with frequencies.

    Thank you in advance for any ideas and sorry if such question has been already asked.

  • #2
    Yes. See e.g. http://www.statalist.org/forums/foru...-actual-values and its references.

    Comment


    • #3
      Thank you for the links.

      However, I do not really understand what I am doing wrong.

      My code looks as follows:
      Code:
      . mylabels 0 (0.10) 0.50, myscale(1/@)  local(xla)
      . "0" 10 ".1" 5 ".2" 3.333333333333334 ".3" 2.5 ".4" 2 ".5"
      
      . pergram magrgdp, xla(`xla') generate (mapergram) recast (line)
      And still labels of x axis do not change but rather the whole graph changes as follows:

      Click image for larger version

Name:	Periodogram changes.png
Views:	1
Size:	98.8 KB
ID:	1386196

      Thank you in advance for any advise.

      Comment


      • #4
        You seem have labels and values the wrong way round. Your function is defined over about 0 to 0.5 but you want see reciprocals. Consider

        Code:
        mylabels 2 5 10 20 40, myscale(1/@) local(xla)

        Comment


        • #5
          I see my mistake now.

          Thanks a lot, now it works!

          Comment

          Working...
          X