# Calculation of standard deviation for 1/x (changed unit)

I have a report of a machine in which it is documented how many parts it has produced each day in the last year. From this I could calculate the mean with its standard deviation in [parts/day]. However, I need the mean and the standard deviation in [days/part], so mathematically "1/x".

Normally, I would first convert all daily values into the right unit, so [days/part] and then simply calculate the mean value and standard deviation.

However, this is not possible for various reasons in the further procedure of my work and so I first have to calculate the mean value and the standard deviation in [parts/day] and then convert them into the needed unit [days/part].

And here is my problem, I can convert the mean with "1/x", but that's not possible with the standard deviation.

My question now would be if there is a mathematically correct way to calculate the standard deviation in this case.

In the literature I unfortunately don't find any information about my topic/problem.

From my point of view, the only thing I can do is either estimate the standard deviation or maybe use the coefficient of variation of [parts/day]. Is that correct?

I hope, I'm not in the wrong place with my problem and that it is understandable. Any tips are welcome.

• How do you convert the mean of x to the mean of 1/x? Beware that it is NOT 1/mean(x). And do you really need mean and standard deviation, or are you only interested in a confidence interval? In the latter case, you can simply transform the interval limits. Jun 19, 2023 at 11:03
• Thanks for your reply! To give it a bit more background: I am modeling a production with the help of a simulation software. Each machine can only be modeled as a delay/cycle time with a mean value and standard deviation in [sec/part]. Therefore I need the standard deviation. However, my data is available in [parts/sec]. That's why I thought it's ok to atleast convert the mean of x [parts/sec] into [sec/part] by calculating 1/x? Can you tell me why that is not correct? Jun 20, 2023 at 5:25
• "Can you tell me why that is not correct?" For a simple counter example, see math.stackexchange.com/questions/248472/expectation-on-1-x. It can even be proven that for strictly positive (or negative) values, equality only holds for constant x. Jun 20, 2023 at 6:13
• Oh, I see, that makes sense! But if I understood it correctly, in my case it should work, because I'm only working with constants. For example a machine outputs 2 parts/sec on average. -> So the cycle time is 0.5 sec/part. But I can't convert the standard deviation like that (e.g. 0.5 parts/sec -> 2 sec/part => Makes no sense of course). That's why I'm asking myself, if there is a correct/better way to calculate a standard deviation in this case. Or can I only make assuptions based on my experience with the machines here? Jun 20, 2023 at 6:58
• "On average" obviously not describes a constant variable, but a property of a random variable. If you describe the distribution of x merely by mean and standard deviation, you might make the assumption that x is normally distributed. In that case, neither the mean nor the the variance of 1/x exist because the integrand has a non-integrable pole at x=0. OTOH, I would guess that your variable is strictly positive, so it cannot be normally distributed. Jun 20, 2023 at 8:14

As the examples on https://math.stackexchange.com/questions/248472/expectation-on-1-x show, you cannot compute the mean of $$1/x$$ as $$1/\mbox{mean}(x)$$. Actually it is not possible to compute the mean of $$1/x$$ from merely konwing the mean and standard deviation (sd) of $$x$$. A mathematician would stop at this point ;-) As it is a real problem that needs a real solution, an engineer would nevertheless look for a workaround.

Although mean and sd cannot be converted to reciprocal values without knowing the entire distribution of $$x$$, the situation is different for the median $$M$$ and the interquartile range $$IQR=x_{.75}-x_{.25}$$. It is

$$M\left(\frac{1}{x}\right) = \frac{1}{M(x)} \quad\mbox{ and }\quad IQR\left(\frac{1}{x}\right) = \frac{1}{x_{.25}} - \frac{1}{x_{.75}} = \frac{IQR(x)}{x_{.25}\cdot x_{.75}}$$

Apparently, your simulation software makes the assumption that the parameter can be merely described by mean and sd, and therefore most likely makes the assumption that it is normally distributed. For a normal distribution, mean and median are equal and $$IQR \approx 1.34896 \sigma$$, and you can approximate the standard deviation from the interquartile range, and use $$1/M(x)$$ as the mean.

This is only a very crude approximation and the distribution of $$1/x$$ is unlikely to actually be normal (or even symmetric), but I would expect it to become increasingly better when the coefficient of variation ($$\sigma/\mu$$) of $$x$$ is smaller.

• I would use different notation than $M(1/x)=1/M(x)$. Even with $M$ taken to be the $E$ operator, it's a direct contradiction of Jensen's inequality, but maybe you can define $X$ is the machine process with rate parameter $\mu$ and then mean parameter $\tau = E(1/X)$ Jun 20, 2023 at 14:01
• The sentence before the equation explains that $M$ is the median, and for the median the equality holds. Is $M$ usually used for the expectation or mean value and the notation thus confusing? Jun 20, 2023 at 14:53
• I already assumed, that what I'm trying to do is by no means mathematically correct :) The machine data (data sample of one year) is actually normally distributed. So I think using median and the IQR seems to be the best solution! I will have a deeper look into this topic now, thanks a lot! Jun 21, 2023 at 6:38

A solution that one might apply to this problem is to appeal to a parametric distribution of the machining process. If you have a reason to believe that the machining is Gamma, lognormal, or Weibull, then through the sample mean and sample standard deviation you can obtain method of moments estimators for the shape and scale parameters for the respective distribution. Knowing that, you can provide any number of summaries.

• Interesting thought! But from how I did understand the method of moments I then still have the problem of converting the data to the "corrcet" unit? (Machine data is normally distributed) Jun 21, 2023 at 6:46