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

daily time series data runs very slow on SSM #47

Closed
suprajamalladi opened this issue Aug 14, 2020 · 4 comments
Closed

daily time series data runs very slow on SSM #47

suprajamalladi opened this issue Aug 14, 2020 · 4 comments

Comments

@suprajamalladi
Copy link

Hello,
i have tried analyzing data of all frequencies in KFAS and daily data runs extremely slow and almost takes about 3 hours most of the time to stop running. i have used frequency of 365 and 250 to exclude all the holidays when analyzing stock price data and it is the same. is there a way to get results faster?

@helske
Copy link
Owner

helske commented Aug 17, 2020

Hard to say based on what you write, how many data points do you have and how long is the state vector? Is your model gaussian or non-gaussian?

@suprajamalladi
Copy link
Author

sorry I didn't give you the details earlier. The dataset has 1800 points. the model is gaussian and the model has 4 parameters: level, trend, seasonal, variance (H). Below is my model:

model <-SSModel(data.1~SSMtrend(2,Q=list(NA,NA))+
SSMseasonal(period=251,sea.type='dummy',Q=NA),data=data.1,H=NA)

ownupdatefn <- function(pars,model,...){
model$H[] <- exp(pars[1])
diag(model$Q[,,1])[1:3]<- exp(c(pars[2],pars[3],pars[4]))
model }

kfasfit <-fitSSM(inits=rep(log(var(data.1)),4), model=model, updatefn=ownupdatefn,method='BFGS')

@helske
Copy link
Owner

helske commented Aug 18, 2020

Ok, the issue is in your seasonal component, you have 250+ states which will slow down the recursions. You could try this kind of approach: https://robjhyndman.com/hyndsight/longseasonality/ (you can find the fourier function from the forecast package). Another option would be to use cyclic component (``SSMcycle`), but that is of course theoretically bit different thing than the seasonal component.

@suprajamalladi
Copy link
Author

thank you for your response! I will try out your suggestions and check.

@helske helske closed this as completed Dec 16, 2020
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