# [Help] Hierarchical logistic regression with time-varying coefficients

Hi, has anyone seen any Stan example of hierarchical logistic regression with time-varying coefficients, captured by a dynamic linear model (Kalman filter type) process? Thanks.

Does this help Example von Bertalanffy model (and hierarchical logistic regression and linear regression) as a starting point?

1 Like

Check out Eric Ward’s course Applied Time Series Analysis (atsa-es.github.io)

He has moved much of the R MARSS package to Stan models that are part of the course he co-teaches (the above link goes to those packages as well).

Edit: I think this model example might be what you are looking for: atsar | Applied time series analysis in R with Stan. Allows fast Bayesian fitting of multivariate time-series models. (atsa-es.github.io)

2 Likes

Thanks for the replies thus far. Let me try to write down the model I have in mind:

Y[i, t]: binary outcome (1/0) for period i at time t
Y[i, t] = P( A[i, t] )
P(.) = inverse-logit
A[i, t+1] = A[i, t] + e[i, t+1]
e[i, t] ~ N ( 0, s ), for all t
A[i, 0] ~ N ( pop_A, pop_s )

I call this a hierarchical logistic time-varying random intercept model. Thanks.

I’m not sure what you are trying to do. But, if you want to do a latent, binary variable, your model seems similar to an occupancy model.

Checkout this package I have written as well: UMESC / quant-ecology / occStan · GitLab (usgs.gov)

As a tip, I suggest these steps:

1. Writing out the math of your model