Is it possible to use previously fit posterior samples in a downstream prediction task?

Let’s say I fit a multivariate normal model to K continuous response variables. Each response y_k is conditional on an *observed* continuous predictor x. The relationship between y and x can be expressed as follows:

- \mu(x) = a*x^r + b
- \sigma(x) = \kappa_1*(1+x*\kappa_2)

I fit the model with somewhat reasonable priors (see code below for example) and everything looks good. What if I return later with a new dataset of similar context. Here, y is observed, but x is unobserved. I want to predict x given y (and parameters \theta). This also means I want to put a prior on x in this new scenario.

Is there a way, using cmdstanr’s generated_quantities function to complete this task? Can I use samples from one model to inform this prediction task? Or do I need to do this in r for instance? I think where I am stuck is placing this prior on x. It’s easy enough to do posterior inference with previous samples, but I am unsure how to incorporate this prior information on this secondary prediction task. On one hand, this task could be seen as solving a system of equations. Although, the higher K, the more difficult this may be in say `optim()`

(nor is it Bayesian).

TLDR - I am trying to do Bayesian age estimation using samples from a model previously fit where x was observed.

Hope this makes sense and thank you for the help.

```
data{
int N; // # of individuals
int K; // # of responses
vector[K] y[N]; // vector of growth responses per individual
real X[N]; //age
}
parameters{
vector<lower=0>[K] a; // multiplicative constant
vector<lower=0>[K] r; // scaling parameter
vector[K] b; // offset
vector<lower=0>[K] s_scale; //constant noise
vector<lower=0>[K] kappa; // slope/gradient of linear noise function
cholesky_factor_corr[K] L_Omega; // cholesky factor the corr matrix for efficiency
}
transformed parameters{
vector[K] mu[N]; //mean array of size N containing vectors of length K
vector[K] s[N]; //sd array of size N containing vectors of length K
matrix[K,K] Sigma[N]; // cov array of size N with K x K cov matrices
for(i in 1:N){
for(k in 1:K){
mu[i,k] = a[k]*X[i]^(r[k])+b[k]; // mean function
s[i,k] = s_scale[k]*(1 + kappa[k]*X[i]); // sd function
}
}
for(i in 1:N){
Sigma[i] = diag_pre_multiply(s[i],L_Omega); // combining the cholesky corr matrix with the noise
}
}
model{
//priors
a ~ normal(0,10);
r ~ normal(0,1);
b ~ normal(0,10);
kappa ~ normal(0,1);
s_scale ~ exponential(2);
L_Omega ~ lkj_corr_cholesky(2);
for(i in 1:N){
y[i] ~ multi_normal_cholesky(mu[i], Sigma[i]); //likelihood
}
}
```