****Lab 4, Feb 4: EDA and OLS and WLS

Similar documents
Monday 7 th Febraury 2005

LONGITUDINAL DATA ANALYSIS Homework I, 2005 SOLUTION. A = ( 2) = 36; B = ( 4) = 94. Therefore A B = 36 ( 94) = 3384.

Lecture 3 Linear random intercept models

Outline. Linear OLS Models vs: Linear Marginal Models Linear Conditional Models. Random Intercepts Random Intercepts & Slopes

Exercices for Applied Econometrics A

Fixed and Random Effects Models: Vartanian, SW 683

Problem Set 10: Panel Data

LDA Midterm Due: 02/21/2005

Practice 2SLS with Artificial Data Part 1

Please discuss each of the 3 problems on a separate sheet of paper, not just on a separate page!

Quantitative Methods Final Exam (2017/1)

Microeconometrics (PhD) Problem set 2: Dynamic Panel Data Solutions

Simultaneous Equations with Error Components. Mike Bronner Marko Ledic Anja Breitwieser

Econometrics Homework 4 Solutions

Exam ECON3150/4150: Introductory Econometrics. 18 May 2016; 09:00h-12.00h.

University of California at Berkeley Fall Introductory Applied Econometrics Final examination. Scores add up to 125 points

1

Empirical Application of Panel Data Regression

General Linear Model (Chapter 4)

Problem Set 5 ANSWERS

CRE METHODS FOR UNBALANCED PANELS Correlated Random Effects Panel Data Models IZA Summer School in Labor Economics May 13-19, 2013 Jeffrey M.

Lab 3: Two levels Poisson models (taken from Multilevel and Longitudinal Modeling Using Stata, p )

Applied Econometrics. Lecture 3: Introduction to Linear Panel Data Models

STATA Commands for Unobserved Effects Panel Data

1 The basics of panel data

Binary Dependent Variables

Fortin Econ Econometric Review 1. 1 Panel Data Methods Fixed Effects Dummy Variables Regression... 7

Suggested Answers Problem set 4 ECON 60303

multilevel modeling: concepts, applications and interpretations

Lab 07 Introduction to Econometrics

ECON Introductory Econometrics. Lecture 5: OLS with One Regressor: Hypothesis Tests

Longitudinal Data Analysis Using Stata Paul D. Allison, Ph.D. Upcoming Seminar: May 18-19, 2017, Chicago, Illinois

Empirical Application of Simple Regression (Chapter 2)

Heteroskedasticity Example

point estimates, standard errors, testing, and inference for nonlinear combinations

sociology 362 regression

Answer all questions from part I. Answer two question from part II.a, and one question from part II.b.

ECON 497 Final Exam Page 1 of 12

Introductory Econometrics. Lecture 13: Hypothesis testing in the multiple regression model, Part 1

Lecture 3.1 Basic Logistic LDA

sociology 362 regression

How To Do Piecewise Exponential Survival Analysis in Stata 7 (Allison 1995:Output 4.20) revised

Problem Set 1 ANSWERS

Heteroskedasticity. (In practice this means the spread of observations around any given value of X will not now be constant)

Introduction to Linear regression analysis. Part 2. Model comparisons

Heteroskedasticity. Occurs when the Gauss Markov assumption that the residual variance is constant across all observations in the data set

ECON2228 Notes 10. Christopher F Baum. Boston College Economics. cfb (BC Econ) ECON2228 Notes / 48

Warwick Economics Summer School Topics in Microeconometrics Instrumental Variables Estimation

Failure Time of System due to the Hot Electron Effect

Problem set - Selection and Diff-in-Diff

Lecture 8: Instrumental Variables Estimation

Problem Set #5-Key Sonoma State University Dr. Cuellar Economics 317- Introduction to Econometrics

3 Variables: Cyberloafing Conscientiousness Age

ECON2228 Notes 10. Christopher F Baum. Boston College Economics. cfb (BC Econ) ECON2228 Notes / 54

Autocorrelation. Think of autocorrelation as signifying a systematic relationship between the residuals measured at different points in time

Jeffrey M. Wooldridge Michigan State University

