# [R] graph together 4 series after HP filter

Bert Gunter bgunter.4567 at gmail.com
Tue Sep 6 16:45:13 CEST 2016

```?lines
?points

to add to an existing base graphics graph. There are other ways to do
this in the other graph systems (ggplot, lattice,...) used in R.

Cheers,
Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Tue, Sep 6, 2016 at 6:40 AM, Sebastian Kruk <residuo.solow at gmail.com> wrote:
> 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.
>
> DFIL <- apply ( PP , 2, hpfilter , freq = lambda, type = "lambda" )
> How can I graph all cyclical components together?
>
> Regards,
>
> Sebastian.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help