Economics 310
60 likes | 211 Vues
This lecture provides a comprehensive analysis of least-squares estimation and the implications of omitting relevant variables in regression models. It covers the generation of synthetic data based on specified models, executing ordinary least squares (OLS) estimation in Shazam, and comparing the results of models with and without omitted variables. By simulating 1000 samples, the lecture illustrates the bias and efficiency of estimates under different scenarios, highlighting how the omission of important predictors impacts model accuracy.
Economics 310
E N D
Presentation Transcript
Economics 310 Lecture 4 Least-Squares Efficiency
Shazam Omitted Variable Example |_sample 1 20 |_read x1 x2 x3 3 VARIABLES AND 20 OBSERVATIONS STARTING AT OBS 1 |_* Generate 1000 samples with true model: Y=10+3X1-5X2+4X3+e |_* where e is normal with mean 0 and variance 4 |_* allocate arrays to hold the estimates |_dim bols 4 1000 stdols 4 1000 bbias 3 1000 stdbias 3 1000 |_dim binef 4 1000 stdinef 4 1000 beff 3 1000 stdeff 3 1000 |_* suppress useless output |_set nodoecho |_do #=1,1000 |_sample 1 20 |_* generate e |_genr e=nor(2) |_* generate y |_genr y=10+3*x1-5*x2+4*x3+e |_* ols estimation, supress the output with ? |_?ols y x1 x2 x3 / coef=bols:# stderr=stdols:# |_?ols y x1 x2 / coef=bbias:# stderr=stdbias:# |_endo ****** EXECUTION BEGINNING FOR DO LOOP # = 1 ****** EXECUTION FINISHED FOR DO LOOP #= 1000
Omitted Variable Results |_sample 1 4 |_* unbias ols estimation |_print b ase ese stdse B ASE ESE STDSE 2.999865 0.1919761E-01 0.1821358E-01 0.3203836E-02 -5.000589 0.2234035E-01 0.2230756E-01 0.3923984E-02 4.000645 0.2231198E-01 0.2105855E-01 0.3704277E-02 10.01183 1.669633 1.576074 0.2772373 |_sample 5 7 |_* exclude relevant variable |_print b ase ese stdse B ASE ESE STDSE 4.954072 0.1622638E-01 0.6927163 0.3860903E-02 -6.515474 0.2067005E-01 0.9601574 0.5351505E-02 180.6879 1.358374 59.67985 0.3326298
Irrelevant Variable Shazam Example |_* run the model for inclusion of irrelevant variable with |_* true model y=10+3x1-4x2+e |_do #=1,1000 |_sample 1 20 |_* generate error |_genr e=nor(2) |_* generate y |_genr y=10+3*x1-4*x2+e |_* ols estimation, supress the output with ? |_?ols y x1 x2 /coef=beff:# stderr=stdeff:# |_?ols y x1 x2 x3 / coef=binef:# stderr=stdinef:# |_endo
Intermediate Step to get Output |_* Transpose the array so that the STAT command can be used. |_matrix bols=bols' |_matrix stdols=stdols' |_matrix bbias=bbias' |_matrix stdbias=stdbias' |_matrix beff=beff' |_matrix stdeff=stdeff' |_matrix binef=binef' |_matrix stdinef=stdinef' |_sample 1 1000 |_?stat bols bbias beff binef /mean=b stdev=ase |_?stat stdols stdbias stdeff stdinef /mean=ese stdev=stdse
Results Irrelevant Variable |_sample 8 10 |_* efficient estimate reduced model |_print b ase ese stdse B ASE ESE STDSE 2.999353 0.1560298E-01 0.1508509E-01 0.2613140E-02 -4.000647 0.2129266E-01 0.2090908E-01 0.3622011E-02 10.05974 1.332989 1.299631 0.2251309 |_sample 11 14 |_* inefficient estimate reduced model |_print b ase ese stdse B ASE ESE STDSE 2.999578 0.1869003E-01 0.1829380E-01 0.3232131E-02 -4.000821 0.2226461E-01 0.2240582E-01 0.3958639E-02 -0.4610111E-03 0.2097928E-01 0.2115130E-01 0.3736992E-02 10.07941 1.589152 1.583016 0.2796858