I need some help calculating the 90th percentile of a 3D vector within a JAGS model. This needs to be done to integrate 2 models, so that the output of the first model is used as a predictor in the second model. I am providing an example below of how could it be done using the mean, but I am interested in calculating the 90th percetile across one of the vector's dimension instead. Has anyone run into a similar situation before or know how to do this? I have been searching through the manual, but I could not figure out a way to achieve this.
Thank you very much in advance for your time.
All my best,
Alejandro
Example:
Model 1: the response variable is contained within a 3D array
Derived quantities from model 1. Summarising y across the z dimension. Here is my issue, I need to calculate the 90th percentile instead of the mean.
I then need to use the variable y[i,j,z] as a predictor in a model of only 1 dimension. To do that, I need to summarise the y variable across the dimension of interest. I am showing next an example taking the average.
for(zin1:Z){y.mean[z]<-mean(y[,,z])}
Model 2: using derived quantities from model 1 as a predictor in model 2
Then, I will use y.mean as a predictor in the next model. All this is done within one single hierarchical model, so the uncertainty is transferred.
Hi,
I need some help calculating the 90th percentile of a 3D vector within a JAGS model. This needs to be done to integrate 2 models, so that the output of the first model is used as a predictor in the second model. I am providing an example below of how could it be done using the mean, but I am interested in calculating the 90th percetile across one of the vector's dimension instead. Has anyone run into a similar situation before or know how to do this? I have been searching through the manual, but I could not figure out a way to achieve this.
Thank you very much in advance for your time.
All my best,
Alejandro
Example:
Model 1: the response variable is contained within a 3D array
Derived quantities from model 1. Summarising y across the z dimension. Here is my issue, I need to calculate the 90th percentile instead of the mean.
I then need to use the variable
y[i,j,z]
as a predictor in a model of only 1 dimension. To do that, I need to summarise they
variable across the dimension of interest. I am showing next an example taking the average.Model 2: using derived quantities from model 1 as a predictor in model 2
Then, I will use
y.mean
as a predictor in the next model. All this is done within one single hierarchical model, so the uncertainty is transferred.END OF EXAMPLE