Re: [R] Dequantizing

From: roger koenker <rkoenker_at_uiuc.edu>
Date: Thu, 20 Nov 2008 11:31:43 -0600

I'm rather doubtful that you can improve on the uniform jittering strategy
you originally considered. It would require intimate knowledge about the non-uniformity of the density in the spacings between your quantized version.
But if you really _knew_ the parent distribution then something like the following might have been what you had in mind:

# Toy dequantization example
rate <- 1
x <- sort(rexp(100,rate))
xu <- x + runif(100)
y <- floor(x)
ty <- table(y)
p <- c(0,cumsum(table(y)/length(y)))

pup <- p[-1]
plo <- p[-length(p)]
fun <- function(ty,plo,pup) qexp(runif(ty,plo,pup),rate)
z <- unlist(mapply(fun, ty = ty, plo = plo, pup = pup))
url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    rkoenker_at_uiuc.edu            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Champaign, IL 61820



On Nov 20, 2008, at 9:43 AM, Stavros Macrakis wrote:

> I have some data measured with a coarsely-quantized clock. Let's say
> the real data are
>
> q<- sort(rexp(100,.5))
>
> The quantized form is floor(q), so a simple quantile plot of one
> against the other can be calculated using:
>
> plot(q,type="l"); points(floor(q),col="red")
>
> which of course shows the characteristic stair-step. I would like to
> smooth the quantized form back into an approximation of the underlying
> data.
>
> The simplest approach I can think of adds a uniform random variable of
> the size of the quantization:
>
> plot(q,type="l"); points(floor(q),col="red");
> points(floor(q)+runif(100,0,1),col="blue")
>
> This gives pretty good results for uniform distributions, but less
> good for others (like exponential). Is there a better
> interpolation/smoothing function for cases like this, either Monte
> Carlo as above or deterministic?
>
> Thanks,
>
> -s
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 20 Nov 2008 - 17:47:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 20 Nov 2008 - 18:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive