Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reg_td with user-defined calendar #10

Open
AQLT opened this issue Dec 30, 2023 · 1 comment
Open

reg_td with user-defined calendar #10

AQLT opened this issue Dec 30, 2023 · 1 comment

Comments

@AQLT
Copy link

AQLT commented Dec 30, 2023

It could be good to be able to use reg_td() with user-defined calendar. Currently, the trading-days regressors and the covariance structure are built inside Java, however they could be directly provided in R (the covariance structure could for example be built using the generateVar function). I don't think it is possible to do this with the other functions.

@palatej
Copy link
Collaborator

palatej commented Apr 19, 2024

Hi Alain,

Internally, the code inside reg_td generates the regression variables and the covariance of the innovations, if the coefficients are variable (multivariate random walk). Generating the regression variables can be easily done with the routines provided in rjd3toolkit, included in the case of calendars with holidays.

See below:

y<-log(rjd3toolkit::retail$BookStores)

model1<-rjd3sts::model()
sarima<-rjd3sts::sarima('arima', 12, orders=c(0,1,1), seasonal=c(0,1,1))
td<-rjd3sts::reg_td('td', 12, start(y), length(y), variance=0, fixed=TRUE)

rjd3sts::add(model1, sarima)
rjd3sts::add(model1, td)

rslt1<-rjd3sts::estimate(model1, y)

print(rjd3toolkit::result(rslt1, 'likelihood.ll'))
model2<-rjd3sts::model()

xtd<-rjd3toolkit::td(12, start(y), length(y))
td<-rjd3sts::reg('td', xtd)

rjd3sts::add(model2, sarima)
rjd3sts::add(model2, td)

rslt2<-rjd3sts::estimate(model2, y)
print(rjd3toolkit::result(rslt2, 'likelihood.ll'))

So, the most flexible solution would be to generate covariance matrices based on different specifications and to use the "reg" method. Of course, a solution hiding all the details can also be provided (a "reg_calendartd" function).
Considering that different covariance matrices could be used, I will add both solutions in the next rjd3sts package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants