Function to compute Quantiles of Fhat
Function to compute p_0-quantile of
\hat F_m(t) = \int_{x_1}^t \hat f_m(t) dt,
where \widehat f_m is the log-concave density estimator, typically computed via logConDens
and p_0 runs through the vector ps
.
The formula to compute a quantile at u \in [\hat F_m(x_j), \hat F_m(x_{j+1})] for
j = 1, …, n-1 is:
\hat F_m^{-1}(u) = x_j + (x_{j+1}-x_j) G^{-1}_{(x_{j+1}-x_j)(\hat φ_{j+1}-\hat φ_j)} ((u - \hat F_m(x_j))/(\hat F_m(x_{j+1}) - \hat F_m(x_j))),
where G^{-1}_θ is described in qloglin
.
quantilesLogConDens(ps, res)
ps |
Vector of real numbers where quantiles should be computed. |
res |
An object of class |
Returns a data.frame with row (p_{0, i}, q_{0, i}) where
q_{0, i} = inf_{x}{\hat F_m(x) ≥ p_{0, i}} and p_{0, i} runs through ps
.
Kaspar Rufibach, kaspar.rufibach@gmail.com,
http://www.kasparrufibach.ch
## estimate gamma density set.seed(1977) x <- rgamma(200, 2, 1) res <- logConDens(x, smoothed = FALSE, print = FALSE) ## compute 0.95 quantile of Fhat q <- quantilesLogConDens(0.95, res)[, "quantile"] plot(res, which = "CDF", legend.pos = "none") abline(h = 0.95, lty = 3); abline(v = q, lty = 3)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.