Skip to content

Commit

Permalink
snap
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Creel committed May 21, 2024
1 parent e184ef9 commit 122326b
Show file tree
Hide file tree
Showing 5 changed files with 196 additions and 26 deletions.
2 changes: 2 additions & 0 deletions Examples/DSGE/ML/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[deps]
Dynare = "5203de40-99df-439e-afbc-014de65cb9ef"
160 changes: 160 additions & 0 deletions Examples/DSGE/ML/dsgedata.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
1.0807180999115995 0.7958216842143362 0.34462832931812704 0.03450821344067994 2.1010465855038816
1.0274404037940403 0.791869712083442 0.32846346547364225 0.03274414098719002 2.0957682968058258
1.0467362580889032 0.7925338390183663 0.3366008923647245 0.033423215581756385 2.083510809047585
1.0777843971804364 0.7935395591750277 0.35310381219271164 0.03440659476162212 2.0450487528329986
1.0811921892831786 0.7959697468275574 0.34635598392363276 0.03444465808895623 2.0914840232157825
0.9996782710108971 0.7918145785102513 0.31201121496851697 0.03181646942130322 2.146668333168764
1.0093496221396876 0.7904299489153747 0.3200504609718224 0.03226871764446347 2.112990567489793
0.9861817962996401 0.7874423881063034 0.3139485846949261 0.03165432981902294 2.1046188666807573
1.015637452417158 0.78857276733893 0.32400126702011744 0.03276971831276847 2.100226868088364
1.0044823684624047 0.7880598287555786 0.3162283190742637 0.032513074216544625 2.128218837916428
0.9812978569855788 0.784739613470175 0.31153252192978514 0.03188652983842574 2.110438566504089
0.9970595318198788 0.7847668499394891 0.3171770097261947 0.032572444651641594 2.106173099729868
0.9539335161262199 0.7797711516749474 0.3057345040633336 0.03130032746919564 2.090496766394401
1.0283744972151634 0.7831805866783954 0.3353659332294037 0.033958081295915134 2.054500248546831
1.0145844110890483 0.781777277956826 0.3316421048437374 0.033522589039548 2.049710221382441
1.0592490711966946 0.7843177227508128 0.34984283226274276 0.03503478599428134 2.0286134367207267
1.0439148222767114 0.7837443193534789 0.3440057486229751 0.034448161032995146 2.0331691574501174
1.0250607956718336 0.7821695532070859 0.33886910362869316 0.03379762675474182 2.026710968702795
0.9937615153266969 0.7792752172766525 0.32923026532903 0.03280006263333428 2.0223514219169916
0.9521174243594409 0.776941767519314 0.30735451785611345 0.03156809686812924 2.075518195879951
1.0110341437525996 0.779073130631842 0.33246926348327793 0.03373183511276637 2.037457206187935
1.0043450284495687 0.7791218203331103 0.32619358451780256 0.03357053983633446 2.062917825858281
0.9846027395132789 0.7777986657123541 0.31644979612088325 0.03299633753972572 2.084640185756261
0.9311090640382333 0.773505178577204 0.29478891100581883 0.031358378080199936 2.1162432830181994
0.9668803704909448 0.7728196666463936 0.3146103113463099 0.03281870977120101 2.0590867782174054
0.9665162701883445 0.7728588168814452 0.3099542678592587 0.03297930916041755 2.089232159794063
0.9665622095914624 0.7716448577376721 0.3109673283858576 0.033141692683651566 2.082524291662277
0.9195848701269144 0.767341209716746 0.2929009179031525 0.03170452530195281 2.1035198762976797
0.9315212304829021 0.7656078735156687 0.3007733672176161 0.032392307414379456 2.075051514489721
0.9648749679235458 0.7674790037884356 0.30973593507450514 0.033792232493327586 2.087153125111899
0.9681744569972603 0.7682303886788137 0.30555095475566846 0.034053167901032085 2.1229748954965406
0.9439036883942645 0.7646086630202621 0.3010796478549997 0.03332434740297228 2.100492112960129
0.9741472086154523 0.7657382189546198 0.3123495220371322 0.03457536110425524 2.089577295033798
1.0061187174182298 0.767373935084966 0.3252754854028211 0.03578490209441846 2.0723933548900733
1.0184600755163233 0.7682020438675639 0.3308544546590666 0.03619079333569347 2.06243962284746
0.981086488268968 0.7637018853381853 0.3261233715331262 0.03479481127404591 2.0155784432905657
1.051522187175052 0.7674776692140867 0.358370274491296 0.03731411145833414 1.9658986949335988
1.030679559914798 0.7664895790088248 0.35280521588930097 0.03637778582798388 1.9573260385667526
1.0601871934237164 0.7686660652806786 0.36727156222049406 0.03728243875544087 1.9340584815647681
1.0221645803940556 0.768435450186655 0.34581141112516633 0.03575545583564056 1.980413865358288
1.072129868136741 0.7722135498995714 0.36615603805998065 0.03741152462268604 1.9618050140114867
1.0355399285918816 0.771740777657688 0.3477986872381299 0.0359167293399441 1.9948646578502662
1.0746276711101963 0.7753533620791108 0.3614578190513487 0.03715909626733223 1.991935229045523
1.0651417986994043 0.7762670873499169 0.3560494998661551 0.0366074570573603 2.004341801140045
1.041181696359402 0.7777589880663666 0.336629049285156 0.03563308257571929 2.07228379912752
1.0169823297780276 0.7775000870576625 0.32307743573757347 0.03474533467965432 2.109021963877357
0.9874914079338556 0.7763565569752758 0.3078726971662058 0.03376812258027847 2.1489998038679325
1.0812055978926587 0.7796809106449953 0.3549302831931131 0.03701977450995064 2.0409865746898497
1.0411081447372146 0.779157774090837 0.33479847006523156 0.03545271294411924 2.083467346635454
1.0468086444553362 0.7785168787883583 0.3435162407674782 0.03556196921892094 2.0417123917801083
0.9815173246145217 0.7752064407409635 0.3150795286240491 0.03329460578276627 2.087143975825948
0.9578489488426432 0.7726184948497993 0.3066869099279467 0.03262504697767491 2.0925539735524863
0.9102808983587766 0.7681567489066871 0.2879919106079968 0.03121278049303897 2.117724585483888
0.9563498253134808 0.7687938123565696 0.3083722511479676 0.0330935133916576 2.077861229998726
0.9424933917025107 0.7672058290628813 0.30115696315877477 0.032797560618452626 2.0968166405206685
0.974994852365638 0.7660601839369023 0.32320023886318466 0.03411219591995699 2.0211799089101325
0.9659431875834799 0.7639824055522253 0.32348643169852903 0.03388775498442396 2.0006440269029184
0.9305418277194323 0.7613894427948024 0.3066286985203629 0.03278248282624383 2.0332850603819512
0.9548216789012763 0.762828673816019 0.3118245133294381 0.03386528702100477 2.051572283465921
0.9958040314292704 0.7656493687520808 0.3246720684678973 0.03545735445965796 2.0549601490691276
0.9307493594984184 0.7609811315532095 0.2992271388366998 0.03317856207122651 2.0840414313501303
0.9108516017183066 0.7588965161217477 0.288899845292363 0.03270008526153271 2.112383063515065
0.8501986614011184 0.7524892763551362 0.26659005028270855 0.030812928942705445 2.136647218426861
0.8662062956213887 0.7499434256571448 0.276453363139192 0.03182018363602469 2.099276475907039
0.9126767988595127 0.7490298432517498 0.30306926273364926 0.03388443398289512 2.0176743467189397
0.8544781737913845 0.74444245648795 0.27582261299056243 0.031971100224917996 2.0755957262613167
0.9569465399192325 0.7473069907199726 0.3269899215113594 0.03617316517431104 1.9607674129372838
0.9414371699829545 0.7461961380535134 0.31972580442045856 0.03562928528459065 1.9728198318862753
0.9464762521424187 0.7453475231332385 0.3250643682321963 0.03590326667163676 1.9508041654157202
0.9443399347569303 0.7454096781401393 0.32168158849535805 0.03589350756258789 1.9668711133663983
0.9748712222586452 0.7471563223119346 0.33470506870891725 0.037115160901817885 1.9514520238031792
0.982905992139524 0.7482317214059082 0.3368664562922928 0.037371413992583875 1.954912144603575
0.9715697314958338 0.7478135233284879 0.3321184856774823 0.036869605149682294 1.9599916370452053
1.010220461525429 0.7503552597705371 0.3498735950194054 0.03828802852406015 1.9345430968700306
0.9616130906972813 0.7499968462379188 0.3198028189587862 0.0363082941195353 2.014616562249255
0.948348309871311 0.7486559498797172 0.315476643272253 0.035838934696692935 2.0140732001254085
0.9454163536625333 0.7481824116618727 0.3137166053343607 0.03580542173489477 2.019111509789103
1.015167212406653 0.7520421606420925 0.345295272115046 0.03849853510760748 1.9697941874727491
1.0275039084608057 0.754771206902128 0.3461725951799 0.03876617074512479 1.9886793194827843
0.9959374770073169 0.7550694447650237 0.3271696062870168 0.03736977338385859 2.0395453877803504
0.9853538904925159 0.75419384226943 0.3254724473554428 0.03688507400855356 2.028393995298735
0.9880152273318221 0.752857601759882 0.3344492443543421 0.0369237671515564 1.979280892383087
1.0193434098319216 0.7544997076995574 0.3514978151414363 0.03801148894765604 1.9429977538312164
0.9764550196525325 0.7523236331097571 0.3340251089559959 0.036251069080345526 1.9586064193327095
0.9967691733086059 0.7543756092635806 0.33981934758957594 0.0369921919944598 1.965263004841011
1.0081543096067633 0.7573361843010263 0.33650157064242436 0.03733968418430515 2.0073087098413196
0.986789979809304 0.7559615171982796 0.32994846781538095 0.036439728143630036 2.003793284947237
1.0318531564292792 0.7577568729640423 0.3555558298588614 0.03803942671588868 1.9443970796405379
1.039637782478234 0.7588492648531624 0.36125395294855106 0.038105651068163444 1.928166185857254
0.9996714896370873 0.7581077061683903 0.34048820749349235 0.036439475724683 1.967114360925623
0.9705935585436178 0.7558716866820544 0.3308323653849274 0.03532860930050928 1.9656388445373458
0.9781049405515072 0.7577291436783989 0.32684227703726537 0.035657317191587726 2.005033365115111
0.9799693632897342 0.7576663385618236 0.32792680178787226 0.035746480090801204 2.0022117194783515
1.0320274462151189 0.7594271843171588 0.3577834460293143 0.03762242735053753 1.9326177879259088
1.056273945550531 0.763393986101454 0.3613345509742589 0.038312440955119396 1.9585850211725844
1.1371184233208966 0.7688224405526883 0.40209869288297484 0.04090992582875723 1.8947226838000775
1.0705453386606623 0.7701826226352216 0.3593205748114275 0.03798963883289783 1.996173543197168
1.0822338946831238 0.7722386087315846 0.36461719054288566 0.038122837836320284 1.988655694099113
1.0178598024435868 0.7684135567734767 0.3432647372657722 0.03558810290239707 1.9867029225448438
1.024748998639781 0.769292676906542 0.34545920462510105 0.03577634900146836 1.9874448101858748
1.0498439429243234 0.7714008082833911 0.3556399325234898 0.036568240548440926 1.9778306398990317
1.079919592582895 0.7735220989815141 0.37165845653408486 0.037434338449322486 1.946804688243177
1.0224205352549058 0.7718264643166185 0.3442170197350766 0.03522050233193034 1.9900845475878925
1.0448746072504465 0.7730942113072005 0.3556675217136472 0.03593885763906373 1.9683156718515462
1.0146020730358127 0.773560306615778 0.33464035938098596 0.0348119650514919 2.0313816620034837
1.0079236463054968 0.7736037654733101 0.32977972516443216 0.03458831911231767 2.047754115724098
1.011473711368243 0.7742911286892938 0.3286383240429533 0.03473529379937209 2.062104025921164
0.9601804731796195 0.7717001877816457 0.3042755909520643 0.033018791100758504 2.114268128087445
0.9892615474125213 0.7720261283621764 0.31828405093809964 0.03417874089816298 2.0824308978609563
1.0384795699805447 0.7733860538254236 0.3448131738786659 0.03592230625689256 2.017849019363066
1.0144706336349603 0.7728514517691457 0.3326574779003779 0.035011188630411645 2.0432267442330647
1.0255850285691872 0.772846972757827 0.34081080658765545 0.03537372110621528 2.016196574394095
1.0553853181934196 0.7762057901505677 0.3477379186876654 0.03634630408772882 2.033450938312584
1.0663568779168384 0.7774914778710266 0.35327636366971904 0.03656818232052773 2.022380449239874
1.1489173308839338 0.783011720779483 0.39096110159896785 0.03916371106994181 1.9689246448279039
1.068115282714632 0.7826619299786818 0.3463810094627294 0.03600488398399256 2.066039343234802
1.0496973434437837 0.7814740444955074 0.3427128023155274 0.03524228914555337 2.0521454662275747
1.0419307096421029 0.7823311564688197 0.3354057362871476 0.03491484019588989 2.0813370730900322
1.061641941931998 0.7853477956486008 0.3365111191722921 0.03553117711360707 2.113745664410741
1.0658577337595754 0.7861882474360968 0.33823773549946207 0.035565366488619216 2.111307000885463
1.0942278318133325 0.7896068098870626 0.3448956407170746 0.03638991998662931 2.1256656411023886
1.0078655712872526 0.7865254588313768 0.3057432186375198 0.0333859964707285 2.2086031259683145
1.0251289686181753 0.7864356785616947 0.31504120379790074 0.03403742521482597 2.1801388790878935
1.0534136431652092 0.7864338112464723 0.3330867422196744 0.03498337311302146 2.118925073224752
1.0734544903192138 0.7887795497780491 0.33776773571491 0.03558053550976546 2.1293142656806188
1.1478257926745523 0.7938388038536425 0.36848202549536413 0.037874944554501 2.0870736712684868
1.1030380777470512 0.7955168407681393 0.3395256573375645 0.036068025382096934 2.1766698788049963
1.0754048020825862 0.7947388584843456 0.3294585431934849 0.03499071348460713 2.1869775705817385
0.9787390033575126 0.788749910523162 0.29407035899658923 0.03181377857345532 2.229903550121222
0.9384941877668671 0.7825153938177805 0.2878006436787907 0.03070233368607342 2.184809972353549
0.9784303227648148 0.7813340202509854 0.31113536510867623 0.032270887088125894 2.1069519391628697
1.0223971888321466 0.7826470982957175 0.33086789358522534 0.03386979997782918 2.0703255132870937
0.9677902355098129 0.7780361063912515 0.3125640999636969 0.03211317045837253 2.0745135931005043
0.9797156978157449 0.7795931515048186 0.30906247646097906 0.032709367951798525 2.1238697128804365
0.9567205928390558 0.7773328347177625 0.2991305976543205 0.03210755092141915 2.1428832388181367
0.9492022353233815 0.775341919294431 0.2967485087065261 0.0320721941543983 2.143109179889019
0.9551869333011273 0.7747823131598853 0.2971926190979498 0.03250531870183808 2.1533963002367176
0.957101935987639 0.7732707779094317 0.29945414691042904 0.03277308702580299 2.141418431077481
0.9874756762826389 0.7727209919426168 0.3174234365449563 0.03398287194653722 2.084303972138679
1.0120973906008421 0.7749041190790193 0.3226562184705341 0.034916267349093685 2.1016278735731753
1.0590209430902147 0.7779689903294515 0.3412037234680926 0.03651990402715912 2.079527518676381
1.0970042818893164 0.7810501657712241 0.35740951071689064 0.037648681813552964 2.0564461385404735
1.0880866473226583 0.7816952468116399 0.35521135213105215 0.03705677209766992 2.0523504168422813
1.0031018039244899 0.7781179862415287 0.31826017972239934 0.03398630050940589 2.111720274460779
1.0415238975790448 0.7778992591029762 0.3442820192490139 0.03531552734875673 2.0268851347148398
1.077646303812836 0.7800391927441986 0.36201776829635135 0.03644389098333768 1.994441490134978
1.0679865194540972 0.7814048823677728 0.35360608455320647 0.035934144730737354 2.0235816546819816
1.0941580791101215 0.7845375969233602 0.36120812872951824 0.03665598133906495 2.0295403993745547
1.068366818728537 0.7840499705101887 0.3511675088675782 0.035577344354561585 2.0383589589746296
1.077152588315069 0.7848535117270984 0.3570326526817887 0.03573247076952775 2.02136197314274
1.019081013719598 0.781326117461493 0.336325633033797 0.0336830901139806 2.030125653481469
1.0058526489761126 0.7833045386390064 0.3173813155248406 0.03331788594393188 2.1233767251757456
1.0125048071503604 0.783381399640991 0.319230643707638 0.033625254125183836 2.125037264761227
0.9948034213757027 0.7830072807608803 0.30736542835267444 0.03312123881509667 2.168483033406953
1.0188170974347663 0.781975045752572 0.3247683256065916 0.03401450792789597 2.101825795328722
1.0962394752070135 0.7848529564775227 0.36478997645374395 0.0365830246538825 2.013434190979946
1.1457664690135838 0.7885337755474031 0.38876201959614454 0.037965924585484034 1.9746270490220412
1.0839071345079625 0.7873338178256797 0.36036702869438075 0.03556420732095825 2.0152176829406168
1.0892987545888095 0.7888479090625792 0.361156514759201 0.03558426155741617 2.0208147536634606
1.006369691391552 0.7855692964654669 0.3226263844176421 0.03277153737510688 2.089929069880298
4 changes: 2 additions & 2 deletions PracticalSummaries/18-SimulationBased.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ end
## Define the MSM criterion
# IMPORTANT: try running this with chatter, and without.
S = 100 # number of simulation replications
controlchatter = true
controlchatter = false
m = θ -> k(x,y) - mean(simulated_moments(θ, x, S, controlchatter))
# sums of squares of moments: corresponds to GMM with identity weight
function obj(θ)
Expand All @@ -72,7 +72,7 @@ using Econometrics
fminunc(obj, ones(2))
println(@green "You should find that MSM works, when chatter is controlled")
println(@yellow "(Remember that the true parameters are $θ₀)")
# note that theta hat is same as start values, it didn't work
# note that, with chatter, the estimates change every time, even though the sample does not.

