# Mismatch between priors and data
What's the deal with the posteriors.pdf plots for setariaWT?
## Vcmax:

- Prior in BETY says dist = lnorm, a = 3.75, b = 0.3, n = 12
- `query.trait.data()` also shows 3.75, 0.3, 12
- Prior in Vcmax.model.bug says ` beta.o ~ dlnorm (3.75, 11.1111111111111)#BBB`. This is just because BUGS paramaterizes distributions differentlly
- None of those are truncated at ~20 like in the plot above
Output of `query.trait.data()`:
```
2022-09-26 19:03:17 INFO [query.trait.data] : Vcmax
2022-09-26 19:03:17 INFO [query.trait.data] :
Median Vcmax : 24.367
```
This is pretty different from `median(rlnorm(100000, 3.75, 0.3))` (42.61)
Output of meta analysis:
<details>
```
------------------------------------------------
starting meta-analysis for:
Vcmax
------------------------------------------------
prior for Vcmax
(using R parameterization):
lnorm(3.75, 0.3)
data max: 33.587
data min: 14.572
mean: 24
n: 33
stem plot of data points
The decimal point is at the |
14 | 67
16 | 3993
18 | 024
20 | 80567
22 | 14
24 | 49069
26 | 235
28 | 3
30 | 06758
32 | 486
stem plot of obs.prec:
The decimal point is 2 digit(s) to the left of the |
0 | 00000000111111111111222234
0 | 55
1 |
1 | 689
2 |
2 |
3 | 3
3 |
4 | 2
Read 28 items
Compiling model graph
Resolving undeclared variables
Allocating nodes
Graph information:
Observed stochastic nodes: 66
Unobserved stochastic nodes: 11
Total graph size: 231
Initializing model
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100%
|**************************************************| 100%
Iterations = 1002:4000
Thinning interval = 2
Number of chains = 4
Sample size per chain = 1500
1. Empirical mean and standard deviation for each variable,
plus standard error of the mean:
Mean SD Naive SE Time-series SE
beta.ghs[2] 5.8939 6.527 0.084269 0.605218
beta.o 22.5960 3.908 0.050453 0.524178
beta.site[1] -1.1988 3.573 0.046125 0.515177
beta.site[2] -3.6076 4.346 0.056111 0.571501
beta.site[3] 1.0050 4.721 0.060941 0.312704
beta.trt[2] 9.0024 1.685 0.021759 0.051840
beta.trt[3] -3.2650 2.429 0.031353 0.038937
beta.trt[4] 0.2434 1.813 0.023410 0.044398
sd.site 4.5082 5.840 0.075394 0.576771
sd.trt 7.9614 8.151 0.105231 0.106347
sd.y 4.5453 0.318 0.004106 0.004568
2. Quantiles for each variable:
2.5% 25% 50% 75% 97.5%
beta.ghs[2] -11.7959 3.7225 7.6125 9.9905 14.4939
beta.o 17.7133 19.9710 21.3688 24.4605 32.3529
beta.site[1] -10.7692 -2.1732 -0.0981 0.5913 3.7577
beta.site[2] -14.5592 -5.9696 -1.9854 -0.2457 0.8886
beta.site[3] -7.2625 -0.7105 0.1354 2.0609 13.1585
beta.trt[2] 5.7321 7.8513 8.9890 10.1680 12.2848
beta.trt[3] -7.9935 -4.8725 -3.2776 -1.6559 1.5000
beta.trt[4] -3.2401 -0.9942 0.2183 1.4505 3.7676
sd.site 0.1239 0.7684 2.4657 6.1013 20.1850
sd.trt 2.8689 4.6978 6.4385 9.1335 22.2883
sd.y 3.9386 4.3262 4.5382 4.7598 5.1978
```
</details>
```
2022-09-26 19:17:33 WARN [check_consistent] :
CHECK THIS: Vcmax data and prior are inconsistent:
2022-09-26 19:17:33 INFO [check_consistent] :
Vcmax P[X<x] = 0.0107234090491143
```
## Cuticular cond

