• No results found

Clarify Outline. Installation

N/A
N/A
Protected

Academic year: 2021

Share "Clarify Outline. Installation"

Copied!
9
0
0

Loading.... (view fulltext now)

Full text

(1)

Clarify Outline

• Installation

• The Basic Idea of Simulation

(

and why it makes sense for substantive interpretation

)

• Components of Clarify

• estsimp, setx, simqi

• A Real, Live Example

• Logit Model • Continuous IVs • Binary IVs

• Concluding Points

• Models Supported

• How to ‘Clarify’ other Models

Installation

(2)

Installation

Type: net install clarify

Installation

…clarify will either install or tell you it is already installed.

(3)

The Basic Idea of Simulation

So, you estimate a model… and you want to say something substantive with quantities of interest:

1

ˆ

β

Predicted or Expected Values of DV = First Differences = X+σβˆ− Xµβˆ

β

µ ˆ

X

The problem is that our are uncertain! βˆs

The solution is we know how uncertain.

1

ˆ

σ

( )

The Basic Idea of Simulation: Parameters

In order to capture the uncertainty, we draw simulated from the multivariate* normal distribution. s βˆ 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β βˆ1 1 ˆ β 1 ˆ β 1 ˆ ββˆ 1 ˆ ββˆ1 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β βˆ1 1 ˆ β 1 ˆ ββˆ 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β βˆ1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ ββˆ1 1 ˆ β ˆ β βˆ 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ β 1 ˆ ββˆ1 1 ˆ β ˆ β 1 ˆ ββˆ ˆ β ˆ β 1 ˆ β ˆ β 1 ˆ β ˆ β 1 ˆ β 1 ˆ β

Then we use these simulated

parameters to calculate many draws of the same quantity of interest.

(4)

              = 1 2 1 ˆ ˆ ˆ ˆ α β β γ M ( )               = α β α β α α β β β α β β β γ ˆ 2 ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ ˆ 1 2 2 2 2 1 2 1 2 1 1 ˆ ˆ v v v v v v v v v V L M M M L L

we simulate parameters with M draws from the multivariate normal distribution… γ~~N

( )

γˆ,Vˆ

                                          M M M α β β α β β α β β ~ ~ ~ ~ ~ ~ ~ ~ ~ 2 1 2 22 12 1 21 11 M L M M

1. Choose a starting scenario, Xc .

2. Draw one value of , and compute .

3. Simulate the outcome , by taking a random draw from . 4. Repeat M times to get the distribution of .

γ~ θ

(

β~

)

, ~ c c =g X c Y~ f

( )

θ~c,α~ c Y (θ,α), θ ( ,β) ~ i i i i f g X Y =

(

)

= ( )= 0+ 1 1+ 2 2+L 2 , , , ~ µiσ µi i β β i β i N g X X X Y

The Basic Idea of Simulation: Quantities of Interest

In practice…

Components of Clarify

estsimp– estimates the model and simulates the parameters •This command mustprecede your regression command

• e.g.: estsimp logit y x1 x2 x3 x4

• This will save simulated βs to your dataset! •setx– sets the values for the IVs (the Xs)

• Used after model estimation to set values of the Xs • e.g.: setx x1 mean x2 p20 x3 .4 x4[16], nocwdel

• functions = mean|median|min|max|p#|math|#|‘macro’|varname[#] • reset values by re-issuing the command, e.g.: setx x1 median •simqi– simulates the quantities of interest

• Automates the simulation of quantities of interest for the X values you just set.

• e.g.: simqi, prval(1)

• e.g.: simqi, fd(prval(1)) changex(x4 p25 p75)

(5)

Onto the Machines…

1. clearthe current data 2. Increase memory

• Type: set mem 50m 3. Re-open the NES data set

• Type: use “"I:\general\Spost&Clarify\NES 1992.dta "

We’ll do a Simple Logit…

Type: estsimp logit vote2 pid ideology gulfwarworth education, sims(500) genname(simb)

Note that Clarify has added 5 new variables to our data

(6)

1. Summarize the new variables to see that they make sense.

1. Type: sum simb1-simb5

2. Then, set all Xs to their means so we can start.

2. Type: setx mean

