nmecsys / BETS

Package to obtain and analyze thousands of Brazilian economic time series
GNU General Public License v3.0
38 stars 13 forks source link
package r

BETS

Build Status Build Status CRAN\_Status\_Badge downloads Github Stars GitHub repo size in bytes CRAN

Screenshot

:exclamation: Please read this carefully before using the latest BETS version (0.4.4)

The package went through considerable changes.

BETS - Brazilian Economic Times Series

Installation

# cran version
install.packages("BETS") 
# dev version
devtools::install_github("nmecsys/BETS")

Usage

library(BETS)

:exclamation: Important (update 0.4.2)

  1. BETS package underwent major changes in response to R Journal's reccomendations:
    • New function names (see table below)
    • Database onnection credentials are now encrypted
    • Sample data was included in /data, to allow the user to run examples even when offline, or when our server is down.
Old name New name
BETS.search BETSsearch
BETS.get BETSget
BETS.chart chart
BETS.save.sas saveSas
BETS.save.stata saveStata
BETS.save.spss saveSpss
BETS.corrgram corrgram
BETS.dashboard dashboard
BETS.deflate deflate
BETS.dummy dummy
BETS.grnn.test grnn.test
BETS.grnn.train grnn.train
BETS.normalize normalize
BETS.predict predict
BETS.report report
BETS.sidra.get sidraGet
BETS.sidra.search sidraSearch
BETS.std_resid std_resid
BETS.t_test t_test
BETS.ur_test ur_test
  1. Package forecast's newest version (8.3) contains a bug in ndiffs. An error arises when trying to run Augmented Dickey-Fuller (ADF) tests. Therefore, BETS' report function does not work properly if the user opt for SARIMA analysis with ADF tests. A solution is to install forecast 8.2:
remove.packages("forecast")
install.packages("devtools")
devtools::install_version("forecast", version = "8.2", type = "source")

Using BETS in python

import rpy2.robjects as ro
import pandas as pd
from rpy2.robjects.packages import importr
from rpy2.robjects import pandas2ri
from rpy2.robjects.conversion import localconverter

# Getting Industrial Production (2002 = 100) - Rio de Janeiro

bets = importr("BETS")
dados = bets.BETSget(code=11081, data_frame=True)

with localconverter(ro.default_converter + pandas2ri.converter):
    pim_rj = ro.conversion.rpy2py(dados)

print(pim_rj)