bb.dating.states {bbdetection} | R Documentation |
Prints out the dating of bull-bear states
Description
This function prints out (in console window) the dating of bull-bear states. The outcome of this function is a table in LaTeX format.
Usage
bb.dating.states(price, bull, dates)
Arguments
price |
a numeric vector of price values |
bull |
a logical vector that contains the states of the market. This vector
is returned by function |
dates |
a vector of dates |
Value
A data frame object that contains the dating of bull-bear states.
Examples
{
library(zoo)
library(xtable)
library(ggplot2)
sp500 <- sp500m # choose the monthly data
dates <- index(sp500) # retrieve dates
dates <- as.yearmon(dates) # convert dates to "yearmon" format if monthly data
price <- as.vector(coredata(sp500)) # retrieve prices
setpar_dating_alg(4, 6, 4, 16, 20) # parameters for monthly data
bull <- run_dating_alg(price) # detect the states
bb.dating.states(price, bull, dates)
}
[Package bbdetection version 1.0 Index]