New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

ECG 790C

by: Elody Bogisich DDS

ECG 790C ECG 790C

Elody Bogisich DDS
GPA 3.78


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in Economcs

This 9 page Class Notes was uploaded by Elody Bogisich DDS on Thursday October 15, 2015. The Class Notes belongs to ECG 790C at North Carolina State University taught by Staff in Fall. Since its upload, it has received 48 views. For similar materials see /class/223875/ecg-790c-north-carolina-state-university in Economcs at North Carolina State University.


Reviews for ECG 790C


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/15/15
Alastair Hall ECG 790 Topics in Advanced Econometrics Fall 2006 MATLAB Handout 3 Logical operators loops and ifelse statements This handout describes logical operators ii the structure of loops iii conditional execu tion of commands using if and else statements 239 Logical operators There are three logical operators amp denoting and denoting or quot denoting not An expression is true using the and operator amp if both operands are logically true eg if a1b1 then a1 amp b1 is true but a1 amp b2 is false Execute both these commands Note that the rst yields an answer of one as it is true and the second yields an answer of zero as it is false Also note that within logical statements equality is indicated by An expression is true using the or operator I if either or both operands are logically true eg if a1b1 then a1 b1 is true a1 b2 is true but a2 b2 is false Execute these commands and verify that the answers are what you would expect An expression is true using the not operator if the original statement is false eg if a1 then quot a2 is true but quot a1 is false Note that quot a1 for example can equivalently be written as a quot 1 Execute both commands and check the output These can be used in conditional execution statements see iii below or with vectors in which case the statement is whether or not the elements are zero To illustrate execute the following commands a1 2 0 b0 1 2 a amp b a b quota In each case the ouput of the last three commands is a vector whose elements are one or zero A one in the 2 element of the output vector indicates in the rst two cases that the statement is true about the ith elments of a and b and in the third case that the statement is true about the ith element of a it Loops Loops are executed in MATLAB using the for and end statements To illustrate execute the fol lowing commands azeros31 for 113 aii end in Execution of conditional statements Sometimes it is desired to execute commands only if some conditioning statement is correct This can be done using the if7 else or elseif statements To illustrate execute the following commands c1 if cgt0 d0 end Now execute c0 if cgt0 d0 else d1 end Finally execute c3a2 if c d0 elseif a d2 elseif agt1 d4 end Notice Every set of ifthen statements concludes with end Kostas Kyriakoulis ECG 790 Topics in Advanced Econometrics Fall 2004 Matlab Handout 5 Two step and iterative GMM Estimation The purpose of this handout is to describe the computation of the two step and iterated GMM estimates Both will be illustrated using the CBAPM Consumption Based Asset Pricing Model as it was studied by Hansen and Singleton 1982 i CREATING THE VARIABLES OF INTEREST First you have to add the gmmtbx folder into Matlab s path Enter the command gtgtaddpath kgmmtbx Now we need to construct the variables of interest namely the dataset and the instruments Both have already been saved in the gmmtbx folder and can be loaded into Matlab using the commands gtgtX load7cbapmvwrdatadat7 gtgtz load7cbapmvwrinstrdat7 where X is the dataset 1 and z are the instruments 2 In addition there are two parameters of interest 39y 6 that are described by the following population moment condition Elzt601t170712t1 T 1l 0 Note that although our objective is to compute the two step and iterative GMM estimates we begin by getting the rst step ones These would serve as a 77benchmark against which the rest of the estimates would be compared In addition it will make it easier to show that once the number of iterations increases the effect of the rst step weighting matrix on the estimates diminishes With that in mind we will no proceed in the estimation part ii FIRST STEP GMM ESTIMATION We start by considering the rst step GMM estimation This will be performed using two dif ferent weighting matrices a The identity scaled by a factor of 105 ie 105 x 5 and b The sample average of the inverse of the inner product of the instruments ie z zT 1 1The dataset consists of 465 observations on two variables x E ctct1 and x E marlpt The variable ct indicates the level of consumption on period t rt indicates the period t payoff from a unit of the market portfolio purchased in period tl and pt is the price of the market portfolio at time t The market portfolio consists of all the stocks traded on the New York Stock Exchange weighted by their relative value There are 5 instruments used a constant Emil Twig Emil Twig The tolerance mtmce for the minimization function is set to le 7 6 and the startcng mines are 0 5 0 5 The settings that you have to use for the estimation are illustrateol in Figure l s mammal Uu39lrlcdam E i i G M v DEIDYH EHY El zuu o ESTI MATHle 7 Bum jmnm mud r wiggleled r Regineled the mam minm Mamngaie nilleieweer j Bandwidth n Mallah s mimmlialinn plucndule Tuiarmae emeriumor 1 ies Minlmlia un M xllm evaluan39nns U Makiun zra uhg mu 7 Mummersqu garamelel umes39et x Mom nis W Vanna algumams lf Smmqyalues 1 st step w W Iagnnxliu r In 47 an m sneak r Uh 17 ull Ouiputwiii be seveses feel gws meme hllenleu 39 Estimate Abdul Heiv Dears Figure 1 CMMVCUI settings for rststep estimation of CBAPM Once the estimation is olone enter the following in Matlab s commanol prompt gtgt C8561 where case1 is the name that you useol for saving the estimation s output You shoulol now get a list 7 in Matlab s terms a structure 7 with the output t e rst step CMM estimates are 925 71 872 0 999 These are iolentical with the ones presenteol in AR Hall Generolczed Method of Moments forthcoming on page 62 table 32 in oroler to stu y e e ects if any that the starting values and the rst step weighting matrix have on the estimates let s repeat the estimation by changing The starting value to 75 5 7 5 5 The estimates you shoulol get are 71 874 0 999 which are very close to the results we got before So at least for this moolel and the speci c set of starting values it seems that convergence is not problematic The weighting matrix to clzT l Using 0 5 0 5 and 75 5 7 5 5 as the starting pa7 rameters values the estimates we get are 0 500 0 995 and 0 698 0 994 for the two sets of starting values respectively l3 MM ESTIMATHZih DEIEYHiEHY El Zulut Esumntiun msmud n Unmxu lclen r39nnnmoien e Mnlnbhlx snarling naralmazls nr iisiiiir Iings mushr niiriiiiiirelinii pincgdulp Tamas x Msiiinnsle Dl evences Tuletenee oilterinniui he s mlnlmhatl39nn MD W E up BandWldm n Maxim bizaluon39bns W Vewn39hsreiuumedts 1 5m imam Maxim neinlions mu stomngvnlhes S 39nneslzn ms ay Emmi Tulemnoetur 1 Her F New 1 Dn r Em lststehw W s2M5 GMWMs I Iquot nal 7 mi quotquotJhnk 1 un 17 mi autpulwlll hesevsutns W gwanamahl2mev The number of GMIVI iterauons I Estimate must be set equal to 2 Ann Heir nasal Figure 2 CMMVCUI settings for two step estimation of CBAPM As we can see the selection of the weighting matrix seems to have an important effect on the rstrstep CM estimates in addition from all of the above combinations the last one Starting values is 5 75 5 and W z zT 1 seems to Work best since it results to the lowest value f h c objective function3 which is 0 0029 The sensitivity of the results to the initial parameters is one of the reasons for performing two step or iterated CMM estimation these are presented below iii TworsTEP AND ITERATED GMM ESTIMATION In this section we study the CBAPM using twostep and iterated CMM estimation All the models we are about to present use 75 5 7 5 5 as stortcng mines and the tolerance mtmon for both the mcmmczotcon procedure ctemtcons is set to lees The longr39mn commoner matmx is calculate using the quotMartmgal szj rmc s setting since the economic model implies that the moments are serially uncorrelated and no HAC estimator of the variance is needed Fir e w m worth mentioning here First the GMM estimation procedure is minimising TQT and not 9 which is the GMM obiective function Second in order to get the value ofTQTw Just click on the quotHexquot box in the Display options of the GMMVGUI before you perform the estimation nally the rst step weighting matrices are the ones we used before First calculate the two step GMM estimates using 105 x 5 as the weighting matrix gure 2 illustrates the settings you must use in the two step estimation case The results you should now get are 0706 0994 Next calculate the two step estimates using z zT 1 as the weighting matrix The GMM esti mates will now be 0666 0994 As we can see after just two iterations the impact of the rst step weighting matrix is clearly diminishing To verify that 77diminishing effect we will now compute the iterative GMM estimates Set the number of GMM iterations to their default value 50 and repeat the estimation using both weight ing matrices You should now get the same results irrespectively of which weighting matrix you used the estimates will be 0666 0994 This results comes into perfect agreement with the argument that we made above as the number of iterations increases the effect of the rst step weighting matrix diminishes The GMM estimates under the different number of iterations and rst step weighting matrices are summarized in the following table W One step Two step Iterated 10 x15 1874 0999 0706 0994 0666 0994 zzTrl 0698 0994 0666 0994 0666 0994 1V THE DIMINISHING EFFECT OF THE FIRST STEP WEIGHTING MATRIX The question that will naturally arise after the above experiment is why the effect of the rst step weighting matrix diminishes One way to answer this question is by plotting the absolute difference between the two GMM objective functions at each iteration To do that we introduce the following notation GiW1 f y6 denotes the value of the GMM objective function4 on iteration i as a function of the rst step weighting matrix W1 the moments used for estimation denoted by the vector valued function f the value of the parameters of interest 39y 6 and the information set I Figure 3 shows the absolute di erence between the two objective functions ie Gi10515 7 GiTz z 1 i 1 2 3 4 at each iteration of the 4 that they were required for convergence At 0 1 the difference reaches up to the order of 107 as 0 increases this difference diminishes and once we reach iteration 4 the difference is of order 02 To get an even closer look on this difference Figure 4 plots it around a smaller neighborhood of the nal solution Here the diminishing effect is even more striking The difference is initially up to order 106 and eventually decreases to order 10 In other words for the problem at hand as the number of iterations increases the objective 4In general Gi will also depend on the type of the longrun covariance matrix estimator used which in turn depends on the kernel and the bandwidth used However since the CBAPM moments are martingale di erences there is no need for de ning a kernel or bandwidth and we avoid their use to economize in notation functions are getting closer7 irrespectively of the weighting matrix used on the rst step therefore7 their minimands will get closer as well That is why the difference between the GMM estimates disappears as i increases Iteration 1 l l llw g ll llllll W l W IlllllIlllllllllllllllllllllll I ll51 Illilll t lllllllll llllllllll ll Iteratiun 3 m mmgg m 1 mug1 llllllllllllllllllllllll rff f i i hnuu till115 11141 mm 5 06 10 llll Iteration 2 3 mg 5 Illll 200 I IIIIIIIIIIIIII Illllll II I fl i i mm 111 lllllllt l llfi Inn51 39 39 quot WWW m x m lllllllllllllllllllIlllllllll Illlllllllllllllllllll Illllllllgzl l m IllIll lllllllllllllllll IlllllllllllllllllllIllIl Ill114 IlllllII III 5 06 10 Figur e 3 Ab solute distanc b e etWe en 0239 10515 and 02k z zTH Ite ration 1 ltera tlun 2 A i mm mm E V 25 I x mm mm lllllllllllllll L I Illlllllll quot5 Illlllillllll lllll lllllll lllllllll Ill 14quot 111 III I 1 H NE E 3 3 u l w ljl F1 gure 4 A 13501 llt 310m edjst d an a neighbce betwee Or of maximal 31 a and V eStima Oz tes zzT1


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Janice Dongeun University of Washington

"I used the money I made selling my notes & study guides to pay for spring break in Olympia, Washington...which was Sweet!"

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.