BIOSTATS 640 Spring 2018 Unit 2. Regression and Correlation (Part 1 of 2) STATA Users

Econometrics II Censoring & Truncation. May 5, 2011

ECON Introductory Econometrics. Lecture 6: OLS with Multiple Regressors

Week 3: Simple Linear Regression

Panel Data: Very Brief Overview Richard Williams, University of Notre Dame, Last revised April 6, 2015

7 Introduction to Time Series

Graduate Econometrics Lecture 4: Heteroskedasticity

Lecture 4: Multivariate Regression, Part 2

Statistical Modelling in Stata 5: Linear Models

Section Least Squares Regression

Problem Set #3-Key. wage Coef. Std. Err. t P> t [95% Conf. Interval]

10) Time series econometrics

Final Exam. Question 1 (20 points) 2 (25 points) 3 (30 points) 4 (25 points) 5 (10 points) 6 (40 points) Total (150 points) Bonus question (10)

Essential of Simple regression

Econometrics. 9) Heteroscedasticity and autocorrelation

ECON2228 Notes 7. Christopher F Baum. Boston College Economics. cfb (BC Econ) ECON2228 Notes / 41

Auto correlation 2. Note: In general we can have AR(p) errors which implies p lagged terms in the error structure, i.e.,

T-test: means of Spock's judge versus all other judges 1 12:10 Wednesday, January 5, judge1 N Mean Std Dev Std Err Minimum Maximum

Measurement Error. Often a data set will contain imperfect measures of the data we would ideally like.

Econometrics. 8) Instrumental variables

Lecture#12. Instrumental variables regression Causal parameters III

Control Function and Related Methods: Nonlinear Models

Section I. Define or explain the following terms (3 points each) 1. centered vs. uncentered 2 R - 2. Frisch theorem -

Interpreting coefficients for transformed variables

Question 1 [17 points]: (ch 11)

ANALYSES OF NCGS DATA FOR ALCOHOL STATUS CATEGORIES 1 22:46 Sunday, March 2, 2003

SOCY5601 Handout 8, Fall DETECTING CURVILINEARITY (continued) CONDITIONAL EFFECTS PLOTS

Multiple Regression: Inference

5. Let W follow a normal distribution with mean of μ and the variance of 1. Then, the pdf of W is

unadjusted model for baseline cholesterol 22:31 Monday, April 19,

Description Quick start Menu Syntax Options Remarks and examples Stored results Methods and formulas Acknowledgment References Also see

Course Econometrics I

2.1. Consider the following production function, known in the literature as the transcendental production function (TPF).

Эконометрика, , 4 модуль Семинар Для Группы Э_Б2015_Э_3 Семинарист О.А.Демидова

Lab 6 - Simple Regression

Econometrics I KS. Module 1: Bivariate Linear Regression. Alexander Ahammer. This version: March 12, 2018

Specification Error: Omitted and Extraneous Variables

data proc sort proc corr run proc reg run proc glm run proc glm run proc glm run proc reg CONMAIN CONINT run proc reg DUMMAIN DUMINT run proc reg

. *DEFINITIONS OF ARTIFICIAL DATA SET. mat m=(12,20,0) /*matrix of means of RHS vars: edu, exp, error*/

Instrumental Variables, Simultaneous and Systems of Equations

ECON Introductory Econometrics. Lecture 4: Linear Regression with One Regressor

Final Exam. 1. Definitions: Briefly Define each of the following terms as they relate to the material covered in class.

Econ 836 Final Exam. 2 w N 2 u N 2. 2 v N

Course Econometrics I

Transcription:

****Lab 4, Feb 4: EDA and OLS and WLS ------- log: C:\Documents and Settings\Default\Desktop\LDA\Data\cows_Lab4.log log type: text opened on: 4 Feb 2004, 09:26:19. use use "Z:\LDA\DataLDA\cowsP.dta", clear. set matsize 100. l in 1/3 +---------------------------+ id diet week prot --------------------------- 1. 1 barley 1 3.63 2. 1 barley 2 3.57 3. 1 barley 3 3.47 +---------------------------+. sort id week diet. twoway line prot week if diet=="barley", c(l) s(.). twoway line prot week if diet=="mixed", c(l) s(.) Protein content 2.5 3 3.5 4 4.5 Protein content 2.5 3 3.5 4 4.5. ksm prot week if diet=="barley", gen(sm1) lowess bw(.6)

