Single model for inferring multiple independant variables

Hello,

I’m curious if there is an easy way to infer multiple different parameters that are independent of one another. Is there a way I can use multiple “target” in one program?

Yup, you just put them all in one model. So if you had one model for a:

data{
  int n_a ;
  vector[n_a] a_obs ;
}
parameters{
  real a ;
}
model{
  a ~ //prior for a here
  a_obs ~ normal(a,1) ;
}

And another for b:

data{
  int n_b ;
  vector[n_b] b_obs ;
}
parameters{
  real b ;
}
model{
  b ~ //prior for b here
  b_obs ~ normal(b,1) ;
}

You just combine them:

data{
  int n_a ;
  vector[n_a] a_obs ;
  int n_b ;
  vector[n_b] b_obs ;
}
parameters{
  real a ;
  real b ;
}
model{
  a ~ //prior for a here
  a_obs ~ normal(a,1) ;
  b ~ //prior for b here
  b_obs ~ normal(b,1) ;
}

Now, you won’t see any benefit from doing it this way; usually folks model things in the same model when there is reason to believe they mutually-inform, in which case structures like correlations are used to implement said mutual-informativity.

2 Likes