View source: R/Transformations.R
| fcenLRinv | R Documentation |
Maps a clr-transformed function back to a density,
f(z) = k\,\frac{\exp(g(z))}{\int \exp(g(t))\,dt},
where g is the output of fcenLR, fcenLRp or
fcenLRu. Because densities in the Bayes space are scale invariant,
the result is only defined up to a constant; k fixes it so that the
returned density integrates to k.
fcenLRinv(z, z_step, fcenLR, k = 1)
z |
numeric vector, the grid on which |
z_step |
spacing of the (equidistant) grid. |
fcenLR |
numeric vector, a clr-transformed density on the grid, as returned
by |
k |
positive number, the value the returned density should integrate to;
the default |
The integral is approximated by trapzc with spacing
z_step. Depending on the input, the result is (i) the
\lambda-density in B^2(\lambda) for fcenLR output, (ii) the
P-density in B^2(P) for fcenLRp output, or (iii) the
representation of the P-density in the unweighted space
B^2(\lambda) for fcenLRu output.
A numeric vector of the same length as fcenLR: the density
evaluated on the grid, integrating to k.
R. Talska talskarenata@seznam.cz, A. Menafoglio, K. Hron karel.hron@upol.cz, J. J. Egozcue, J. Palarea-Albaladejo
Talska, R., Menafoglio, A., Hron, K., Egozcue, J. J., Palarea-Albaladejo, J. (2020). Weighting the domain of probability densities in functional data analysis. Stat. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/sta4.283")}
fcenLR, fcenLRp, fcenLRu,
trapzc, cenLRinv
t <- seq(-4.7, 4.7, length = 1000)
t_step <- diff(t[1:2])
f <- dnorm(t, mean = 0, sd = 1.5)
f.fcenLR <- fcenLR(t, t_step, f)
# back to a unit-integral density ...
f.back <- fcenLRinv(t, t_step, f.fcenLR)
trapzc(t_step, f.back)
# ... or to a density integrating to 100
trapzc(t_step, fcenLRinv(t, t_step, f.fcenLR, k = 100))
plot(t, f.back, type = "l", las = 1, ylab = "density",
col = "darkblue", lwd = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.