Statalist


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

st: RE: RE: Simulation: marginal effect at the 5th percentile


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Simulation: marginal effect at the 5th percentile
Date   Tue, 2 Dec 2008 15:25:17 +0100

Line for the server...

On the occasion of this thread: Is capitalization in the names of returned
results really advisable? - e(Xmfx_dydx)- may be used less frequently, but I
remember being bitten by -r(var)- as opposed to -r(Var)- after -summ-. What
is the benefit of a capitalized "V" here?


HTH
Martin


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Martin Weiss
Sent: Tuesday, December 02, 2008 1:28 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: Simulation: marginal effect at the 5th percentile

There were unbalanced parantheses in my code. Thanks to Kit Baum for
pointing this out!

***********
cap prog drop simnorm

prog simnorm, rclass
  vers 9.0
  *construct data
  drop _all
  set obs 1000
  g X2=uniform()*3
  g X3=uniform()*0.5+2
  g Y=uniform()>0.7
  
	gen a = 3*invnorm(uniform())+ 5 //so mean 5, sd 3
	_pctile a, p(5)
	loc p5 = r(r1)
  logit Y a X2 X3, robust
  mfx, predict(p) at(mean a=`p5' X2=0)
	mat dydxmfx = e(Xmfx_dydx)
	ret sca dydxmfxap5 = dydxmfx[1,1]
end

simulate dydxmfxap5 = r(dydxmfxap5), reps(100) : simnorm
*saving("C:\data\sima.dta", replace)
***********


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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