[Limdep Nlogit List] Plotting Confidence Intervals
William Greene
wgreene at stern.nyu.edu
Tue Sep 16 22:45:38 EST 2008
Dear Mikołaj: The following little routine does the sort of thing
you are looking for. You have to modify it in several ways (sample
size, function, etc.), but as a template, it will produce the kind
of figure you are looking for. (Note, my function is just a
meaningless function, not an elasticity of any sort.) This uses
the delta method to get the standard error. If you prefer K&R, just
add ;K&R to the WALD command.
Regards,
Bill Greene
samp;1-100$
crea;x=rnu(0,1);y=rnd(2)-1$
probit;lhs=y;rhs=one,x$
matrix ; mx=x ; me=init(n,1,0);ms=me$
calc;i=0$
proc$
calc;i=i+1$
sample;i$
wald;quietly; fn1=b_one*b_x*x^2$
matrix;me(i)=waldfns(1)$
matrix;ms(i)=varwald(1)$
endproc
exec;n=100$
samp;1-100$
crea;e=me$
crea;ve=ms$
crea;eu=e+1.96*sqr(ve);el=e-1.96*sqr(ve)$
plot;lhs=x;rhs=e,eu,el;fill;Grid
;Title=Confidence Interval for Elasticity of WTP$
----- Original Message -----
From: "Mikołaj Czajkowski" <miq at wne.uw.edu.pl>
To: "Limdep and Nlogit Mailing List" <limdep at limdep.itls.usyd.edu.au>
Sent: Tuesday, September 16, 2008 8:02:01 AM GMT -05:00 US/Canada Eastern
Subject: [Limdep Nlogit List] Plotting Confidence Intervals
Dear All,
I am running a Box-Cox model to estimate elasticities of WTP which would
vary with income. I can plot the elasticities, but I would also get the
confidence intervals (e.g. using K&R method) plotted.
The model looks like this:
(WTP)@THETA = b2*1 + b1*(HINCOME)@LAMBDA
where:
@ is a Box-Cox transformation
LAMBDA and THETA are ML estimates for transformation parameters
WTP and HINCOME is self explanatory
After estimating the model I am able to plot the changes in elasticity
as a function of HINCOME by either:
create; elast=b(1)*hincome^(lambda)*((b(2)+b(1)*hincome)@lambda)^(-lambda)$
plot; lhs=hincome; rhs=elast; fill$
(which uses sample-based HINCOME)
or by:
calc ; bet1=b(1)
; bet2=b(2)$
sample; 1$
fplot; FCN=bet1*hi^(lambda)/(theta*(bet2+bet1*hi at lambda)+1); labels=hi;
start=500; plot (hi); pts=1000; limits=100,5000$
(which simulates any hincome between the given limits).
This works ok.
However, is there a nice way to plot confidence intervals of the
elasticities? The only thing that comes to my mind is writing a
procedure that would use K&R technique to find 0.05 and 0.95 percentile
of the elasticity distribution for each of the points from the income
range. This is possible, but it is probably the long way...
I would be grateful for any ideas on how to possibly make it easier.
Thank you in advance,
--
Mikołaj Czajkowski
Warsaw Ecological Economics Center
Warsaw University
http://www.woee.pl/
_______________________________________________
Limdep site list
Limdep at limdep.itls.usyd.edu.au
http://limdep.itls.usyd.edu.au
More information about the Limdep
mailing list