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

st: Simulation: marginal effect at the 5th percentile

From   "Supnithadnaporn, Anupit" <>
To   statalist <>
Subject   st: Simulation: marginal effect at the 5th percentile
Date   Mon, 1 Dec 2008 23:19:12 -0500 (EST)

Dear all,

I am running a simulation of the logit model. Each repetition I create a variable called 
"a", which is normally distributed. I would like to find the marginal effect of this 
variable at the certain percentiles of its distribution. The problem is that I cannot 
specify the number of the particular percentile in  -mfx, predict(p) at( )- 
because I don't know the value in each repetition. So I use the -r( )- from -sum-.
However,my program gives me the error from -mfx- part saying that

'indp5' found where number expected
an error occurred when simulate executed simlognorm

Is there a way to specify the unknown value in -at( )- of -mfx-? Would anybody please help? 

Thank you 

program define simnorm, rclass
        version 9.0
	gen a = sdX1*invnorm(uniform())+ meanX1
	sum a, detail
	   ret scalar ap5 = r(p5)
        logit Y a X2 X3, robust
        mfx, predict(p) at(mean a=ap5 X2=0)
	   mat dydxmfx = e(xmfx_dydx)
	   ret scalar dydxmfxap5 = dydxmfx{1,1]
	eret clear
	drop a

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

*   For searches and help try:

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