- Prior in BETY says dist = lnorm, a = 8.4, b = 0.9, n = 0
- `query.trait.data()` reports the same
- Prior in model.bug is ` beta.o ~ dlnorm (8.4, 1.23456790123457)#BBB` This is just because BUGS paramaterizes distributions differentlly
Output of `query.trait.data()`
```
2022-09-26 19:03:17 INFO [query.trait.data] : cuticular_cond
2022-09-26 19:03:17 INFO [query.trait.data] :
Median cuticular_cond : 30546
```
`median(rlnorm(100000, 8.4, 0.9))` = 4431.404, an order of magnitude less
- Less informative prior needed?
Output of meta analysis:
<details>
```
################################################
------------------------------------------------
starting meta-analysis for:
cuticular_cond
------------------------------------------------
prior for cuticular_cond
(using R parameterization):
lnorm(8.4, 0.9)
data max: 105286
data min: 157
mean: 32900
n: 33
stem plot of data points
The decimal point is 4 digit(s) to the right of the |
0 | 084556799
2 | 1111390112225599
4 | 36625
6 | 22
8 |
10 | 5
stem plot of obs.prec:
The decimal point is 9 digit(s) to the left of the |
0 | 000000000000000000000000000000000
Read 28 items
Compiling model graph
Resolving undeclared variables
Allocating nodes
Graph information:
Observed stochastic nodes: 66
Unobserved stochastic nodes: 11
Total graph size: 231
Initializing model
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100%
|**************************************************| 100%
Iterations = 1002:4000
Thinning interval = 2
Number of chains = 4
Sample size per chain = 1500
1. Empirical mean and standard deviation for each variable,
plus standard error of the mean:
Mean SD Naive SE Time-series SE
beta.ghs[2] 1.825e-01 10.1 0.1304 0.1299
beta.o 1.553e+04 10486.2 135.3768 1007.7992
beta.site[1] 2.600e+04 11239.3 145.0992 1010.9316
beta.site[2] 7.271e+03 10597.0 136.8070 937.4097
beta.site[3] 8.260e+03 10811.5 139.5762 951.8293
beta.trt[2] -1.115e+04 4717.3 60.9001 144.4650
beta.trt[3] -3.642e+03 5625.9 72.6298 93.2426
beta.trt[4] 2.564e+03 4297.7 55.4836 91.3477
sd.site 2.490e+04 21849.1 282.0704 1034.1102
sd.trt 1.104e+04 9343.6 120.6258 154.6123
sd.y 1.262e+04 505.0 6.5189 6.5158
2. Quantiles for each variable:
2.5% 25% 50% 75% 97.5%
beta.ghs[2] -19.16 -6.726 0.177 7.072 19.84
beta.o 1203.97 5806.015 14446.242 24365.430 35362.76
beta.site[1] 5083.49 16996.834 27032.461 35526.081 43717.37
beta.site[2] -12779.60 -1089.941 7629.391 15865.911 25207.22
beta.site[3] -11850.49 -215.555 8666.317 16828.692 27305.50
beta.trt[2] -20145.56 -14353.173 -11193.095 -8054.345 -688.12
beta.trt[3] -15721.92 -7243.949 -3241.985 27.388 6609.38
beta.trt[4] -5969.73 -140.868 2530.423 5330.714 11091.92
sd.site 5112.03 12145.340 19794.892 30371.012 76585.94
sd.trt 1897.80 6038.866 8948.105 13057.602 33412.90
sd.y 11656.55 12278.028 12616.671 12960.389 13629.63
```
</details>
```
2022-09-26 19:17:33 INFO [check_consistent] :
OK! cuticular_cond data and prior are consistent:
2022-09-26 19:17:33 INFO [check_consistent] :
cuticular_cond P[X<x] = 0.896820628855657
```
## Questions:
1. Which step in the workflow do these plots come from?
1. What is the difference between `post` and `approx` in these plots?
3. Which of them is being used in the model?
4. Is this related to "data contains untransformed statistics" ?