Hi,
I’m working on a hierarchical model which has measurement-specific antibody levels for different individuals. There are two sets of measurements collected at two different periods of time for all the individuals. So we expect that there should be measurement error bias because of some changes that might have occurred in the mode of measurement in the second period as compared to the first time. The traditional approach would be to estimate the parameters for each set of measurements independently, using the data for each. But I need to use a hierarchical model for this problem. I generated synthetic data with 50 measurements and 100 individuals where the first 30 measurements have a different measurement error (with zero mean) from the last 20 measurements (which has a non-zero mean). And I’m looking at how the hierarchical model for this problem would look in order to properly estimate the parameters of the model from the data. I have attached my code for this. Not all parameters were well estimated when I tried and I guess it could be a problem of how I formulated the model. I have attached the code and the simulated data as well as the plot of the simulated data. I would appreciate your timely assistance and guidance on how to solve this.
True values are:
beta=-10
muu=200
sigmau=1
mug_2=15
sigmag_1=4
sigmag_2=0.5
BR, Miracle
Diff_measurement_errors.csv (82.6 KB)
Diff_measurement_errors_2.csv (82.6 KB)
Case_2_hierarchy_R.R (920 Bytes)
Case2_hierarchy.stan (982 Bytes)