# Distribution of x * Pr(x) for Normal distribution

This must be a standard problem, but I can't find an answer.

I'm assuming that particle weights follow a Normal frequency distribution, that is the number of particles with weight < x is given by N(x), which is a CDF, the integral of the pdf n(x).

I want the weight of particles with weight < x. I think this CDF will be the integral of x*n(x), but I've no idea how to calculate that.

Any suggestions?

Edited to add: As pointed out by @scherm the total weight particles with weight < x depends on the sample size. I should have said that the total weight of all particles is known, so I want the proportion of the total weight which is made up of particles with weight

• To clarify: do you want the average weight, or the distribution of the weights, given that the weight < x? – jbowman May 18 '17 at 13:06
• If the number of particles with weight < x is N(x; mean, sd) [assume Normal CDF] I want the total weight of particles with weight < x, as a function of x, mean, and sd. – user20637 May 18 '17 at 13:34
• @a_statistician I don't think so. I think the expression you give is just the integral of n(y)dy [the Normal pdf] between −∞ and x, which is just the Normal CDF. I think I want the integral of y.n(y)dy between those limits. – user20637 May 18 '17 at 13:47
• What you want is truncated mean. it is $\int_{-\infty}^xyn(y)dy$. There is no analytical expression for this integral. Maybe you can find an online calculator for this question. ---Find a way to edit it: Delete and re-type. – user158565 May 18 '17 at 14:07

The total weight of particles weighing at most $x$ depends on your sample. Perhaps what you are looking for is the mean of these weights.

Given the distribution of weights $X\sim\mathcal{N}(\mu,\sigma^2)$, we can compute this analytically. We use the expectation of the lower tail of the truncated normal distribution (assuming $\mu$ is far enough away from 0 that the probability of a negative weight is very small):

$$E(X|X<x)=\mu-\frac{\phi\left(\beta\right)}{\Phi\left(\beta\right)},$$

where $\beta=(x-\mu)/\sigma$.

Let's verify this in MATLAB:

rng(1)
mu = 100;
sigma = 10;
n = 100000;
x = 80; % cutoff value
X = mu + sigma*randn([n,1]);
mean(X(X<x)) % 76.1884

% analytical solution:
beta = x-mu;
mu-sigma*normpdf(beta/sigma)/normcdf(beta/sigma) % 76.2678

• Hmm. I can do it numerically. I don't have MATLAB but in R I did: – user20637 May 18 '17 at 14:58
• Hmm. I [think I] can do it numerically, but I'd thought this would have been addressed elsewhere - truncated normal is a good idea. In R I did: xPrx <- function(x, mean = 14, sd = 5){ integrate(function(y) y*dnorm(y, mean=mean, sd=sd), lower = 0, upper = x)$value/ integrate(function(y) y*dnorm(y, mean=mean, sd=sd), lower = 0, upper = Inf)$value } where I've (a) used values appropriate to my application (b) integrated from zero to avoid negative weights (c) scaled to proportion of the total. Plugging in your values I don't get your answer. I'll keep playing and reading. – user20637 May 18 '17 at 15:09
• I'm not familiar with R, but this ratio of expectations seems strange to me. Perhaps this package may be helpful to you. Either way, after seeing your edit to the original question, I think you're just looking for the cdf of the weights evaluated at $x$, i.e., $\Phi((x-\mu)/\sigma)$, where $\Phi$ is the standard normal cdf. This gives you $\Pr(X\leq x)$, the probability that a particle weighs at most $x$. – scherm May 18 '17 at 15:59
• The cdf is the number proportion of particles weight < x. I want the weight proportion of particles weight < x. Expectation (=mean) of a truncated Normal is a good steer, but is the average height of the pdf curve in that range, I want the area under the curve. With your hints I think it's straightforward, but I won't have time to try until Tuesday when I'll comment further. – user20637 May 18 '17 at 18:57
• Delayed by a dose of campylobacter - not fun! I think there's a σ missing from your equation. Also, that seems to break for x > mean. In the end I met the need with numerical integration of y*normcdf(y) between -Inf and x; ugly but it worked. Thanks for your input. I haven't accepted the answer because it didn't meet my needs, but I have upvoted it. – user20637 May 31 '17 at 13:53