/*
File: cepr_sipp_topcode_lognormal.do
Date: May 26, 2003
Desc: Estimates mean above the top-code for monthly earnings
and hourly wages using the lognormal distribution
Note: See copyright notice at end of program.
*/
local T=ln($topcode) /* to simplify calculation below */
/* Description of procedure for estimating mean above top-code
Step 1: estimate mean, s.d. of uncensored distribution
If
1. y*~N[mu,sigma^2] (uncensored distribution)
2. y=a if a<=y*
3. y=y* if y*a)
3. lamda= -phi(alpha)/PHI(alpha)
4. phi (lowercase) is standard normal probability density function
5. delta=lamda^2 - lamda*alpha
therefore
See William H. Greene, Econometric Analysis, 5th Edition, pp. 763-64.
Step 2: use mean, s.d. of uncensored distribution to estimate mean
of the uncensored distribution above the top-code
E[y*|y>a]=mu + [(sigma*phi(alpha))/(1 - PHI(alpha)]
where
alpha=(a - mu)/sigma
See Greene, pp. 759-60.
*/
* Step 1
* a. calculate share of monthly earnings at or above the top-code (PHI)
* universe is all those reporting monthing earnings, including calculated.
sum tc [aw=wpfinwgt]
local PHI=1-r(mean)
* b. calculate other needed values
* top-coding implies right-censoring
*
* take natural log of monthly earnings since procedure
* assumes monthly earnings are log-normally distributed
tempvar lnernm
gen `lnernm'=ln($inc) if $inc~=.
sum `lnernm' [aw=wpfinwgt] if tc~=. /* include only those reporting monthly earnings */
local X=r(mean) /* mean, calculated using top-code (E[y] above) */
local SD=r(sd) /* standard deviation calculated using top-code */
local alpha=invnorm(`PHI')
local lamda=-normden(`alpha')/norm(`alpha')
* c. calculate estimates of true mean and standard deviation
local lsigma=(`T'-`X')/(`PHI'*(`alpha'-`lamda'))
local lmu =`T' - `alpha'*`lsigma'
* d. convert from natural logs back to dollars per week
local mX=exp(`X')
local mu=exp(`lmu')
local mT=exp(`T')
local sigma=exp(`lsigma')
* Step 2
* a. calculate mean above top-code
* calculating mean above top-code implies left-truncation
local halpha=(`T'-`lmu')/`lsigma'
local hlamda=normden(`halpha')/(1 - norm(`halpha'))
local mtc=`lmu' + `lsigma'*`hlamda'
* b. convert from natural logs back to dollars per week
global matcln : display %6.0f exp(`mtc')
/*
Copyright 2003 CEPR and John Schmitt
This file is part of the cepr_org_master.do program. This file and all
programs referenced in it are free software. You can redistribute the
program or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
*/