1
$\begingroup$

I am using KFAS to fit a dynamic logistic model of the form;

$\hat{y} = \bf \beta_t x + \epsilon$

$\beta_t = \beta_{t-1} + \eta$

So the regression parameters change over time, and act as latent variables to be estimated by the filter.

Can state space models of this form generally accept situations where we have multiple observations per time period? I believe they can, but I can't figure out how to specify this in KFAS (or any other R package for that matter).

I've tried the below code, but KFAS thinks that this means there are 22 time periods - there are actually only ten.

library(KFAS)
y = c(1,0,0,0,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1,1,0,1)
i = seq.Date(from = as.Date("2014-01-01"), as.Date("2014-01-10"), length.out = 22)
x = rnorm(n = 22, mean = 1, sd = 2)

a =   model = SSModel(y ~ 
                    SSMregression(~x),
                  distribution = "binomial")

fit = fitSSM(a, inits = c(0,0))
$\endgroup$

closed as off-topic by mdewey, Michael R. Chernick, kjetil b halvorsen, jbowman, Reinstate Monica Nov 1 '18 at 17:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – mdewey, Michael R. Chernick, kjetil b halvorsen, jbowman, Reinstate Monica
If this question can be reworded to fit the rules in the help center, please edit the question.

0
$\begingroup$

as you have given 22 normally generated values to x , KFAS would take 22 time periods only. What else do u expect?

You can add multiple observation in rformula.
SSMregression(rformula, data, type, Q, index, R, a1, P1, P1inf, n = 1, remove.intercept = TRUE, state_names = NULL, ynames)

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.