Announcement

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

  • Time Series - correlation between two time series

    Hello, I'm reading the book "Introduction to Time Series Using Stata" (by Sean Becketti) and had a question relating to the section below. The author is calculating the correlation between the change unemployment rate and the change in nonfarm payroll employment from Jan 1950 to Jan 2012. I'd like to adopt this approach on my own time series data, but am not exactly sure of their approach. When it says "change in the unemployment rate" and "change in nonfarm payroll employment" -> how is that calculated? For example, does one calculate the first order difference? (difference between each time point and the time point before?) Thank you for any thoughts!

    Click image for larger version

Name:	timeseries.jpg
Views:	1
Size:	107.1 KB
ID:	1770024

  • #2
    Yes, it refers to the first difference in time series analysis, which involves calculating the change in a variable between two consecutive time periods.

    By downloading the monthly data for "All Employees: Total Nonfarm," also known as Total Nonfarm Payroll (measured in thousands of persons, seasonally adjusted), and the monthly unemployment rate (percent, seasonally adjusted) from FRED (Federal Reserve Economic Data), you can replicate the graph.

    Below is a brief section of the data and the graph using the full dataset.


    Code:
    clear
    input long PAYEMS double UNRATE
    43526 6.5
    43297 6.4
    43954 6.3
    44382 5.8
    44718 5.5
    45083 5.4
    45454 5.0
    46192 4.5
    46438 4.4
    46706 4.2
    46776 4.2
    46861 4.3
    47288 3.7
    47577 3.4
    47873 3.4
    47861 3.1
    47952 3.0
    48064 3.2
    48061 3.1
    48012 3.1
    47954 3.3
    48006 3.5
    48147 3.5
    48314 3.1
    48296 3.2
    48522 3.1
    48504 2.9
    48620 2.9
    48642 3.0
    48282 3.0
    48143 3.2
    48924 3.4
    49320 3.1
    49597 3.0
    49816 2.8
    50166 2.7
    50144 2.9
    50339 2.6
    50473 2.6
    50435 2.7
    50490 2.5
    50519 2.5
    50536 2.6
    50489 2.7
    50368 2.9
    50240 3.1
    49908 3.5
    49703 4.5
    49469 4.9
    49382 5.2
    49157 5.7
    49179 5.9
    48965 5.9
    48895 5.6
    48835 5.8
    48826 6.0
    48886 6.1
    48942 5.7
    49180 5.3
    49331 5.0
    49496 4.9
    49644 4.7
    49962 4.6
    50248 4.7
    50512 4.3
    50790 4.2
    50987 4.0
    51111 4.2
    51266 4.1
    51429 4.3
    51592 4.2
    51805 4.2
    51975 4.0
    52167 3.9
    52294 4.2
    52375 4.0
    52506 4.3
    52586 4.3
    51955 4.4
    52631 4.1
    52604 3.9
    52777 3.9
    52821 4.3
    52929 4.2
    52887 4.2
    53097 3.9
    53156 3.7
    53238 3.9
    53150 4.1
    53067 4.3
    53123 4.2
    53128 4.1
    52934 4.4
    52763 4.5
    52558 5.1
    52384 5.2
    52076 5.8
    51576 6.4
    51299 6.7
    51027 7.4
    end
    
    g date=_n
    
    tsset date
    
    g change_payems=d.PAYEMS
    
    g change_unrate=d.UNRATE
    
    scatter change_unrate change_payems, yline(0) xline(0) ytitle("Change in unemployment rate") xtitle("Change in nonfarm payroll(1000s)")


    Click image for larger version

Name:	Graph_scatter.png
Views:	1
Size:	53.7 KB
ID:	1770029

    Comment


    • #3
      This is so helpful, thank you!!

      Comment

      Working...
      X