[R] Exact quantile regression

Per Bak perbak at tdcadsl.dk
Thu May 5 15:37:07 CEST 2005


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




More information about the R-help mailing list