DeirdreLoughnan / Treetraits

0 stars 0 forks source link

Issues with small trait values #6

Open DeirdreLoughnan opened 9 months ago

DeirdreLoughnan commented 9 months ago

While the model seems to run fine for height and DBH, models for SSD, LMA, and C:N (which have much smaller trait values) seem to have some issues in estimating the betaTraitxCue parameters.

In the model code, these are the parameters that link the trait part of the model to the phenology part of the model:

betaForceSp[isp] = alphaForceSp[isp] + betaTraitxForce * (b_muSp[isp]);

To try to test whether it simply a scaling issue, I have tried several approaches: 1. z-score everything (using 2 sd, given that I am z-scoring a 0/1 dummy variable, 2. Multiply LMA by 100, so it is on the same scale as models that seem to be working (like height), 3. Running the height model on a smaller scale, if scaling really is the issue then small values of the height model should cause the same issue.

Generally speaking, I think the model was constrained by the priors. I didn't have an intuitive sense of what a reasonable values for the betaTraitxCue parameter should be, so I was relying on what we did for the traitors model, but perhaps this was too short sighted. Really big priors seem to fix the issue.

  1. z-score everything (using 2 sd, given that I am z-scoring a 0/1 dummy variable Traitors mdl prior for betaTraitxCue parameters: (0,1)
                       mean        X2.5.         X25.         X50.        X75.     X97.5.
b_tranE           0.1923484   0.09628079   0.15876868   0.19226044   0.2251363  0.2873309
b_tranlat         0.9446965   0.71932526   0.86401638   0.94494939   1.0225595  1.1746737
muForceSp        -9.5327939 -11.31937731 -10.11382396  -9.53138854  -8.9334630 -7.7993912
muChillSp       -12.8475616 -16.04144092 -13.93452382 -12.87894465 -11.7768004 -9.6354592
muPhotoSp        -3.6075168  -4.59260176  -3.95941094  -3.60294184  -3.2588354 -2.6065229
muPhenoSp        27.0066566  24.04679025  26.04701244  26.99307870  27.9901386 29.8300378
betaTraitxForce  -0.1708870  -2.11793931  -0.83627033  -0.16692780   0.5103448  1.7141370
betaTraitxChill  -0.0709632  -1.98214801  -0.73871118  -0.08206047   0.5907948  1.8511940
betaTraitxPhoto   0.6972755  -1.02542863   0.09616897   0.69314728   1.2933904  2.4139675
sigma_traity      0.4225833   0.40589083   0.41689206   0.42240759   0.4281990  0.4397854
sigma_sp          0.2604721   0.20571699   0.23764171   0.25714983   0.2803154  0.3306474
sigmaForceSp      5.2585199   4.07819025   4.76942462   5.21761882   5.6649145  6.7651808
sigmaChillSp      9.5560155   7.41560317   8.67735009   9.44308860  10.3191992 12.2792722
sigmaPhotoSp      2.3452275   1.45968100   2.00140748   2.31333475   2.6565299  3.3676038
sigmaPhenoSp      9.7375048   7.99296645   8.97937846   9.63759120  10.3784838 12.0101487
sigmapheno_y      9.4967482   9.28816440   9.42247920   9.49436977   9.5708587  9.7131216

betaTraitxCue_z2AllParam_0_1

1b. Running the z-scored model with a huge prior for the betaTraitCue parameters (0,25). This produced very different estimates for the betaTraitCue parameters, but fairly similar estimates for everything else:

                       mean       X2.5.        X25.        X50.        X75.     X97.5.
b_tranE           0.2254200   0.1200184   0.1899698   0.2257417   0.2614880  0.3275314
b_tranlat         0.9400718   0.7101338   0.8637098   0.9400860   1.0151582  1.1730074
muForceSp        -9.0569978 -11.2124985  -9.7701119  -9.0364270  -8.3294804 -6.9825600
muChillSp       -12.1287993 -16.1726456 -13.4883459 -12.1269250 -10.8013721 -7.9855882
muPhotoSp        -4.1235815  -5.3390381  -4.5176081  -4.1211348  -3.7181951 -2.9382942
muPhenoSp        27.0851540  24.4048717  26.1419126  27.1032376  28.0274473 29.8420660
betaTraitxForce  -2.9237037  -9.4269438  -5.4424500  -3.0083187  -0.5567739  4.4427850
betaTraitxChill  -4.1547283 -18.4422534  -8.4316672  -3.9904848   0.4271062  8.7097012
betaTraitxPhoto   3.5305098  -0.3548438   2.1623257   3.5507321   4.8297717  7.5974219
sigma_traity      0.4226655   0.4067068   0.4169593   0.4225579   0.4282519  0.4395540
sigma_sp          0.2613316   0.2076801   0.2381028   0.2583930   0.2813336  0.3317095
sigmaForceSp      5.2086319   3.9948695   4.7341113   5.1542557   5.6213325  6.7520133
sigmaChillSp      9.5753805   7.3806949   8.6749230   9.4902164  10.3860256 12.3681225
sigmaPhotoSp      2.2891912   1.3910149   1.9433216   2.2546548   2.6021811  3.3716666
sigmaPhenoSp      9.7446017   7.8866899   8.9975111   9.6638807  10.3987056 12.0802979
sigmapheno_y      9.4980111   9.3029015   9.4257362   9.4967500   9.5667534  9.7017725

But the posteriors no longer appear totally informed by the prior: betaTraitxCue_z2AllParam_0_25

1c. I tried running it again with an even wider prior (0,100) and the values are pretty similar.

                       mean       X2.5.        X25.        X50.        X75.     X97.5.
betaTraitxForce  -3.0329024 -10.0964711  -5.4073513  -3.0731262  -0.6525775  4.0432460
betaTraitxChill  -4.8694186 -17.6491778  -9.4093599  -4.9386891  -0.5375577  9.2493541
betaTraitxPhoto   3.4902649  -0.5186379   2.2437986   3.5262744   4.7639897  7.4385319

betaTraitxCue_z2AllParam_0_50

.....more updates to come

DeirdreLoughnan commented 9 months ago

@lizzieinvancouver Even though I think the above suggests that the issue was the priors, for interests sake I am still did the additional tests:

  1. Multiply LMA by 100, so it is on the same scale as models that seem to be working (like height) Using the same prior as the traitor mdl: (0,1)

These results do tell a similar story in the sense that there is still an interaction between transect and latitude and the cue relationships are pretty similar.

                       mean       X2.5.        X25.        X50.        X75.    X97.5.
b_tranE           1.8575176   1.2519812   1.6434767   1.8570050  2.06573026  2.470343
b_tranlat         1.4019006   0.9360087   1.2465819   1.3996010  1.55772055  1.863095
muForceSp        -8.0936370 -13.3566281  -9.9815798  -8.0095984 -6.28133208 -2.881793
muChillSp       -11.5519968 -18.3020704 -13.9502212 -11.5086216 -9.20356778 -5.025360
muPhotoSp        -6.5765055 -10.4410879  -7.8565668  -6.5591979 -5.32960313 -2.778176
muPhenoSp        27.0104783  24.2052445  26.0565377  27.0004840 27.93281422 29.964245
betaTraitxForce  -0.3815066  -1.6963016  -0.8312392  -0.3937763  0.06974534  0.906565
betaTraitxChill  -0.3465777  -1.9511025  -0.9013413  -0.3475574  0.21160049  1.188138
betaTraitxPhoto   0.7907074  -0.1628205   0.4819119   0.7849496  1.11460923  1.748954
sigma_traity      1.6327036   1.5716594   1.6116687   1.6321344  1.65357435  1.695721
sigma_sp          0.9838541   0.7748140   0.8995156   0.9761239  1.05831078  1.237590
sigmaForceSp      5.2003506   3.9819366   4.7297559   5.1451815  5.63511078  6.630324
sigmaChillSp      9.4864517   7.2808759   8.6319178   9.3898808 10.24624099 12.157182
sigmaPhotoSp      2.2839195   1.3770702   1.9468371   2.2692136  2.59452660  3.342477
sigmaPhenoSp      9.7391284   7.9235980   9.0130217   9.6607321 10.36192445 12.022227
sigmapheno_y      9.4986960   9.2791861   9.4260397   9.4984315  9.57233219  9.716015

betaTraitxCue_lma100_0_1

Similarly as above the wider prior for the betaTraitxCue of (0,25), changed the estimates for these three parameters (and the cue parameters a little bit. But widening the priors further (e.g (0, 50) or (0,100), the model is able to make consistent estimates.

DeirdreLoughnan commented 9 months ago
  1. Running the height model on a smaller scale

When the height data is adjusted to be on a similar scale as the LMA data (by dividing it by 100), you do get issues with the prior informing the posterior, exactly like what we saw with the LMA mdl.

ht_rescaled100_0_1

Collectively, this suggests to me that there is an issue with both the scaling and the prior being too narrow.

Next I will try running the SSD and C:N data with z-scoring and a wider prior and see if this fixes their modelling issues as well.

lizzieinvancouver commented 9 months ago

@DeirdreLoughnan Sounds promising!