helske / KFAS

KFAS: R Package for Exponential Family State Space Models
64 stars 17 forks source link

Requests - Options for no intercepts and not storing data #33

Closed rmendels closed 5 years ago

rmendels commented 5 years ago

I am working on some large, complex models, and to do so I am using SSMCustom(). But when I do so, intercepts are automatically added, even though I don't want them, and there doesn't appear to be an option to suppress them. It would be nice if a custom SSM is just that, where I can define all the elements without having anything else added, or at least to have the option to do so.

Also by default, KFS() stores the data in the return. For a very large problem, I would like to have the option to not have the data stored, but read from the data array. Without this option, I have two copies of the data in memory, and while the data array might fit into memory, 2 copies of it may well push the limits.

Thanks,

-Roy

helske commented 5 years ago

For removing intercept, just use -1 in the formula like when using lm etc, i.e. SSModel(y ~ -1 + SSMcustom(...)).

Good point about the data copy, I actually though that there was an argument for that but apperently not. I'll add new argument, with a warning that the output will not be compatible with many other functions anymore.

rmendels commented 5 years ago

Thanks for the info about the -1 option. I must have missed that in the docs. I saw and option for SSMRegression but missed that.

And I hope the data store will be an option. For univariate or small problems it is actually a nice feature, but if I have a few thousand series at say 500 the periods I would prefer that they not be stored.

Thanks again for your work on KFAS

helske commented 5 years ago

Thanks, new version is now on CRAN. KFS now has an argument return_model which is by default TRUE. Couple methods (namely residual methods) could be easily tweaked so that they accept separate model argument in case the output of KFS does not contain it, but I didn't do that (yet).

rmendels commented 5 years ago

Got it. Thanks.