[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: more questions about changing the distribution

From   Linn Renée Naper <>
To   <>
Subject   st: more questions about changing the distribution
Date   Tue, 18 Nov 2008 16:36:40 +0100

As some of you probably already noticed, I am working on a 
distribution of prices trying to force the distribution 
into being bimodal (two price peaks instead of one).

Well, below is the codes I've been using so far. 

	sum mip 
	ret list

	gen u = (mip - `r(mean)')/`r(sd)' 
	local p = -.3

	local sd1 `r(sd)'
	local sd2 0.9*`r(sd)'

	local mu1 `r(mean)'
	local mu2 1.1*`r(mean)'

	gen e = u * cond(u < `p', `sd1', `sd2') + cond(u < `p', `mu1', `mu2')

Mip is the original price, and I am using this distribution 
to generate a standardized variable u, which I then transform 
into a new variable with a bimodal distribution.

My problem is that when imposing different means and sd for 
the new distribution I very quickly seem to end up with a 
"gap" in the distribution (intervals where no prices lie, obviously 
Related to the defined p).
I want some distance between the two peaks (the two means defined). 
In the example below I reduce sd2 with
10 percent and increases the mean2 by only 10 percent. Increasing
the mean by more results in a larger gap.

Here p=-0.3, which is equal to the p25 in the generated u. (meaning I want
25 percent of the sample to vary around the lower peak, this can
of course be changed as well). 

I think maybe what I need is to impose a third condition for the
Observations for example between p25 and p50 to avoid having 
the gap. 
By looking at the codes, can anyone see how this is possible?
Or, maybe there is a better way to all this?


*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index