MvInv {BNPdensity} | R Documentation |
Invert jump heights function
Description
Determines the jump heights of an increasing additive process by inverting
the M(v) function. Use a truncation level based on expected moments of the NGG process (thresholdGG
).
For internal use.
Usage
MvInv(eps, u = 0.5, alpha = 1, kappa = 1, gama = 1/2, N = 3001)
Arguments
eps |
Dummy argument kept for consistency with past versions of the functions |
u |
Real number. The value of the latent variable at the current step. |
alpha |
Numeric constant. Total mass of the centering measure. |
kappa |
Numeric positive constant. |
gama |
Numeric constant. Discount parameter of the NRMI process. |
N |
Number of steps in the discretization scheme for the grid inversion. ## The function has been optimised but it is morally defined as: function(eps, u = 0.5, alpha = 1, kappa = 1, gama = 1 / 2, N = 3001) n <- length(w) v <- rep(NA, n) x <- -log(seq(from = exp(-1e-05), to = exp(-10), length = N)) f <- alpha / gamma(1 - gama) * x^(-(1 + gama)) * exp(-(u + kappa) * x) dx <- diff(x) h <- (f[-1] + f[-N]) / 2 Mv <- rep(0, N) for (i in seq(N - 1, 1)) Mv[i] <- Mv[i + 1] + dx[i] * h[i] for (j in seq(n)) v[j] <- x[which.min(Mv > w[j])] return(v) |