关键词 > MATLAB代写

Problem Set 4

发布时间:2022-06-10

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Problem Set 4

Use the programming language software  Matlab or  Octave to answer the following questions.  Print out the results in A4-size paper and turn in the program codes as well (in < 4 pages). For random number generations, use the seed number 290194 for uniform distribution and 20909 for normal distribution.

1.  (Generating Random Variables)

(a) Draw a 50 x 1 random variable u1 from the uniform distribution and a 50 x 1 random variable u2  from the standard normal distribution.  Let x1   = u1 and x2   = u1  + u2  and let true β  =  (2, 1) .   Generate y using the model y = x1 β1 + x2 β2 + e, where e ~ iid N (0, 1), and display only the first five observations of y .

(b) Find the means of y, x1 , x2  and e.

(c) Find the sample variances s2 of y, x1 , x2  and e.  Note that for a variable w sample variance is calculated as follows:

(wN - )2

N - 1

(d) Find the skewness and kurtosis of y, x1 , x2  and e. Note that for a varible w

(wN - )3                                                (wN - )4

 

2.  (OLS Estimation) Consider the regression:

y = x1 β1 + x2 β2 + e

with the variables y, x1 , x2  and e given as above.

(a) Estimate βˆ = (βˆ1 , βˆ2 )′  using the OLS method.

(b)  Calculate the variance-covariance matrix of βˆ. Also, find the standard errors of βˆ .

(c) Find β˜2  using the formula β˜2  = (x2(′)(I - P1 )x2 )1 x2(′)(I - P1 )y where P1  is the projection on the space spanned by x1 , and confirm that it is the same as βˆ2  obtained in (a).

(d) Find β˜2  = (x2(*) x2(*))1 x2(*) y* using the two-step regression where x2(*)  = (I -P1 )x2 and y*  = (I - P1 )y and confirm that it is the same as βˆ2  obtained in (a). Also, calculate β˜1  as noted in the lecture note.

(e)  Calculate β¯2  = (x2(′)x2 )1 x2(′)y and compare it with βˆ2 . How similar are they? (f) Assume x1  ~ iid N (0, 1) and x2  ~ iid N (0, 1) and do the same calculation as in (a) and (e). How similar are they? Now, chnage the sample size from

50 to 500 and do the same calculation as in (a) and (e).  How similar are they? Summarize your observations.