## Now, let's do Bayesian MSM, as suggested by
# Chernozhukov and Hong (2003)
Expand Down
56 changes: 32 additions & 24 deletions econometrics.lyx
Original file line number Diff line number Diff line change
Expand Up @@ -53974,21 +53974,9 @@ href{./Examples/DSGE/SNM-TCN/Estimate.jl}{Estimate.jl}

\begin_layout Standard
Monte Carlo results for 1000 replications of the TCN neural net estimator,
for the simple DSGE model are below.
\end_layout

\begin_layout Standard
\begin_inset Graphics
filename Examples/DSGE/SNM-TCN/montecarlo.png
width 15cm

\end_inset


\end_layout

\begin_layout Standard
Below are the results using the SNM neural net that takes a summary statistic as the input (
for the simple DSGE model are below,
on the L.
Results for the SNM feed forward neural net that takes a summary statistic as the input (
\begin_inset CommandInset ref
LatexCommand ref
reference "SNM for DSGE results"
Expand All @@ -53999,15 +53987,25 @@ nolink "false"

\end_inset

),
) are on the R,
for comparison.
\begin_inset Newline newline
\end_inset


\end_layout

\begin_layout Standard
\begin_inset Graphics
filename Examples/DSGE/SNM-TCN/montecarlo.png
width 12cm

