Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Imposing truncated normal distribution on intervals

From   "Maarten Buis" <>
To   <>
Subject   st: RE: Imposing truncated normal distribution on intervals
Date   Wed, 23 May 2007 17:13:17 +0200

see: -help intreg-

Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434 

+31 20 5986715

-----Original Message-----
From: []On Behalf Of Reza Daniels
Sent: woensdag 23 mei 2007 17:03
Subject: st: Imposing truncated normal distribution on intervals

Dear Statalisters,

I have income data in categories. I want to impose a truncated normal
distribution onto the (log transformed) values within the bounds of the
categories ordered from lowest to highest. I can work out how to do this
by imposing a uniform distribution within the bounds, but I cannot work
out the code for a truncated normal distribution.

Let me give an example: Firstly, let the variable for income category
be "ycat". Let it take on 3 values, and they can be anything (e.g. ycat
== 1 => income between 0 and $10,000; ycat == 2 => income between
$10,001=$100,000;  ycat == 3 => income between $100,000 and $500,000).
This is hypothetical and simplifies the problem.

The code for the uniform would be something similar to the following.
Let ycat_max be the upper bound of each interval and ycat_min be the
lower bound. Then the following operations give me my income  variable
with a uniform distribution within each interval:


forval i = 1 / 3 {
gen u`i' = uniform() if ycat==`i'

gen ycat_uniform=.
forval i= 1 / 3 {
replace ycat_uniform = ycat_min + (ycat_max - ycat_min) * u`i' if ycat
== `i'


Any assistance with the code for the truncated normal would be greatly


*   For searches and help try:

*   For searches and help try:

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