[R] graph together 4 series after HP filter

Sebastian Kruk residuo.solow at gmail.com
Tue Sep 6 15:40:18 CEST 2016

Dear R-users:

Let's see if you can help.

I have an matrix of class "ts" of 100 rows by 4 columns which called PP.

In each column I have the time series of quarterly GDP from 4 countries.

They applied the Hodrick -Prescott filter and now I want to plot
simultaneously cyclical component of the 4 countries and another window
graphed together the trend conponentes .

#If PP include the series of one country would do:
lambda <- 1600
DFIL <- hpfilter (PP, freq = lambda, type = "lambda" )
#First graph
plot(DFIL$x, plot.type = "single" col = 1:Countries , main = "Economy and
Trend" )
#Second graphic
plot(DFIL$cycle, plot.type = "single" col = 1:Countries, main = "Cycle" )
#A Deactivate the two graphics
pair(mfrow = c (1,1))

But I want to put on each graph window all the components'series.

Then I made first:
DFIL <- apply ( PP , 2, hpfilter , freq = lambda, type = "lambda" )
How can I graph all cyclical components together?



	[[alternative HTML version deleted]]

More information about the R-help mailing list