The 'Brazil Risk' numbers, published daily by the Brazilian Institute of Geography and Statistics from JP Morgan's Emerging Market Bond Index, are a time-series spanning 1994 to the present, and are a great source of data to use for the teaching of time series with R.

Forecasting with riscoBrasil

The data returned from riscoBrasil() can be used with a variety of packages and functions. In this example, I'll use facebook's new prophet package.

if(!require(prophet)) install.packages("prophet", 
                                       repos = "http://cran.us.r-project.org")
library(prophet)
library(riscoBrasil)

series <- riscoBrasil(start = "2002-01-01")

colnames(series) <- c("ds", "y")   # for prophet to work
model <- prophet(series)
future <- make_future_dataframe(model, periods = 365)
forecast <- predict(model, future)
plot(model, forecast)

Interestingly, prophet is prophetising an uptick in Brazil Risk.



RobertMyles/riscoBrasil documentation built on May 5, 2019, 11:05 p.m.