Hi,

In a model I have two latent variables f1, f2, for example

Both f1 and f2 are vectors with length n. I want to model the auto-regression between them: f2 = some function of f1+ error.

It is straightforward to run a linear or polynomial regression: f_2= \mathrm{normal} ( \beta f_1, \tau).

Now I want to make it more flexible so I am using spline: f2 = B_spine (f1) + error.

The spine in stan is very slow for this use. I think the reason is that the spine basis function is reconstructed each time for a new value of f1. In contrast, in a spine regression, the basis function is fixed as long as the covariate X is fixed.

Is spine bad for modeling latent parameters? What is the good alternative (to a slow spine or a linear regression) for this purpose?

Thanks.