the data frame gdp
should be in time series for running BBQ function of BCDating package. the class is showing ts
but i am geting this error.
Please help.
Thanks in advance
code
df<- read.csv("gdp_us.csv")
tseries <- read.zoo(df)
tseries_ts <- as.ts(tseries)
gdp <- na.remove(tseries_ts)
dat <- BBQ(gdp, name="Dating Business Cycles of USA")
show(dat)
summary(dat)
plot(dat)
plot(dat,gdp_ts)
output
> tseries <- read.zoo(df)
> tseries_ts <- as.ts(tseries)
> gdp <- na.remove(tseries_ts)
> dat <- BBQ(gdp, name="Dating Business Cycles of USA")
Error in BCDating.peakstroughs(start = start(y), end = end(y), freq = frequency(y), :
frequency must be 12 (monthly dates) or 4 (quarterly dates)
> class(gdp)
[1] "ts"
sample data
|date|gdp|
|---|---|
|01-01-1947|1.24|
|01-04-1947|1.14|
|01-07-1947|1.45|
|01-10-1947|3.91|
|01-01-1948|2.26|
|01-04-1948|2.5|
|01-07-1948|2.37|
|01-10-1948|0.42|
|01-01-1949|-1.94|
|01-04-1949|-1.36|
|01-07-1949|0.56|
|01-10-1949|-0.84|
|01-01-1950|3.63|
|01-04-1950|3.29|
|01-07-1950|5.77|
|01-10-1950|3.69|
|01-01-1951|4.78|
|01-04-1951|2.35|
|01-07-1951|2.08|
|01-10-1951|1.35|
|01-01-1952|1.01|
|01-04-1952|0.34|
|01-07-1952|1.81|
|01-10-1952|3.44|
|01-01-1953|1.85|
|01-04-1953|0.96|
|01-07-1953|-0.15|
|01-10-1953|-1.35|
|01-01-1954|-0.16|
|01-04-1954|0.2|
|01-07-1954|1.25|
|01-10-1954|2.19|
|01-01-1955|3.23|
|01-04-1955|2.01|
|01-07-1955|2.02|
|01-10-1955|1.57|
|01-01-1956|0.6|
|01-04-1956|1.4|
|01-07-1956|1.15|
|01-10-1956|2.01|
|01-01-1957|1.98|
|01-04-1957|0.48|
|01-07-1957|1.56|
|01-10-1957|-0.97|
|01-01-1958|-1.57|
|01-04-1958|0.94|
|01-07-1958|2.85|
|01-10-1958|2.75|
|01-01-1959|2.11|
|01-04-1959|2.36|
|01-07-1959|0.45|
|01-10-1959|0.67|
|01-01-1960|2.59|
|01-04-1960|-0.29|
|01-07-1960|0.83|
|01-10-1960|-1|
|01-01-1961|0.88|