# [R] Exact quantile regression

Date: Thu 05 May 2005 - 23:37:07 EST

Hi,

I have been returning to the same problem a number of times without success and now look for help with the following:

How do I fit a distribution function with the same number of parameters as there are quantiles and values such that I get an exact solution as opposed to a minimum least squares type solution? Say, which lognormal distribution has a 15% quantile of 10 and a 50% quantile of 30? My hope is that the solution to this problem can be expanded, such that I can fit three quantiles with the Generalized Weibull distribution (which has three parameters).

This is what I attempt without success:

library(stats)

Target <- data.frame(

```	quantiles = c(0.15, 0.50),
values = c(10, 30))

dist <- nls(values ~ qlnorm(quantiles, mu, sd), data = Target,
start = list(mu = 30, sd = 5))

```

I can see that it works with one more value:

Target <- data.frame(
```	quantiles = c(0.15, 0.50, 0.85),
values = c(10, 30, 60))

dist <- nls(values ~ qlnorm(quantiles, mu, sd), data = Target,
start = list(mu = 30, sd = 5))

```

Kind regards,

Per Bak
Copenhagen, Denmark

R-help@stat.math.ethz.ch mailing list