# Re: [R] Confidence Intervals for Arbitrary Functions

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Mon 18 Jul 2005 - 01:58:15 EST

Before you spend a lot of time worrying about the distributions of ratios of normal variates, bootstrapping, etc., I suggest you make normal probability plots of your data AND OF THEIR LOGARITHMS, e.g., using

qqnorm(y, datax=TRUE)
qqnorm(y, datax=TRUE, log="x")

With many electrical measurements from integrated circuits, these two plots will both likely be equally close to normality. That's not true for leakage currents, for which I often see highly skewed images, unless I take logarithms, as:

qqnorm(exp(rnorm(99)), datax=TRUE)
qqnorm(exp(rnorm(99)), datax=TRUE, log="x")

I routinely see distributions of this nature in estimates of Poisson defect rates in wafer fab as well as in leakage currents, distributions of income, etc.

This is important, because the distribution of a ratio of normally distributed random variables has known pathologies, while the distribtuion of a ratio of lognormal variates is lognormal. (With a ratio of normals, if the denominator has mean zero, the ratio follows the Cauchy disribution, also known as Student's t with one degree of freedom. This distribution has infinite variance, and the mean is not even defined, being Inf-Inf.)

In sum, you will likely get better answers in less time if you can find it politically acceptable in your professional efforts to work in decibels or logaritms, where ratios become differences.

spencer graves

Gabor Grothendieck wrote:

```> On 7/16/05, Jeff Newmiller <jdnewmil@dcn.davis.ca.us> wrote:
>
```

>>I have a rather basic background in statistics, and am looking for
>>assistance in solving what I expect is a common type of problem.
>>
>>I have measurements of physical processes, and mathematical models of
>>those processes that I want to feed the measurements into. A simple case
>>is using measurements of electric power entering and leaving a
>>power conversion device, sampled at regular intervals, and summed to
>>estimate energy in and out, and dividing the energy out by the energy in
>>to get an estimate of efficiency. I know that power efficiency varies
>>with power level, but for this calculation I am interested in the
>>quantifying the "overall" efficiency rather than the instantaneous
>>efficiency.
>>
>>If the energy quantities are treated as a normally-distributed random
>>variable (per measurement uncertainty), is there a package that simplifies
>>the determination of the probability distribution function for the
>>quotient of these values? Or, in the general sense, if I have a function
>>that computes a measure of interest, are such tools general enough to
>>handle this? (The goal being to determine a confidence interval for the
>>computed quantity.)
>>
>>As an attempt to understand the issues, I have used SQL to generate
>>discrete sampled normal distributions, and then computed new abscissa
>>values using a function such as division and computing the joint
>>probability as the ordinate, and then re-partitioned the result into new
>>bins using GROUP BY. This is general enough to handle non-normal
>>distributions as well, though I don't know how to quantify the numerical
>>stability/accuracy of this computational procedure. However, this is
>>pretty tedious... it seems like R ought to have some straightforward
>>solution to this problem, but I don't seem to know what search terms to
>>use.
>>
```>
>
> There is some discussion about the ratio of normals at:
>
>    http://www.pitt.edu/~wpilib/statfaq.html
>
> but you may just want to use bootstrapping:
>
>   library(boot)
>   library(simpleboot)
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help

```
```--
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

spencer.graves@pdf.com
www.pdf.com <http://www.pdf.com>
Tel:  408-938-4420
Fax: 408-280-7915

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help