\end_inset


\begin_inset Graphics
filename Examples/DSGE/SimulatedNeuralMoments/nnfit.png
width 15cm
width 12cm
special height=15cm

\end_inset
Expand All @@ -54029,7 +54027,7 @@ the TCN results are better overall,
This shows that there may be information lost when using summary statistics,
and that we can do better with a well-chosen neural net that uses the full sample information.
However,
more evidence would be needed to confirm these results.
more evidence would be needed to confirm these results (there is some in the above-cited paper).
\end_layout

\begin_layout Itemize
Expand Down Expand Up @@ -54058,11 +54056,21 @@ Results for CUE-GMM using the TCN fit as the simulated moments are

\begin_layout Itemize
The point estimates are very close to the true values,
and the standard deviations are small,
and are,
in general,
better than what we have seen with other estimators.

and the standard deviations are small
\end_layout

\begin_layout Itemize
the 95% CIs contain the true parameters,
in all cases.
\end_layout

\begin_layout Itemize
in general,
the results are better than what we have seen with other estimators.
However,
the comparison is for only one sample.
We would need to do a more careful Monte Carlo to draw stronger conclusions.
The problem with that is that some of the estimators are tedious and time consuming to compute.
\begin_inset Newpage newpage
\end_inset

Expand Down Expand Up @@ -54134,7 +54142,7 @@ status open


\backslash
href{./PracticalSummaries/22-SimulationBased.jl}{here}
href{./PracticalSummaries/18-SimulationBased.jl}{here}
\end_layout

\end_inset
Expand Down
Binary file modified econometrics.pdf
Binary file not shown.

0 comments on commit 122326b

Please sign in to comment.