Title: | Business Cycle Dating and Plotting Tools |
---|---|
Description: | Tools for Dating Business Cycles using Harding-Pagan (Quarterly Bry-Boschan) method and various plotting features. |
Authors: | Majid Einian [aut, cre] |
Maintainer: | Majid Einian <[email protected]> |
License: | GPL-2 |
Version: | 0.9.8 |
Built: | 2024-11-04 06:19:52 UTC |
Source: | https://github.com/cran/BCDating |
This package implements the Harding and Pagan algorithm that creates a quarterly dating from a univariate time series. Procedures for printing and plotting appropriate graphs are provided. Also the dating for business cycles of the economy of Iran (by MBRI, CBI) is provided.
Package: | BCDating |
Type: | Package |
Version: | 0.9.8 |
Date: | 2019-01-06 |
License: | GPL-2 |
Depends: | methods |
Majid Einian,[email protected],
Monetary and Banking Research Institute, Central Bank of Islamic Republic of Iran
library(BCDating) data("Iran.non.Oil.GDP.Cycle") dat <- BBQ(Iran.non.Oil.GDP.Cycle, name="Dating Business Cycles of Iran") show(dat) summary(dat) plot(dat) plot(dat,Iran.non.Oil.GDP.Cycle) data("MBRI.Iran.Dating") plot(MBRI.Iran.Dating)
library(BCDating) data("Iran.non.Oil.GDP.Cycle") dat <- BBQ(Iran.non.Oil.GDP.Cycle, name="Dating Business Cycles of Iran") show(dat) summary(dat) plot(dat) plot(dat,Iran.non.Oil.GDP.Cycle) data("MBRI.Iran.Dating") plot(MBRI.Iran.Dating)
This function returns the averages of the input time series over each of phases in the Dating. It omits the NA's in the time series, so will give an error with internal NA's.
avgts(ts,Dating)
avgts(ts,Dating)
ts |
The input time series. |
Dating |
The dating. |
A ts timeseries.
Majid Einian,[email protected],
Monetary and Banking Research Institute, Central Bank of Islamic Republic of Iran
data("Iran.non.Oil.GDP.Quarterly.Growth") data("MBRI.Iran.Dating") avggrowth <- avgts(Iran.non.Oil.GDP.Quarterly.Growth,MBRI.Iran.Dating) cbind(avggrowth,Iran.non.Oil.GDP.Quarterly.Growth) plot(MBRI.Iran.Dating,avggrowth) plot(MBRI.Iran.Dating,Iran.non.Oil.GDP.Quarterly.Growth,averages=TRUE)
data("Iran.non.Oil.GDP.Quarterly.Growth") data("MBRI.Iran.Dating") avggrowth <- avgts(Iran.non.Oil.GDP.Quarterly.Growth,MBRI.Iran.Dating) cbind(avggrowth,Iran.non.Oil.GDP.Quarterly.Growth) plot(MBRI.Iran.Dating,avggrowth) plot(MBRI.Iran.Dating,Iran.non.Oil.GDP.Quarterly.Growth,averages=TRUE)
This function implements the Harding and Pagan algorithm that creates a quarterly dating from a univariate time series.
BBQ(y, mincycle = 5, minphase = 2, name = "")
BBQ(y, mincycle = 5, minphase = 2, name = "")
y |
The input time series. |
mincycle |
Minimum length of a cycle. default=5 |
minphase |
Minimum length of a phase of a cycle.default=2 |
name |
The name of the series or dating. |
See Reference paper.
An object of class "BCDating". You can use show(), summary(), window(), and plot() on it.
Majid Einian,[email protected],
Monetary and Banking Research Institute, Central Bank of Islamic Republic of Iran
Franck Arnaud ,
National Institute of Statistics and Economic Studies (INSEE), France
Harding, D. and Pagan A. 2002 "Dissecting the Cycle: A Methodological Investigation." Journal of Monetary Economics 49 (2), 365–381. http://www.sciencedirect.com/science/article/pii/S0304393201001088.
data("Iran.non.Oil.GDP.Cycle") dat <- BBQ(Iran.non.Oil.GDP.Cycle, name="Dating Business Cycles of Iran") show(dat) summary(dat) plot(dat) data(MBRI.Iran.Dating) plot(dat,MBRI.Iran.Dating)
data("Iran.non.Oil.GDP.Cycle") dat <- BBQ(Iran.non.Oil.GDP.Cycle, name="Dating Business Cycles of Iran") show(dat) summary(dat) plot(dat) data(MBRI.Iran.Dating) plot(dat,MBRI.Iran.Dating)
"BCDating"
Class Designed for dating Business Cycles
A BCDating is basically is a sequence of peaks and troughs. But it can also be represented as a discrete state process, with values such as -1 for recession and 1 for expansion phases. The BCDating class is designed to handle this kind of data: it can store, print and plot graphs of such data.
Use BBQ to create object of BCDating type from Quarterly Data.
name
:Object of class "character"
The name of the Dating
states
:Object of class "ts"
States of the Dating (-1 for recession and 1 for expansion phases)
peaks
:Object of class "numeric"
Indices of Peaks
troughs
:Object of class "numeric"
Indices of Throughs
y
:Object of class "ts"
The Refernce Time Series (e.g. the GDP Cycle)
param
:Object of class "list"
Parameters of the Dating (i.e. min phase and min cycle)
type
:Object of class "character"
Dating Type
plot,BCDating,ts-method
,
plot,ts,BCDating-method
,
plot,BCDating,BCDating-method
,
plot,list,missing-method
Majid Einian,[email protected],
Monetary and Banking Research Institute, Central Bank of Islamic Republic of Iran
Franck Arnaud ,
National Institute of Statistics and Economic Studies (INSEE), France
Franck Arnaud's R package datation
Cycle of non-Oil GDP of Iran. (Non-Oil GDP after x12, and HP filtering)
Iran.non.Oil.GDP.Cycle
Iran.non.Oil.GDP.Cycle
ts Quarterly Time Series
Central Bank of Islamic Republic of Iran. Further calculations by Majid Einian
Einian, M. and M. Barakchian (2014), Measuring and Dating Business Cycles of the Economy of Iran, Journal of Monetary & Banking Research, 7(20), Summer 2014, pp. 161-194. (in Persian)
Quartely Grwoth of non-Oil GDP of Iran. (after x12)
Iran.non.Oil.GDP.Quartely.Grwoth
Iran.non.Oil.GDP.Quartely.Grwoth
ts Quarterly Time Series
Central Bank of Islamic Republic of Iran. Further calculations by Majid Einian
Einian, M. and M. Barakchian (2014), Measuring and Dating Business Cycles of the Economy of Iran, Journal of Monetary & Banking Research, 7(20), Summer 2014, pp. 161-194. (in Persian)
This is the official Dating of Business Cycles of Iran by MBRI. This is not exactly what you get using BBQ
on Iran.non.Oil.GDP.Cycle
as there are some changes to that based on other economic facts. See reference paper for details.
data(MBRI.Iran.Dating)
data(MBRI.Iran.Dating)
BCDating Object
Einian, M. and M. Barakchian (2014)
Einian, M. and M. Barakchian (2014), Measuring and Dating Business Cycles of the Economy of Iran, Journal of Monetary & Banking Research, 7(20), Summer 2014, pp. 161-194. (in Persian)
data(MBRI.Iran.Dating) plot(MBRI.Iran.Dating)
data(MBRI.Iran.Dating) plot(MBRI.Iran.Dating)
Methods for function plot
. Some arguments are not applicable to all methods, but most are common.
dates |
If |
yearrep |
Number of digits a year is represented if dates are plotted (i.e. |
col.bg |
Background Color of Dating plot (i.e. the color for periods with unknown cycle state). default=gery(0.8) |
col.exp |
Color for Expansions. default=grey(1) |
col.rec |
Color for Recessions. default=grey(0.45) |
main |
Main Title of the Plot, if not provided, the name of the Dating will be used. default="" |
xlab |
Label of the X axis. default="" |
ylab |
Label of the Y axis. default="" |
lwd |
The line Width. default=2 |
cex |
Relative magnification factor. default=0.5 |
vert |
A vector of dates in which vertical lines should be plotted. default=NULL |
col.vert |
Color of added vertical lines. default="darkblue" |
windos |
If |
averages |
If |
col |
Color of each of the time series plotted. This can be either a vector with the length equal to number of time series in mts object, or just a single value, which would be used for all time series. default="red" |
signature(x = "BCDating", y = "missing")
Plots a BCDating.
signature(x = "BCDating", y = "ts")
Plot a Time-Series, (or multiple time serires in case y's class is mts) on a BCDating.
signature(x = "ts", y = "BCDating")
Plot a Time-Series, (or multiple time serires in case y's class is mts) on a BCDating.
signature(x = "BCDating", y = "BCDating")
Plots 2 BCDatings, so you can compare them.
signature(x = "list", y = "missing")
Plots a list of BCDating Objects, so you can compare them.
Majid Einian,[email protected],
Monetary and Banking Research Institute, Central Bank of Islamic Republic of Iran
Franck Arnaud ,
National Institute of Statistics and Economic Studies (INSEE), France
library(BCDating) data("MBRI.Iran.Dating") plot(MBRI.Iran.Dating) plot(MBRI.Iran.Dating,dates=TRUE) data("Iran.non.Oil.GDP.Cycle") plot(MBRI.Iran.Dating,Iran.non.Oil.GDP.Cycle) plot(Iran.non.Oil.GDP.Cycle,MBRI.Iran.Dating) data("Iran.non.Oil.GDP.Quarterly.Growth") plot(MBRI.Iran.Dating,Iran.non.Oil.GDP.Quarterly.Growth,averages=TRUE) plot(MBRI.Iran.Dating,cbind(Iran.non.Oil.GDP.Cycle*100,Iran.non.Oil.GDP.Quarterly.Growth)) dat <- BBQ(Iran.non.Oil.GDP.Cycle, name="Dating Business Cycles of Iran") plot(dat,MBRI.Iran.Dating) plot(list(dat,MBRI.Iran.Dating))
library(BCDating) data("MBRI.Iran.Dating") plot(MBRI.Iran.Dating) plot(MBRI.Iran.Dating,dates=TRUE) data("Iran.non.Oil.GDP.Cycle") plot(MBRI.Iran.Dating,Iran.non.Oil.GDP.Cycle) plot(Iran.non.Oil.GDP.Cycle,MBRI.Iran.Dating) data("Iran.non.Oil.GDP.Quarterly.Growth") plot(MBRI.Iran.Dating,Iran.non.Oil.GDP.Quarterly.Growth,averages=TRUE) plot(MBRI.Iran.Dating,cbind(Iran.non.Oil.GDP.Cycle*100,Iran.non.Oil.GDP.Quarterly.Growth)) dat <- BBQ(Iran.non.Oil.GDP.Cycle, name="Dating Business Cycles of Iran") plot(dat,MBRI.Iran.Dating) plot(list(dat,MBRI.Iran.Dating))
Methods for function show
signature(object = "BCDating")
Shows the dates of peaks and troughs of the BCDating.
Majid Einian,[email protected],
Monetary and Banking Research Institute, Central Bank of Islamic Republic of Iran
Franck Arnaud
library(BCDating) data("MBRI.Iran.Dating") MBRI.Iran.Dating
library(BCDating) data("MBRI.Iran.Dating") MBRI.Iran.Dating
Methods for function summary
signature(object = "BCDating")
Lists the start and end dates of recessions and expansions in a BCDating, their duration, amplitude ,... Also the average duration of expansions and recessions are printed.
Majid Einian,[email protected],
Monetary and Banking Research Institute, Central Bank of Islamic Republic of Iran
Franck Arnaud
Methods for function window
signature(x = "BCDating")
Sometimes you need to know the state of economics in just a period of time. Using Window, you can obtain a new BCDating object limited to the time period mentioned. See examples.
Majid Einian,[email protected],
Monetary and Banking Research Institute, Central Bank of Islamic Republic of Iran
library(BCDating) data(MBRI.Iran.Dating) MBRI.Iran.Dating window(MBRI.Iran.Dating,start=c(1368,2),end=c(1376,1)) # 5th and 6th Gov's of IRI
library(BCDating) data(MBRI.Iran.Dating) MBRI.Iran.Dating window(MBRI.Iran.Dating,start=c(1368,2),end=c(1376,1)) # 5th and 6th Gov's of IRI