Table Of ContentMicroeconomUestirnSigtc ast a
MicroeconomUestirnSigtc aast
A.C OLICN AMEORN
DeparotEfmc eonnto mics
UnivoeCfra solirnitifya
DavCiAs ,
PRVAIN K.T RIVEDI
DeparotEfmc eonnto mics
IndUinainvae rsity
BlmoiongItNo n,
AS taPtraeP ssu baltiicon
StataLCPo rp
CollSetgae,tT ieoxnas
Copyr i2g0ht0 9b©y St ataCpLo Pr
Al rli gthsr eseerd. v
Pubslheidb y StataPre s4s09,5La kewayD reivC,oell eSgt atoiTn,e xa784.s7 5
Tyepseitn 2s
J§.'IE;X
Pritnedi nt ehU ntiedSt ateosAmf e rica
1098765 4 32
ISBN0-:11 5-9178-048-3
ISBN-91738:-- 151987-048-1
No parto tfihs b oo mkay be rerpoudceds,t odri ena r etarvisleys to,er m tsrcairebnd, any
in
fromo r by anym ean-escletrcomn,ecia nhic,pao hlotcyopr,ec odnriog,r o ther wise -howutit
teh pirowrri tteprenms siiooStnfa t aCopLr P.
Stataisa r eigstedr tedremaarko Stfat aCpoL rPJ§..'TE:)C 2s isa t rademarko tfehA m er ican
MathematiSoccaeli. ty
Contents
Lisotft ables
XXXV
Lisotffi gures xxxvii
Preface xxxix
Stabtaas ics 1
1
1.1I nteruascet ive 1
1.2D ocmuentation 2
1..21 Stamtanau a.l s 2
12..2A dditSitoanrtaeals ources 3
1.2.T3h hee clop mma.n. d . . 3
1.2.T4h see arficnhd,a,i n tbds eacrocmhm ands 4
1.3C ommasnytdna axn odp era.t ors 5
1.3.B1as cic ommasnydn t.a x 5
13..2E xampl:eTh es umamreic zommand 6
13..3E xapmlTeh:re e gcroemsmsa .n d. . 7
1.43 .Abbreivo,inc asatsseen stiyat,ni wdvli idcards 9
13..5A rithrmeeltoaintcaai,ln ,ld o goipcealr ators 9
1.3.E6r rmoesrs ages 10
1.4D o-fialneds fi lloe.gs 10
.
14..1W ritiadn og- .fi le 10
1.4.R2u nndion-gfi les . 11
1.4.L3o figl e..s . . . 12
1.4.A4 t hreep-rseotscesp 13
1..45 Comemnatnsld o ng ,l ines 13
1.4.D6i ffeirmepnlteem ntaotifSo tnast a 14
Contents
v:i
1.5S aclsaa rnmda trices 15
1..51 Scal.a rs 15
15..2M atersi c 15
1.6U sirnegs fruolmtS st actmoam an.d s 16
16..1U sirnegs furlottmshr e-l cascsmo mansdu mamrize 16
1.6.U2s irnegs frumol ttshe e-ccloamsmsa nd regres1s7
1.7G lobanaldlo cmaaclr os 19
1.7.G1l ombaaclr os 19
1.7.L2o cmaaclr os 20
17..3S caolrma arco r? 21
1.8L oopcimonmga n.d. s . . 22
18..1Th ef roealcoho p 23
18..2T hfero valluoeosp 23
1.8.T3h e wlhoiolpe 24
1.48 .Thceo tnincuoem mand 24
0
19. Somuesu elcfm oman0d s 24
1.0 1Tepmladtoe- .fil..e . 0 25
1.1U1s er-wcroimtmtaennd s
')_�;:>
11.2S tarteas ources 26
11.3E xeirsc0e s.0 . 26
Datmaa nagemaenndgt r aphics
2 29
2.1I tnrodu.c tion 29
2.2T ypoefds a ta 29
2.20T1e xotrA SCdIaIt a 30
0
2.2.I2n tenrnmuaerli dca t.a 30
2.2.S3t rdiantg.a .. . . . 31
22..4F oramtfsrod ·i lsapynimuneridca ta 31
g
2.3I nputdtait.nag . .. . . 32
.
2.3.G1en erparlii npcl0e s 32
2.3.I2n putdtaitanalgr eianSd tyaf troama t 33
Contents vii
2.3.I3n putdtaitfrnaog mt hkee ybo.a rd 34
2.3.I4n putntoinntdgea xt.ta . . . . . . 34
23..5I nputtteidxnatg tfr ao m sap readsheet 35
2.3.I6n puttteidxnatg ti anfr efeo rm.a t 36
2.3.I7n puttteixdntag ti anfi xefdo rmat 36
·2.3D.i8oc ntaifirlye s 37
2.3.C9o mmopnit falls 37
2.4D atmaa nagem.e.nt 38
.
24.1. PSIeDx am.p le 38
2.4.N2a mianngld a bevlariinagb les 41
2.4.V3i ewdiantg.a .... . . . 42
.
2.4.U4s ionrgi gdionmcaeuln tation 43
2.4.M5i ssvianlgu. e..s . . 43
2..46 Imputmiinsgsd iantga 45
2.7 Transfdoartm(aig negn erreaptleeag,ce rene,,c ode) 45
4.
Theg enearnardte ep lcaocmem ands 46
Thee gecno mma.n. d 46
Ther eccoodmem a.n d 47
Thbey p refi.x. 47
.
Indicvaatrioarb les 47
Seotfi ndivcaraitaobrl es 48
Interactions 49
Demean.i ng 50
2.4.S8va indga ta 51
2.4.S9e lientcght sea mple 51
2.5M anipudlaattais.neg..t .s 53
25..1O rderoibnsge rvaantvdia ornisa. b les 53
2.5.P2r evsienargn rde stodraitnags et 53
a
2.5.W3i daen ldo nfgor fmosard ataset 54
viii Contents
2.5.M4eg rindga tas..e ts 54
2.5.A5pe pndidnagt a.s ets 56
2.6G raphlid ciaspolfda ayt .a . 57
26..1S tagtraa cpohm nmdas 57
Examgprlaecp ohm nmdas 57
Svainagne dx porgtrianp.gh s 58
Learnihnogtw ou sger acpohm mands 59
2.6.B2o x-and-pwlhoits ker 60
2.6.H3i sto.gr.am. . . 61
2.6.K4e rndeeln spiltoyt 62
2.6.T5w owsacya ttearnfipdt ltoletidsn es 64
2.6.L6o weksesr,ln eolcl,ali naenandre ,a rest-rneegirgehsb6so5ir o n
2.6.M7u ltsicpaltet erplots 67
2.7S tarteas ources 68
2.8E xerc.i.se.s. 68
3 Lineraerg rebsassiiocns 71
3.1I ntrod.uc..t.io.n 71
3.2D ataan dda tsau mmary 71
3.2.D1a tdae scription 71
3.2.V2a rbildaee scr.i ption 72
3.2.S3u mamrsyt atistics 73
3.2.M4o re-destuamimlasretyda tistics 74
32.5T abfloedrsa ta 75
.
3.2.S6tt saititceaslt s 78
3.2.D7a tpal o.ts. . 78
3.3R egreisnlse ivoaennl ldso g.s 79
3..31 Basirce gretshseioorny 79
3.3.O2L Sr egreasnsmdia otnral igxe bra 80
3.3.P3r opertthiOeeL sSes toifm a.t. o r 81
3.3.H4e toesrkedasrtoibcsuitstatyn -dearrrdo rs 82
Contents
ix
33..5C lusters-traonbdeuarsrrtdo rs 82
3.3.R6e greisnls oigosn 83
3.4B asriecg reasnsailoyns is 84
34..1C orrel.a. t ions 84
3.4.Th2e r egrceosmsm and 85
3.4.H3y pottheess..ti ss . . 86
3.4.T4a bloesfo utputs efvreroremag lr essions 87
"
3..45 Evebne tttaebrol rreesg reosustipount 88
3.5S pecifiacnaastlii.ys.o . n. .. . . . . . . 9.0 .
.
3. 15. . Specifitceasattnismdo o nd deila gno.s tics 90
·
3.5.R2e siddiuaagln polsottisc . 91
3.5.I3n flueonbtsiearlv ations 92
3.5.S4p ieficcatteisot.ns .. 93
Testo fo mitvtaerdi ables 93
Tesotft hBeo x-Cmooxd el 94
Testt hfoeuf n ctfioornma loc ofn tdihmteei aonn al 95
Heetroskedtaesstti city 96
Omnibtuess. t. . . . 97
3..55 Teshtasvp eo wienmr o re otnhdeai nr ection 98
3.6P redi.c. t i.o n.. . .. .. . 100
36... 1In-sapmrpeldei ction 100
36..2M argienffale cts 102
0 . .
3.6.P3r ediicnlt oigToshn:re e transfporrombalteimo n 103
306.P4r ediction exercise 104
3.7S mapliwnegi ghts 105
3..71 Weights 106
3..72 Weigehdmt ean 106
3.7.W3e ighrteegdr e0s sion 107
3.7.W4e ighptreedd iacntMdiE osn 109
3.8O LSu siMraitga 109
. . o o • • • •• •• •
Contents
X
3.9S tarteas ources 111
3.1E0x erc.i ses 111
4 Simulation 113
4.1I ntrod.u ction 113
4.2P seudorandgoemn-enrrusIam:ntb toerro duction 114
4.2.U1n ifroarnmd om-gneunmebreart ion 114
4.2.D2r afrwosm n orm.a. l . . . . . . 1.1 6.
4.2.D3r aws from tF,,g acmhmiaa-n,bsd eq tuaar ed, 117
4.2.D4r awfrso mb inomPioailsa,sn ondne ,g abtiinvoem. i al1 18
Indepe(bnudnteo nittd enltldiyic satr)id bruatwesd from
bino.mi a.l . . . . . . 1.1 8. . . . . . . . . . . . .
Indepe(bnudnteo nittd enltldiyic satr)id bruafrtwoesmd
Pois.so n. . . . . . 119
Histogarnddae mnss piltoyt s 120
4.3D istriobtfue hts iaompnml eea n 121
4.3.S1t ata p.r o.g r.a m . . . 122
43..2T hes imucloamtmea .n d 123
4.3.C3e ntlriamtlieh to rseimm ulation 123
4.3.T4h peo stcfiolmem a.n d . . . . . 124
4.3.A5l tercneanttirvaetl h eloisrmieimmtu lation 12.5
4.4P seudorandgoemn-enrrusFam:utb roetrdh eetra ils 125
4.4.I1n verse-ptrrnoasobframbait.li iotny 126
4.4.D2i rtercatn sfo.r mation 127
4..43 Otherh omdest . . . . 127
4.4.D4r afrwosm t runcnaotremda l 128
I
4.4.D5r afwrsmo multivnaorrim.aa tle 129
Dirdercatfw orsm m ultivnaorrimaatle 129
'I\:aon.rsmfautsiioCnnhog l edsekcyo mposition1 30
4.4.D6r auwssi Mnagr kcohvaM ionn Ctaer mleot h.o d 130
4.5C omuptiinngt egrals 132
4.5.Qu1a drature 133
Description:Stata manuals . Additional Stata resources. The help command The search, findit, and bsearch commands. 1.3. Command syntax and operators . Mata progTam with results output to Stata. Stata program that calls a Mata program. Using Mata in ado-files . Glossary of abbreviations. References.