Lowess smoother Protein content 2.5 3 3.5 4 4.5 bandwidth =.6. ksm prot week if diet=="mixed", gen(sm2) lowess bw(.6) nograph. ksm prot week if diet=="lupins", gen(sm3) lowess bw(.6) nograph. label var sm1 "barley". label var sm2 "mixed". label var sm3 "lupins". twoway line sm1 sm2 sm3 week, s(x). sort week. twoway line sm1 sm2 sm3 week, s(x) barley/mixed/lupins 3.2 3.4 3.6 3.8 barley lupins mixed. drop sm1 sm2 sm3. tsset id week panel variable: id, 1 to 79 time variable: week, 1 to 19. xtdes id: 1, 2,..., 79 n = 79 week: 1, 2,..., 19 T = 19

Delta(week) = 1; (19-1)+1 = 19 (id*week uniquely identifies each observation) Distribution of T_i: min 5% 25% 50% 75% 95% max 19 19 19 19 19 19 19 Freq. Percent Cum. Pattern ---------------------------+--------------------- 79 100.00 100.00 1111111111111111111 ---------------------------+--------------------- 79 100.00 XXXXXXXXXXXXXXXXXXX. xtsumcorr prot Variable Mean Std. Dev. Min Max Observations -----------------+--------------------------------------------+---------------- prot overall 3.422446.3317504 2.45 4.59 N = 1337 between.1966526 2.937895 3.896842 n = 79 within.2670789 2.675112 4.528235 T-bar = 16.9241 corr. between.1852145 corr. within.2752343 rho.3117 (betw. fract. of total). xtgraph prot, group(diet) bar(no). variogram prot, discrete Computing ANOVA model for v in ulag Variogram of prot (13 percent of v_ijk's excluded).2 v_ijk.1 0 u_ijk. reshape wide (note: j = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19) Data long -> wide Number of obs. 1501 -> 79 Number of variables 4 -> 21 j variable (19 values) week -> (dropped) xij variables: prot -> prot1 prot2... prot19. graph matrix prot1- prot19, half. reshape long (note: j = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19) Data wide -> long

Number of obs. 79 -> 1501 Number of variables 21 -> 4 j variable (19 values) -> week xij variables: prot1 prot2... prot19 -> prot *** OLS. by diet: reg prot week -> diet = barley Source SS df MS Number of obs = 425 -------------+------------------------------ F( 1, 423) = 0.03 Model.003319269 1.003319269 Prob > F = 0.8570 Residual 43.2010991 423.102130258 R-squared = 0.0001 -------------+------------------------------ Adj R-squared = -0.0023 Total 43.2044184 424.101897213 Root MSE =.31958 prot Coef. Std. Err. t P> t [95% Conf. Interval] week -.0005398.0029943-0.18 0.857 -.0064253.0053457 _cons 3.536912.0316892 111.61 0.000 3.474624 3.5992 -> diet = lupins Source SS df MS Number of obs = 453 -------------+------------------------------ F( 1, 451) = 20.14 Model 2.19538392 1 2.19538392 Prob > F = 0.0000 Residual 49.1658411 451.109015169 R-squared = 0.0427 -------------+------------------------------ Adj R-squared = 0.0406 Total 51.361225 452.113631029 Root MSE =.33017 prot Coef. Std. Err. t P> t [95% Conf. Interval] week -.0135057.0030096-4.49 0.000 -.0194203 -.0075912 _cons 3.435963.0316069 108.71 0.000 3.373848 3.498078 -> diet = mixed Source SS df MS Number of obs = 459 -------------+------------------------------ F( 1, 457) = 2.39 Model.217499492 1.217499492 Prob > F = 0.1231 Residual 41.6488597 457.09113536 R-squared = 0.0052 -------------+------------------------------ Adj R-squared = 0.0030 Total 41.8663592 458.091411265 Root MSE =.30189 prot Coef. Std. Err. t P> t [95% Conf. Interval] week -.0042163.0027293-1.54 0.123 -.0095798.0011472 _cons 3.468386.0287369 120.69 0.000 3.411913 3.524859

**WLS, with uniform correlation structure. by diet: xtreg prot week, re i(id) -> diet = barley Random-effects GLS regression Number of obs = 425 Group variable (i): id Number of groups = 25 R-sq: within = 0.0036 Obs per group: min = 12 between = 0.0777 avg = 17.0 overall = 0.0001 max = 19 Random effects u_i ~ Gaussian Wald chi2(1) = 1.20 corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.2742 week -.0027185.0024862-1.09 0.274 -.0075914.0021545 _cons 3.550844.0453542 78.29 0.000 3.461952 3.639737 sigma_u.18568774 sigma_e.25986115 rho.33801291 (fraction of variance due to u_i) The within subjects correlation is.33 -> diet = lupins Random-effects GLS regression Number of obs = 453 Group variable (i): id Number of groups = 27 R-sq: within = 0.0426 Obs per group: min = 12 between = 0.1287 avg = 16.8 overall = 0.0427 max = 19 Random effects u_i ~ Gaussian Wald chi2(1) = 20.03 corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000 week -.0114969.0025687-4.48 0.000 -.0165315 -.0064623 _cons 3.426385.0441529 77.60 0.000 3.339847 3.512923 sigma_u.18282608 sigma_e.27580347 rho.3052743 (fraction of variance due to u_i) -> diet = mixed Random-effects GLS regression Number of obs = 459 Group variable (i): id Number of groups = 27 R-sq: within = 0.0061 Obs per group: min = 14 between = 0.0016 avg = 17.0 overall = 0.0052 max = 19 Random effects u_i ~ Gaussian Wald chi2(1) = 2.68 corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.1015

week -.0042377.0025874-1.64 0.101 -.0093089.0008335 _cons 3.468665.0345676 100.34 0.000 3.400914 3.536416. ** WLS Exponential correlation structure. by diet: xtgls prot week, igls corr(ar1) i(id) force -> diet = barley Iteration 1: tolerance = 0 Cross-sectional time-series FGLS regression Coefficients: generalized least squares Panels: homoskedastic Correlation: common AR(1) coefficient for all panels (0.5735) Estimated covariances = 1 Number of obs = 425 Estimated autocorrelations = 1 Number of groups = 25 Estimated coefficients = 2 Obs per group: min = 12 avg = 17 max = 19 Wald chi2(1) = 5.31 Log likelihood =.1876523 Prob > chi2 = 0.0212 week -.009953.0043188-2.30 0.021 -.0184177 -.0014882 _cons 3.63699.0472798 76.92 0.000 3.544323 3.729656 -> diet = lupins Iteration 1: tolerance = 0 Cross-sectional time-series FGLS regression Coefficients: generalized least squares Panels: homoskedastic Correlation: common AR(1) coefficient for all panels (0.5408) Estimated covariances = 1 Number of obs = 453 Estimated autocorrelations = 1 Number of groups = 27 Estimated coefficients = 2 Obs per group: min = 12 avg = 16.77778 max = 19 Wald chi2(1) = 25.11 Log likelihood = -25.08133 Prob > chi2 = 0.0000 week -.0211642.0042236-5.01 0.000 -.0294423 -.012886 _cons 3.521171.0456852 77.07 0.000 3.431629 3.610712

-> diet = mixed Iteration 1: tolerance = 0 Cross-sectional time-series FGLS regression Coefficients: generalized least squares Panels: homoskedastic Correlation: common AR(1) coefficient for all panels (0.4469) Estimated covariances = 1 Number of obs = 459 Estimated autocorrelations = 1 Number of groups = 27 Estimated coefficients = 2 Obs per group: min = 14 avg = 17 max = 19 Wald chi2(1) = 9.42 Log likelihood = -30.29571 Prob > chi2 = 0.0021 week -.0114099.0037174-3.07 0.002 -.0186959 -.0041238 _cons 3.544331.0399384 88.74 0.000 3.466053 3.622609. log close log: C:\Documents and Settings\Default\Desktop\LDA\Data\cows_Lab4.log log type: text closed on: 4 Feb 2004, 10:04:40 -------