[R] Dequantizing

Stavros Macrakis macrakis at alum.mit.edu
Thu Nov 20 16:43:27 CET 2008


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



More information about the R-help mailing list