Skip to content
Prev 387412 / 398502 Next

quantile from quantile table calculation without original data

Hi Petr,

In principle, I like David's approach the best.
However, I note that there's a bug in the squared step.
Furthemore, the variance of the sample quantiles should increase as
they move away from the modal region.

I've built on David's approach, but changed it to a two stage
optimization algorithm.
The parameter estimates from the first stage are used to compute density values.
Then the second stage is weighted, using the scaled density values.

I tried to create an iteratively reweighted algorithm.
However, it didn't converge.
(But that doesn't necessarily mean it can't be done).

The following code returns the value: 1.648416e-05

qfit.lnorm <- function (p, q, lower.tail=TRUE, ...,
    par0 = c (-0.5, 0.5) )
{   n <- length (p)
    qsample <- q

    objf <- function (par)
    {   qmodel <- qlnorm (p, par [1], par [2], lower.tail)
        sum ( (qmodel - qsample)^2) / n
    }
    objf.w <- function (wpar, w)
    {   qmodel <- qlnorm (p, wpar [1], wpar [2], lower.tail)
        sum (w * (qmodel - qsample)^2)
    }

    wpar0 <- optim (par0, objf)$par
    w <- dlnorm (p, wpar0 [1], wpar0 [2], lower.tail)
    optim (wpar0, objf.w,, w=w)
}

par <- qfit.lnorm (temp$percent, temp$size, FALSE)$par
plnorm (0.1, par [1], par [2])
On Tue, Mar 9, 2021 at 2:52 AM PIKAL Petr <petr.pikal at precheza.cz> wrote: