Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: Evaluate cdf and pdf of mixture of normals

 From Fernando Luco <[email protected]> To [email protected] Subject st: Evaluate cdf and pdf of mixture of normals Date Thu, 1 Sep 2011 14:57:57 -0500

```Dear statalisters,

I'm trying to compute the cdf and pdf of a mixture of normals but the
specifics of my problem are doing this quite difficult, so any ideas
would be really appreciated.

My data, and what I want to do is as follows. I have i people that may or
may not be present at t situations. Each person has two variables
associated, y(it)
and x(it). I assume that the distribution of y(it)
satisfies y(it)=x(it)+e(it) where the distribution of e(it) is a mixture of
normals. Let's assume that is only a mixture of two normals to make it easy
and that they have means mu1 and mu2 and std. dev sigma1 and sigma2, and
are independent.
I have the means, variances and mixing probabilities of the distribution of
e(it). So, my data is t, i, y(it) and x(it).

I have heterogeneity between people so the distributions of y(i) differ
among
people, in particular, the mean changes.
So, for example, when considering the cdf of person 1 the mean should be x11
plus the two means of the normal distributions (I guess
that they enter weighted by the mixing probabilities), for situation 1, but
for situation 2 then the mean should be x12 plus the weighted means. For
person 2
the mean would be x21 plus the weighted means of the
normals for situation one, and x22 for situation two, etc. The variance is
common. I want to evaluate the cdf and the pdf at y(it).

Finally, not every people are present in every t. So, when person i is not
present then the cdf and pdf  should be empty.

Does anybody know how I can compute this in Stata?