Dealing with data All variables ok? / getting acquainted Base model Final model(s) Assumption checking on final model(s) Conclusion(s) / Inference Better.

Slides:



Advertisements
Similar presentations
ASSUMPTION CHECKING In regression analysis with Stata
Advertisements

Week 13 November Three Mini-Lectures QMM 510 Fall 2014.
AMMBR - final stuff xtmixed (and xtreg) (checking for normality, random slopes)
AMMBR from xtreg to xtmixed (+checking for normality, random slopes)
© Department of Statistics 2012 STATS 330 Lecture 32: Slide 1 Stats 330: Lecture 32.
Toolkit + “show your skills” AMMBR from xtreg to xtmixed (+checking for normality, and random slopes, and cross-classified models, and then we are almost.
Inference for Regression
/k 2DS00 Statistics 1 for Chemical Engineering lecture 4.
Prediction, Correlation, and Lack of Fit in Regression (§11. 4, 11
Advanced Methods and Models in Behavioral Research – 2014 Been there / done that: Stata Logistic regression (……) Conjoint analysis Coming up: Multi-level.
AMMBR from xtreg to xtmixed (+checking for normality, and random slopes, and cross-classified models, and then we are done in terms of theory)
Multiple Linear Regression Model
Feb 21, 2006Lecture 6Slide #1 Adjusted R 2, Residuals, and Review Adjusted R 2 Residual Analysis Stata Regression Output revisited –The Overall Model –Analyzing.
Statistics for Managers Using Microsoft® Excel 5th Edition
Statistics for Managers Using Microsoft® Excel 5th Edition
Statistics 350 Lecture 21. Today Last Day: Tests and partial R 2 Today: Multicollinearity.
1 BA 275 Quantitative Business Methods Residual Analysis Multiple Linear Regression Adjusted R-squared Prediction Dummy Variables Agenda.
Multivariate Data Analysis Chapter 4 – Multiple Regression.
January 6, morning session 1 Statistics Micro Mini Multiple Regression January 5-9, 2008 Beth Ayers.
Lecture 19: Tues., Nov. 11th R-squared (8.6.1) Review
Lecture 24: Thurs., April 8th
Lecture 20 Simple linear regression (18.6, 18.9)
Statistical Analysis SC504/HS927 Spring Term 2008 Session 7: Week 23: 7 th March 2008 Complex independent variables and regression diagnostics.
Regression Diagnostics Checking Assumptions and Data.
Basic Business Statistics, 11e © 2009 Prentice-Hall, Inc. Chap 15-1 Chapter 15 Multiple Regression Model Building Basic Business Statistics 11 th Edition.
Stat 112: Lecture 9 Notes Homework 3: Due next Thursday
Finding help. Stata manuals You have all these as pdf! Check the folder /Stata12/docs.
Multiple Regression Dr. Andy Field.
Copyright ©2011 Pearson Education 15-1 Chapter 15 Multiple Regression Model Building Statistics for Managers using Microsoft Excel 6 th Global Edition.
Forecasting Revenue: An Example of Regression Model Building Setting: Possibly a large set of predictor variables used to predict future quarterly revenues.
Objectives of Multiple Regression
Copyright ©2011 Pearson Education, Inc. publishing as Prentice Hall 15-1 Chapter 15 Multiple Regression Model Building Statistics for Managers using Microsoft.
Today’s program Herwart / Axel: Kiva intro (the Galak et al. paper) Follow-up questions Non-response (and respondent list) Multi-level models in Stata.
Typical paper follow-ups Paper is wrong (in the sense of a real mistake) There is an alternative explanation for the analytical results. You test that.
MultiCollinearity. The Nature of the Problem OLS requires that the explanatory variables are independent of error term But they may not always be independent.
Forecasting Revenue: An Example of Regression Model Building Setting: Possibly a large set of predictor variables used to predict future quarterly revenues.
Advanced Methods and Models in Behavioral Research – 2010/2011 AMMBR course design CONTENT METHOD Y is 0/1 conjoint analysis logistic regression multi-level.
1 1 Slide © 2007 Thomson South-Western. All Rights Reserved Chapter 13 Multiple Regression n Multiple Regression Model n Least Squares Method n Multiple.
2 Multicollinearity Presented by: Shahram Arsang Isfahan University of Medical Sciences April 2014.
Multiple Regression and Model Building Chapter 15 Copyright © 2014 by The McGraw-Hill Companies, Inc. All rights reserved.McGraw-Hill/Irwin.
Anaregweek11 Regression diagnostics. Regression Diagnostics Partial regression plots Studentized deleted residuals Hat matrix diagonals Dffits, Cook’s.
Dr. C. Ertuna1 Issues Regarding Regression Models (Lesson - 06/C)
Week 5Slide #1 Adjusted R 2, Residuals, and Review Adjusted R 2 Residual Analysis Stata Regression Output revisited –The Overall Model –Analyzing Residuals.
REGRESSION DIAGNOSTICS Fall 2013 Dec 12/13. WHY REGRESSION DIAGNOSTICS? The validity of a regression model is based on a set of assumptions. Violation.
Assumption checking in “normal” multiple regression with Stata.
Multiple Regression INCM 9102 Quantitative Methods.
Multiple regression.
Statistics for Managers Using Microsoft Excel, 4e © 2004 Prentice-Hall, Inc. Chap 14-1 Chapter 14 Multiple Regression Model Building Statistics for Managers.
I271B QUANTITATIVE METHODS Regression and Diagnostics.
Advanced Methods and Models in Behavioral Research – 2009/2010 AMMBR course design CONTENT METHOD Y is 0/1 conjoint analysis logistic regression multi-level.
Applied Quantitative Analysis and Practices LECTURE#30 By Dr. Osman Sadiq Paracha.
Ch15: Multiple Regression 3 Nov 2011 BUSI275 Dr. Sean Ho HW7 due Tues Please download: 17-Hawlins.xls 17-Hawlins.xls.
Basic Business Statistics, 10e © 2006 Prentice-Hall, Inc. Chap 15-1 Chapter 15 Multiple Regression Model Building Basic Business Statistics 10 th Edition.
Statistics for Managers Using Microsoft Excel, 4e © 2004 Prentice-Hall, Inc. Chap 14-1 Chapter 14 Multiple Regression Model Building Statistics for Managers.
More on regression Petter Mostad More on indicator variables If an independent variable is an indicator variable, cases where it is 1 will.
Stata – be the master Stata. “After I have run my standard commands, what can I do to make my model better (and understand better what is going on)?”
Assumptions & Requirements.  Three Important Assumptions 1.The errors are normally distributed. 2.The errors have constant variance (i.e., they are homoscedastic)
Data Screening. What is it? Data screening is very important to make sure you’ve met all your assumptions, outliers, and error problems. Each type of.
Regression Analysis Part A Basic Linear Regression Analysis and Estimation of Parameters Read Chapters 3, 4 and 5 of Forecasting and Time Series, An Applied.
Predicting Energy Consumption in Buildings using Multiple Linear Regression Introduction Linear regression is used to model energy consumption in buildings.
Chapter 15 Multiple Regression Model Building
Kakhramon Yusupov June 15th, :30pm – 3:00pm Session 3
Regression Diagnostics
Multiple Regression.
Chapter 12: Regression Diagnostics
Fundamentals of regression analysis
Multiple Regression A curvilinear relationship between one variable and the values of two or more other independent variables. Y = intercept + (slope1.
Chapter 4, Regression Diagnostics Detection of Model Violation
Regression Forecasting and Model Building
Chapter 13 Additional Topics in Regression Analysis
Presentation transcript:

Dealing with data All variables ok? / getting acquainted Base model Final model(s) Assumption checking on final model(s) Conclusion(s) / Inference Better models Better variables (interaction, transformations) Assumption checking Outliers and influential cases Creating subsets of the data Better models Better variables (interaction, transformations) Assumption checking Outliers and influential cases Creating subsets of the data

Finding help

Stata manuals You have all these as pdf! Check the folder /Stata12/docs

ASSUMPTION CHECKING AND OTHER NUISANCES In regression analysis with Stata In logistic regression analysis with Stata NOTE: THIS WILL BE EASIER IN Stata THAN IT WAS IN SPSS

Assumption checking in “normal” multiple regression with Stata

6 Assumptions in regression analysis No multi-collinearity All relevant predictor variables included Homoscedasticity: all residuals are from a distribution with the same variance Linearity: the “true” model should be linear. Independent errors: having information about the value of a residual should not give you information about the value of other residuals Errors are distributed normally

7 FIRST THE ONE THAT LEADS TO NOTHING NEW IN STATA (NOTE: SLIDE TAKEN LITERALLY FROM MMBR) Independent errors: having information about the value of a residual should not give you information about the value of other residuals Detect: ask yourself whether it is likely that knowledge about one residual would tell you something about the value of another residual. Typical cases: -repeated measures -clustered observations (people within firms / pupils within schools) Consequences: as for heteroscedasticity Usually, your confidence intervals are estimated too small (think about why that is!). Cure: use multi-level analyses  part 2 of this course

The rest, in Stata: Example: the Stata “auto.dta” data set sysuse auto corr (correlation) vif (variance inflation factors) ovtest (omitted variable test) hettest (heterogeneity test) predict e, resid swilk(test for normality)

Finding the commands “help regress”  “regress postestimation” and you will find most of them (and more) there

10 Multi-collinearity A strong correlation between two or more of your predictor variables You don’t want it, because: 1.It is more difficult to get higher R’s 2.The importance of predictors can be difficult to establish (b-hats tend to go to zero) 3.The estimates for b-hats are unstable under slightly different regression attempts (“bouncing beta’s”) Detect: 1.Look at correlation matrix of predictor variables 2.calculate VIF-factors while running regression Cure: Delete variables so that multi-collinearity disappears, for instance by combining them into a single variable

11 Stata: calculating the correlation matrix (“corr” or “pwcorr”) and VIF statistics (“vif”)

12 Misspecification tests (replaces: all relevant predictor variables included [Ramsey]) Also run “ovtest, rhs” here. Both tests should be non-significant. Note that there are two ways to interpret “all relevant predictor variables included”

13 Homoscedasticity: all residuals are from a distribution with the same variance Consequences: Heteroscedasticiy does not necessarily lead to biases in your estimated coefficients (b-hat), but it does lead to biases in the estimate of the width of the confidence interval, and the estimation procedure itself is not efficient.

Testing for heteroscedasticity in Stata Your residuals should have the same variance for all values of Y  hettest Your residuals should have the same variance for all values of X  hettest, rhs

15 Errors distributed normally Errors should be distributed normally (just the errors, not the variables themselves!) Detect: look at the residual plots, test for normality, or save residuals and test directly Consequences: rule of thumb: if n>600, no problem. Otherwise confidence intervals are wrong. Cure: try to fit a better model (or use more difficult ways of modeling instead - ask an expert).

First calculate the residuals (after regress): predict e, resid Then test for normality swilk e Errors distributed normally

Assumption checking in multi-level multiple regression with Stata

In multi-level Test all that you would test for multiple regression – poor man’s test: do this using multiple regression! (e.g. “hettest”) Add: xttest0 (see last week) Add (extra): Test visually whether the normality assumption holds 

Note: extra material (= not on the exam, bonus points if you know how to use it) tab school, gen(sch_) reg y sch2 – sch28 gen coefs =. for num 2/28: replace coefs =_b[schX] if _n==X swilk coefs

Assumption checking in logistic regression with Stata Note: based on books/logistic/chapter3/statalog3.ht m

Assumptions in logistic regression Y is 0/1 Independence of errors (as in multiple regression) No cases where you have complete separation (Stata will try to remove these cases automatically) Linearity in the logit (comparable to “the true model should be linear” in multiple regression) – “specification error” No multi-collinearity (as in m.r.)

What will happen if you try logit y x1 x2 in this case?

This! Because all cases with x==1 lead to y==1, the weight of x should be +infinity. Stata therefore rightly disregards these cases. Do realize that, even though you do not see them in the regression, these are extremely important cases!

(checking for) multi-collinearity In regression, we had “vif” Here we need to download a command that a user-created: “collin” (try “findit collin” in Stata)

(checking for) specification error The equivalent for “ovtest” is the command “linktest”

(checking for) specification error – part 2

Further things to do: Check for useful transformations of variables, and interaction effects Check for outliers / influential cases: 1) using a plot of stdres (against n) and dbeta (against n) 2) using a plot of ldfbeta’s (against n) 3) using regress and diag (but don’t tell anyone that I suggested this)

Checking for outliers / influential cases … check the file auto_outliers.do for this …

Dealing with data All variables ok? / getting acquainted Base model Final model(s) Assumption checking on final model(s) Conclusion(s) / Inference Better models Better variables (interaction, transformations) Assumption checking Outliers and influential cases Creating subsets of the data Better models Better variables (interaction, transformations) Assumption checking Outliers and influential cases Creating subsets of the data

Example analyses on ideas.dta

For next week: improve the logistic regression you had Annotated output: as if you write an exam assignment... 1.Create do-file with comments in it 2.Run it and add further comments on the outcomes in the log file 3.Submit do-file and log-file Use your own assignment, and the skills you mastered today. Deadline: coming Wednesday

Online also: the taxi tipping data