KFAS icon indicating copy to clipboard operation
KFAS copied to clipboard

Change "data" in an already defined SSModel

Open trickster opened this issue 8 years ago • 2 comments

Is there a way where we can change underlying data specified in SSModel function or copy the entire contents of the model into a new model and specify new data then?

trickster avatar May 18 '16 09:05 trickster

Hmm, haven't though about this before. The data argument is used only when building the observations and the system matrices in SSModel, and that is not actually stored in the output model at all. The call to SSModel is stored though, so you could manipulate that before the re-evaluation of that call. Using the stored call, I think it would be pretty straightforward to make a function which takes a SSModel object and new data object, and then returns a model identical to the original model except with new data. At least for some special cases...

helske avatar May 23 '16 09:05 helske

Thanks for your reply. I had to rerun the model with the less data by extracting the list of variables and model structure using attr(model.in$terms,"variables") from the old model.

This would be a nice enhancement though.

trickster avatar May 23 '16 15:05 trickster