brianstock / MixSIAR

A framework for Bayesian mixing models in R:
http://brianstock.github.io/MixSIAR/
90 stars 75 forks source link

ILR space #248

Closed PavelErnesto closed 3 years ago

PavelErnesto commented 4 years ago

Hello Brian,

I am going through the JAGS model. I am little lost on the part of inverse ILR math. I am wondering what does e means. Is it the inverse function of the natural logarithm or is it a parameter? There is not a definition of e as a vector before.

Inverse ILR math (equation 24, page 294, Egozcue 2003)

for(i in 1:N){ for(j in 1:(n.sources-1)){ cross[i,,j] <- (e[,j]^ilr.tot[i,j])/sum(e[,j]^ilr.tot[i,j]); }

brianstock-NOAA commented 4 years ago

e is defined in Egozcue (2003) at the bottom of p294 through top of p295. It is created on the R side in lines 88-94 of run_model.R, then passed to JAGS. In the comments of run_model.R:

# make 'e', an Aitchision-orthonormal basis on the S^d simplex (equation 18, page 292, Egozcue 2003)
# 'e' is used in the inverse-ILR transform (we pass 'e' to JAGS, where we do the ILR and inverse-ILR)

Below that in run_model.R we also create cross and tmp.p that are used in the inverse-ILR.

PavelErnesto commented 4 years ago

Thank you, Brian, I will follow your instructions.