Could you further check why the quantiles are not estimated proportionately?
For example:
set.seed(10)
dat=runif(50,0,100)
cdf <- as.data.frame(Ecdf(dat))
colnames(cdf)=c("Temperature","probability")
temp=30
(percentile=predict(loess(cdf$probability ~ cdf$Temperature), temp))
set.seed(1000)
(u1 <- runif(1, 0, percentile))
(d1 <- quantile(ecdf(cdf$Temperature), u1))
d1=as.vector(d1)
percentile2=predict(loess(cdf$probability ~ cdf$Temperature),(temp-d1))
(u2=runif(1, 0, percentile2))
d2 <- ifelse(d1 <= temp,
quantile(ecdf(cdf$Temperature),u2),
0 )
d3 <- temp - (d1 + d2)
In the code above, I am expecting the temp=30 is disaggregated into 3 parts using the CDF.
The Sum of three parts should equal to temp.
However, I find d2>d1 in spite of having a lower percentile (i.e. percentile of d2<d1 so it should have a lower quantile).
Thanks