Type: simqi, prval(1) Type: setx pid -3 Type: simqi, prval(1) Type: setx pid -2 Type: simqi, prval(1)

Type: fd(prval(1)) changex(pid –3 –2)) Or… Tables of First Differences

(7)

Probability of Bush Vote as PID Varies

Party ID -3 -2 -1 0 1 2 3

P(Bush) 0.049 0.089 0.156 0.263 0.408 0.571 0.719

95% CI (.025, .091) (.056, .141) (.111, .223) (.204, .330) (.332, .487) (.475, .669) (.613, .818)

And, since we know P(Bush) is .273(.212, .339) when every variable is held at its mean, we can calculate percentage changes ourselves to increase substantive interpretability.

But a picture is worth a thousand words, so it would be nice to use Clarify to generate pictures like this:

From King et al., AJPS2000

(8)

0 .2 .4 .6 P(Bush) Vote 5 10 15 20 Education phiwar/plowar midwar phinowar/plonowar midnowar version 8.0 set more off # delimit;

gen plonowar=.; gen phinowar=.;

setx gulfwarworth 0 ideology mean pid mean; local i = 6;

while `i' <= 17 {; setx education `i'; simqi, prval(1) genpr(pi); _pctile pi, p(2.5,97.5);

replace plonowar = r(r1) if eduaxis==`i'; replace phinowar = r(r2) if eduaxis==`i'; drop pi;

local i = `i'+1; };

gen eduaxis2 = eduaxis -.2; sort eduaxis;

gen midwar = (plowar+phiwar)/2; gen midnowar = (plonowar+phinowar)/2;

graph twoway rspike phiwar plowar eduaxis2 || line midwar eduaxis2 || rspike phinowar plonowar eduaxis || line midnowar eduaxis, ytitle(P(Bush) Vote) xtitle(Education);

gen plowar=.; gen phiwar=.;

gen eduaxis = _n + 5 in 1/12;

setx gulfwarworth 1 ideology mean pid mean; local i = 6;

while `i' <= 17 {; setx education `i'; simqi, prval(1) genpr(pi); _pctile pi, p(2.5,97.5);

replace plowar = r(r1) if eduaxis==`i'; replace phiwar = r(r2) if eduaxis==`i'; drop pi;

local i = `i'+1; };

(9)

Conclusion

• Models Currently Supported by Clarify • regress • logit • probit • ologit • oprobit • mlogit • poisson • nbreg • sureg • weibull

• But, you really don’t need Clarify to do this, so you can simulate quantities of interest for any

model!

üEasy to simulate parameters because Stata saves them after estimation!

üProgram the correct link function yourself!

References

Related documents

Table 6 Assessment of dehydration using the “Dhaka method” 9 Table 7 Patient history details and causes of acute diarrhea 10 Table 8 Incubation period and likely causes

If you use several of the Banque Cantonale de Genève’s services, you will benefit from an exceptional bonus of up to 2% additional interest on your BCGE Epargne savings account

• Carefully inspect the chassis for hollow areas and cover plates that may con ceal

• Single Stream Beamforming uses 3GPP Transmission Mode 7 - Specified in 3GPP Rel.8.. - Implemented in RL25 as

As inter-speaker variability among these the two groups was minimal, ranging from 0% to 2% of lack of concord in the 21-40 group and from 41% to 46% in the 71+ generation, we

&#34;#$%$Ο&amp;'() &#34;#$%$Ο&amp;'() Τα Τα κλισιόμετρα κλισιόμετρα χρησιμοποιούνται χρησιμοποιούνται όταν όταν για για λόγους λόγους ασ6αλείας ασ6αλείας

Redundant capacity and power paths simultaneously serving the IT equipment (minimum of N+1 systems) Tier Tier I Tier II Tier III Tier IV Cost $1.0x $1.1x $2.0x $2.2x Downtime

gzha gzha gzha gzha Jha Jha Jha Jha Jha Dyha Dyha Dyha Dyha Dyha gaw gaw gaw gaw gaw Nªha Nªha Nªha Nªha Nªha Ûha Ûha Ûha Ûha Ûha lagkjHkSjolqjrjlyksyqik;S dzksa