Birkbeck College Department of Economics, Mathematics and Statistics.

Size: px
Start display at page:

Download "Birkbeck College Department of Economics, Mathematics and Statistics."

Transcription

1 Birkbeck College Department of Economics, Mathematics and Statistics. Graduate Certificates and Diplomas Economics, Finance, Financial Engineering 2012 Applied Statistics and Econometrics INTRODUCTION TO STATA Elisa Cavatorta

2 CONTENTS 1. THE BASICS OF WORKING WITH STATA 1.1. A note to start 1.2. The Stata Windows 1.3. Knowing where you are 1.4. Creating a do-file 1.5. Creating a log-file 1.6. Importing the data 1.7. Labelling and rename 1.8. Preliminary steps and general terminology 1.9. Connectors 2. TODAY s RESEARCH PROJECT 2.1. Looking at the data 2.2. Descriptive statistics 2.3. Generating new variables 2.4. Linear regression 2.5. Post-estimation: predicted values and diagnostics Misspecification Heteroskedasticity 2.6. Comparing competing models: measures of fit 2.7. Hypothesis testing 2.8. Marginal effects 2.9. Presenting regression results A.1 A notes on Stata with Time-series A.2 Sources and References A.3 List of regression commands

3 1 THE BASICS OF WORKING WITH STATA 1.1 A note to start These notes aim to introduce you to the basics of working with Stata. Stata is a power software for data analysis, implementing a huge range of techniques. These notes are based on Stata 12 available on Birkbeck College labs. A word of warning: using Stata is a learning process, do not be discouraged by error messages! 1.2 The STATA Windows The window labeled Command is where you type your commands. Stata then shows the results in the larger black window above. Your command is added to a list in the window labeled Review on the left, so you can keep track of the commands you have used. The window labeled Variables, on the top right, lists the variables in your dataset. The Properties window immediately below that, new in version 12, displays properties of your variables and dataset. 1.3 Knowing where you are The command cd gives you where Stata is working and saving files. You can change it by typing a new location cd "C:\Users\ELISA\MyASEProjects\ 1.4 Creating a Do-file Always create a do-file to track what you did. A do file is just a set of Stata commands typed in a plain text file. You can use Stata's own built-in do-file Editor, which has the great advantage that you can run your program directly from the editor by clicking on the run icon. 1.5 A log file To keep a permanent record of your results, however, you should log your session. When you open a log, Stata writes all results to both the Results window and to the file you specify. To open a log file use the command log using filename, text replace where filename is the name of your log file. Note the use of two recommended options: text and replace. text option creates logs in plain text (ASCII) format, which can be viewed in an editor. replace option replaces the old version. If you use the Menu windows Log => Begin, by default the log is written using SMCL, Stata Markup and Control Language (pronounced "smicle"). You need to use the translate command to convert it to plain text.

4 1.6 Importing the data If the data are in STATA format (.dta) you can import them directly. Go to File=> Open => browse to the data location. This is equivalent to type: use houseprice.dta, clear If the data are in another format you need to import the differently. Go to File => import => (choose the data type you have) Excel spreadsheet [.xls]/ text data created by a spreadsheet [.csv]. Equivalent to type: insheet using " HousePrice.csv", comma import excel " HousePrice.xls", sheet("houseprice") firstrow You can see your data from the Data Editor button. 1.7 Labelling and rename label var price "median price of single-family home" rename room rooms 1.8 Preliminary steps and general terminology Stata needs to know which typology of data you are using. Simple cross-sectional data do not need to be declared. Time-series data: tsset year, yearly Survey data with complex strata PSU: svy. Panel data: tsset panelvar timevar. Few additional useful things. If you need more space you can ask it here s a typical set up: set mem 10m (to set memory size) set more off (to let the output on the screen to run until the end of the command) Options: everything that is followed by a comma (,) is an optional command. Help: typing help command gives you explanation about a command. Let s try with help use 1.9 Connectors & and or > strictly greater, < strictly smaller == equals >= greater or equal to

5 2. TODAY S RESEARCH PROJECT: single-family housing prices We want to analyse the influence on house prices exerted by several external factors. We illustrate this with data on 506 Boston Communities housing price data. The response variable is the logarithm of the median price of a signle-family home in each community. The external factors under consideration include a measure of air pollution (lnox, the log of nitrous oxide in parts per 100m), the distance from the community to employment centers (ldist, the log of the weighted distance to five employment centers), the average student-teacher ratio in local schools (stratio). 2.1 Looking at the data Be aware of what is in your dataset and which type of variables. You can describe the data by describe Always plot your data: graphs contain a lot of information. Explore the number of possibilities of graphs in Graphics on the Menu list. To create a single plot type overlaid by normal distribution: histogram price, bin(30) normal To create a two ways scatter plot of house prices and number of rooms. twoway (scatter price rooms, sort) scatter is the type of connector (with time series you want line). sort is the option to sort on x variable. What can you say about the relationship? Which correlation do you expect? twoway (scatter price dist, sort) What can you say about the relationship? 2.2 Descriptive statistics summarize command followed by the names of the variables (which can be omitted to summarize everything). For more detailed statistics, use summarize [varlist], detail summarize summarize price, det summarize price if rooms > 6.28 A note: stata wants > (strictly greater), < (strictly smaller) or == (equal). histogram price, bins(22) normal Is the variable normal distributed? You can test this formally by the Skewness/Kurtosis test for Normality sktest price How do the variables correlate and at which level of significance? Are there collinear variables

6 pwcorr price rooms nox dist stratio, sig 2.3 Generating new variables: generate, egen, replace To compute a new variable use the generate command with a new variable name and an arithmetic expression. Choose variable names that are easy and remind you what the variable is about. Remind that Stata commands are case sensitive. Let s generate the logs of housing price generate lprice = log(price) Logs variables may help with heteroskedasticity and normality. Check that lprice approximate better a normal distribution, e.g. histogram lprice, bins(22). A useful command to create a new variable that satisfies certain condition is generate newvariable = cond(variable x == a, 1, 0) which tells that if the condition variable x == a is satisfied the new variable should take the value of 1, otherwise it is 0. A useful extension to generate is egen. Type help egen for a full list of possibilities. 2.4 Linear regression Stata can do a lot of fancy regressions. The syntax for most of them is very similar. We will focus on this is the most basic form of linear regression. regress fits a model of depvar on varlist using linear regression. By default it includes the constant term. The help regress command will bring up the following instructions for using regress. regress lprice rooms lnox ldist stratio * The top-left corner gives the ANOVA decomposition of the sum of squares in the dependent variable (Total) into the explained (Model) and unexplained (Residual). * The top-right corner reports the statistical significance results for the model as a whole. * The bottom section gives the results for the individual explanatory variables. Useful options The regress command can be used with the robust option for estimating the standard errors using the Huber-White sandwich estimator (to correct the standard errors for heteroscedasticity). 2.5 Post-estimation: predicted values and diagnostics A number of predicted values can be obtained after all estimation commands listed above. The most important are the predicted values for the dependent variable and the predicted residuals. regress lprice rooms nox dist stratio predict lpricehat, xb label var lprice Predicted log price predict uhat, residual

7 before looking at the coefficients you need to make sure your regression is sufficiently healthy. There are a number of diagnostic tests available in Stata. Type help regress postestimation for a list of available tests. twoway (scatter lpricehat lprice) (line lprice lprice if lprice <., clwidth(thin) ), ytitle( Predicted log median housing price ) xtitle( Actual log median housing price ) legend(off) rvfplot, yline(0) Misspecification Misspecification may arise because the true model specifies a nonlinear relationship and we omit a squared term. One way of testing this is the RESET test. The RESET tests runs an augmented regression that include the original regressors, powers of the predicted values and powers of the original regressors. The null hypothesis tested is no misspecification. Under the null hypothesis of no-misspecification, the coefficients of the additional regressors are zero. estat ovtest rvpplot ldist, ms(0h) yline(0) The residual is more variable for low level of log distance. Hence, the hypothesis of homoskedasticity is untenable Heteroskedasticity The Breusch Pagan test of the null hypothesis of homoskedasticity is implemented by estat hettest 2.6 Comparing competing models: measures of fit You should be able to comment on the R 2, adj R 2 and SER. You can also check the Information Criteria. estat ic estat ic will display the log likelihood of the null model (only a constant term), the log likelihood of the fitted model and the AIC and BIC statistics. Lower values indicate better fit. For example, try to adjust the previous model by taking the log of the distance and adding a squared term. Any improvements? Compare the measures of fit. gen ldist2 = ldist^2 label var dist2 "Log Distance squared" regress lprice rooms lnox ldist ldist2 stratio gen rooms2 = rooms^2 regress lprice rooms rooms2 lnox ldist ldist2 stratio lproptax 2.7 Hypothesis testing The regression output automatically includes a two-sided t-test (for linear regressions) on the null hypothesis that the true coefficient is equal to zero for each independent variable. Two equivalent formulations: test _b[rooms] = 0

8 test rooms Let s suppose the theory suggests that the coefficient on variable rooms should be This is testable by test rooms = 0.33 You can test arbitrary restrictions, such as that the three coefficients equal zero lincom rooms + ldist + stratio You can test equality of two coefficients by test ldist = stratio 2.8 Marginal effects The command mfx computes marginal effects or elasticities after estimation. The option eyex computes the elasticity of y with respect to x, equivalent to the marginal effect in the log-log specification. regress price rooms nox dist stratio mfx, eyex You will find rooms to be elastic, having almost twice as large an effect on price in proportional terms. nox dist are inelastic, with estimated elasticity within the unit interval. 2.9 Presenting regression results It is generally good practise to present competing models to support your analysis. In the text of your project you need to justify which model you consider the best fitting model. You need to estimate all models first, save the estimation results (estimates store) and create a table. Here is an example quietly regress lprice rooms est store m1 quietly regress lprice rooms lnox ldist stratio est store m2 quietly regress lprice rooms lnox ldist ldist2 stratio lproptax est store m3 quietly regress lprice rooms rooms2 lnox ldist ldist2 stratio lproptax est store m4 estout m1 m2 m3 m4, stats(r2_a rmse aic) cells(b(star fmt(%8.3f)) /// se(par fmt(%6.3f))) starlevels(* 0.1 ** 0.05 *** 0.01)

9 A.1 A Note on Stata for time-series Stata has many build-in command for analysing time-series data. First, you need to tell Stata you are using time-series data. You do this by typing tsset timevariable (e.g. tsset year) You can find tests for univariate time-series, such as ADF in Statistics=> Time series => Tests Diagnostics tests after regression commands, such as Durbin Watson test, Godfrey LM test and heteroskedasticity test can be found in Statistics=> Time series => Tests => Time Series specification test after regress Line plots, correlograms, autocorrelation graphs can be found in Statistics=> Time series => Graphs More complex analysis for multivariate time series such as VAR, VECM and Cointegration tests can be found in Statistics=> Multivariate time series

10 A.2 Sources and References Stata website at Among other things you will find that they make available online all datasets used in the official documentation, that they publish a journal called Stata Journal, and that they have an excellent bookstore with texts on Stata and related statistical subjects. Stata also offers and web-based training courses called NetCourses, see There is an independent listserv where you can post questions and receive prompt and knowledgeable answers from other users. To join the list see and follow the link to subscribe. Stata also maintains a list of frequently asked questions (FAQ) classified by topic, see UCLA maintains an excellent Stata portal at There is a list manuals such as An introduction to Modern Econometrics using Stata by C. Baum. A.3 List of regression commands anova analysis of variance and covariance cnreg censored-normal regression gmm Generalized methods of moments estimator heckman Heckman selection model intreg interval regression ivregress instrumental variables (2SLS) regression newey regression with Newey-West standard errors prais Prais-Winsten, Cochrane-Orcutt, or Hildreth-Lu regression qreg quantile (including median) regression reg ordinary least squares regression reg3 three-stage least squares regression rreg robust regression (NOT robust standard errors) sureg seemingly unrelated regression tobit tobit regression treatreg treatment effects model truncreg truncated regression xtabond Arellano-Bond linear, dynamic panel-data estimator xtintreg panel data interval regression models xtreg fixed- and random-effects linear models xtregar fixed- and random-effects linear models with an AR(1) disturbance xttobit panel data tobit models

Title. Description. time series Introduction to time-series commands

Title. Description. time series Introduction to time-series commands Title time series Introduction to time-series commands Description The Time-Series Reference Manual organizes the commands alphabetically, making it easy to find individual command entries if you know

More information

Getting started with Stata 2017: Cheat-sheet

Getting started with Stata 2017: Cheat-sheet Getting started with Stata 2017: Cheat-sheet 4. september 2017 1 Get started Graphical user interface (GUI). Clickable. Simple. Commands. Allows for use of do-le. Easy to keep track. Command window: Write

More information

A quick introduction to STATA

A quick introduction to STATA A quick introduction to STATA Data files and other resources for the course book Introduction to Econometrics by Stock and Watson is available on: http://wps.aw.com/aw_stock_ie_3/178/45691/11696965.cw/index.html

More information

GETTING STARTED WITH STATA. Sébastien Fontenay ECON - IRES

GETTING STARTED WITH STATA. Sébastien Fontenay ECON - IRES GETTING STARTED WITH STATA Sébastien Fontenay ECON - IRES THE SOFTWARE Software developed in 1985 by StataCorp Functionalities Data management Statistical analysis Graphics Using Stata at UCL Computer

More information

An Introductory Guide to Stata

An Introductory Guide to Stata An Introductory Guide to Stata Scott L. Minkoff Assistant Professor Department of Political Science Barnard College sminkoff@barnard.edu Updated: July 9, 2012 1 TABLE OF CONTENTS ABOUT THIS GUIDE... 4

More information

Serial Correlation and Heteroscedasticity in Time series Regressions. Econometric (EC3090) - Week 11 Agustín Bénétrix

Serial Correlation and Heteroscedasticity in Time series Regressions. Econometric (EC3090) - Week 11 Agustín Bénétrix Serial Correlation and Heteroscedasticity in Time series Regressions Econometric (EC3090) - Week 11 Agustín Bénétrix 1 Properties of OLS with serially correlated errors OLS still unbiased and consistent

More information

A quick introduction to STATA:

A quick introduction to STATA: 1 Revised September 2008 A quick introduction to STATA: (by E. Bernhardsen, with additions by H. Goldstein) 1. How to access STATA from the pc s at the computer lab After having logged in you have to log

More information

Introduction to Stata. Getting Started. This is the simple command syntax in Stata and more conditions can be added as shown in the examples.

Introduction to Stata. Getting Started. This is the simple command syntax in Stata and more conditions can be added as shown in the examples. Getting Started Command Syntax command varlist, option This is the simple command syntax in Stata and more conditions can be added as shown in the examples. Preamble mkdir tutorial /* to create a new directory,

More information

Labor Economics with STATA. Estimating the Human Capital Model Using Artificial Data

Labor Economics with STATA. Estimating the Human Capital Model Using Artificial Data Labor Economics with STATA Liyousew G. Borga December 2, 2015 Estimating the Human Capital Model Using Artificial Data Liyou Borga Labor Economics with STATA December 2, 2015 84 / 105 Outline 1 The Human

More information

Dr. Barbara Morgan Quantitative Methods

Dr. Barbara Morgan Quantitative Methods Dr. Barbara Morgan Quantitative Methods 195.650 Basic Stata This is a brief guide to using the most basic operations in Stata. Stata also has an on-line tutorial. At the initial prompt type tutorial. In

More information

Within these three broad categories, similar commands have been grouped together. Declare data to be time-series data [TS] tsfill

Within these three broad categories, similar commands have been grouped together. Declare data to be time-series data [TS] tsfill Title time series Introduction to time-series commands Description The Time-Series Reference Manual organizes the commands alphabetically, making it easy to find individual command entries if you know

More information

SOCY7706: Longitudinal Data Analysis Instructor: Natasha Sarkisian. Panel Data Analysis: Fixed Effects Models

SOCY7706: Longitudinal Data Analysis Instructor: Natasha Sarkisian. Panel Data Analysis: Fixed Effects Models SOCY776: Longitudinal Data Analysis Instructor: Natasha Sarkisian Panel Data Analysis: Fixed Effects Models Fixed effects models are similar to the first difference model we considered for two wave data

More information

A Quick Guide to Stata 8 for Windows

A Quick Guide to Stata 8 for Windows Université de Lausanne, HEC Applied Econometrics II Kurt Schmidheiny October 22, 2003 A Quick Guide to Stata 8 for Windows 2 1 Introduction A Quick Guide to Stata 8 for Windows This guide introduces the

More information

STATA 13 INTRODUCTION

STATA 13 INTRODUCTION STATA 13 INTRODUCTION Catherine McGowan & Elaine Williamson LONDON SCHOOL OF HYGIENE & TROPICAL MEDICINE DECEMBER 2013 0 CONTENTS INTRODUCTION... 1 Versions of STATA... 1 OPENING STATA... 1 THE STATA

More information

A Short Guide to Stata 10 for Windows

A Short Guide to Stata 10 for Windows A Short Guide to Stata 10 for Windows 1. Introduction 2 2. The Stata Environment 2 3. Where to get help 2 4. Opening and Saving Data 3 5. Importing Data 4 6. Data Manipulation 5 7. Descriptive Statistics

More information

An Introduction to Stata Part II: Data Analysis

An Introduction to Stata Part II: Data Analysis An Introduction to Stata Part II: Data Analysis Kerry L. Papps 1. Overview Do-files Sorting a dataset Combining datasets Creating a dataset of means or medians etc. Weights Panel data capabilities Dummy

More information

A First Tutorial in Stata

A First Tutorial in Stata A First Tutorial in Stata Stan Hurn Queensland University of Technology National Centre for Econometric Research www.ncer.edu.au Stan Hurn (NCER) Stata Tutorial 1 / 66 Table of contents 1 Preliminaries

More information

Introduction to Computing for Sociologists Neustadtl

Introduction to Computing for Sociologists Neustadtl Introduction to Computing for Sociologists Neustadtl Using Regression Regression has a lot of parts, most of it pre- and post- analysis. Do you understand your data? How are your variables measured? Are

More information

A quick introduction to STATA:

A quick introduction to STATA: 1 HG Revised September 2011 A quick introduction to STATA: (by E. Bernhardsen, with additions by H. Goldstein) 1. How to access STATA from the pc s at the computer lab and elsewhere at UiO. At the computer

More information

Intro to Stata. University of Virginia Library data.library.virginia.edu. September 16, 2014

Intro to Stata. University of Virginia Library data.library.virginia.edu. September 16, 2014 to 1/12 Intro to University of Virginia Library data.library.virginia.edu September 16, 2014 Getting to Know to 2/12 Strengths Available A full-featured statistical programming language For Windows, Mac

More information

Revision of Stata basics in STATA 11:

Revision of Stata basics in STATA 11: Revision of Stata basics in STATA 11: April, 2016 Dr. Selim Raihan Executive Director, SANEM Professor, Department of Economics, University of Dhaka Contents a) Resources b) Stata 11 Interface c) Datasets

More information

STATA Tutorial. Introduction to Econometrics. by James H. Stock and Mark W. Watson. to Accompany

STATA Tutorial. Introduction to Econometrics. by James H. Stock and Mark W. Watson. to Accompany STATA Tutorial to Accompany Introduction to Econometrics by James H. Stock and Mark W. Watson STATA Tutorial to accompany Stock/Watson Introduction to Econometrics Copyright 2003 Pearson Education Inc.

More information

Week 10: Heteroskedasticity II

Week 10: Heteroskedasticity II Week 10: Heteroskedasticity II Marcelo Coca Perraillon University of Colorado Anschutz Medical Campus Health Services Research Methods I HSMP 7607 2017 c 2017 PERRAILLON ARR 1 Outline Dealing with heteroskedasticy

More information

Basic Stata Tutorial

Basic Stata Tutorial Basic Stata Tutorial By Brandon Heck Downloading Stata To obtain Stata, select your country of residence and click Go. Then, assuming you are a student, click New Educational then click Students. The capacity

More information

Stata Training. AGRODEP Technical Note 08. April Manuel Barron and Pia Basurto

Stata Training. AGRODEP Technical Note 08. April Manuel Barron and Pia Basurto AGRODEP Technical Note 08 April 2013 Stata Training Manuel Barron and Pia Basurto AGRODEP Technical Notes are designed to document state-of-the-art tools and methods. They are circulated in order to help

More information

ECO375 Tutorial 1 Introduction to Stata

ECO375 Tutorial 1 Introduction to Stata ECO375 Tutorial 1 Introduction to Stata Matt Tudball University of Toronto Mississauga September 14, 2017 Matt Tudball (University of Toronto) ECO375H5 September 14, 2017 1 / 25 What Is Stata? Stata is

More information

CLAREMONT MCKENNA COLLEGE. Fletcher Jones Student Peer to Peer Technology Training Program. Basic Statistics using Stata

CLAREMONT MCKENNA COLLEGE. Fletcher Jones Student Peer to Peer Technology Training Program. Basic Statistics using Stata CLAREMONT MCKENNA COLLEGE Fletcher Jones Student Peer to Peer Technology Training Program Basic Statistics using Stata An Introduction to Stata A Comparison of Statistical Packages... 3 Opening Stata...

More information

A Short Introduction to STATA

A Short Introduction to STATA A Short Introduction to STATA 1) Introduction: This session serves to link everyone from theoretical equations to tangible results under the amazing promise of Stata! Stata is a statistical package that

More information

Introduction to STATA

Introduction to STATA Introduction to STATA Duah Dwomoh, MPhil School of Public Health, University of Ghana, Accra July 2016 International Workshop on Impact Evaluation of Population, Health and Nutrition Programs Learning

More information

Applied Regression Modeling: A Business Approach

Applied Regression Modeling: A Business Approach i Applied Regression Modeling: A Business Approach Computer software help: SAS SAS (originally Statistical Analysis Software ) is a commercial statistical software package based on a powerful programming

More information

From the help desk. Allen McDowell Stata Corporation

From the help desk. Allen McDowell Stata Corporation The Stata Journal (2001) 1, Number 1, pp. 76 85 From the help desk Allen McDowell Stata Corporation amcdowell@stata.com Abstract. Welcome to From the help desk. From the help desk is written by the people

More information

Model Diagnostic tests

Model Diagnostic tests Model Diagnostic tests 1. Multicollinearity a) Pairwise correlation test Quick/Group stats/ correlations b) VIF Step 1. Open the EViews workfile named Fish8.wk1. (FROM DATA FILES- TSIME) Step 2. Select

More information

Important Things to Know about Stata

Important Things to Know about Stata Important Things to Know about Stata Accessing Stata Stata 14.0 is available in all clusters and classrooms on campus. You may also purchase it at a substantial discount through Notre Dame s GradPlan.

More information

Analysis of Panel Data. Third Edition. Cheng Hsiao University of Southern California CAMBRIDGE UNIVERSITY PRESS

Analysis of Panel Data. Third Edition. Cheng Hsiao University of Southern California CAMBRIDGE UNIVERSITY PRESS Analysis of Panel Data Third Edition Cheng Hsiao University of Southern California CAMBRIDGE UNIVERSITY PRESS Contents Preface to the ThirdEdition Preface to the Second Edition Preface to the First Edition

More information

Economics 145 Fall 2009 Howell Getting Started with Stata

Economics 145 Fall 2009 Howell Getting Started with Stata Getting Started with Stata This simple introduction to Stata will allow you to open a dataset and conduct some basic analyses similar to those that we have discussed in Excel. For those who would like

More information

PAM 4280/ECON 3710: The Economics of Risky Health Behaviors Fall 2015 Professor John Cawley TA Christine Coyer. Stata Basics for PAM 4280/ECON 3710

PAM 4280/ECON 3710: The Economics of Risky Health Behaviors Fall 2015 Professor John Cawley TA Christine Coyer. Stata Basics for PAM 4280/ECON 3710 PAM 4280/ECON 3710: The Economics of Risky Health Behaviors Fall 2015 Professor John Cawley TA Christine Coyer Stata Basics for PAM 4280/ECON 3710 I Introduction Stata is one of the most commonly used

More information

set mem 10m we can also decide to have the more separation line on the screen or not when the software displays results: set more on set more off

set mem 10m we can also decide to have the more separation line on the screen or not when the software displays results: set more on set more off Setting up Stata We are going to allocate 10 megabites to the dataset. You do not want to allocate to much memory to the dataset because the more memory you allocate to the dataset, the less memory will

More information

STATA TUTORIAL B. Rabin with modifications by T. Marsh

STATA TUTORIAL B. Rabin with modifications by T. Marsh STATA TUTORIAL B. Rabin with modifications by T. Marsh 5.2.05 (content also from http://www.ats.ucla.edu/stat/spss/faq/compare_packages.htm) Why choose Stata? Stata has a wide array of pre-defined statistical

More information

Introduction to Stata Session 3

Introduction to Stata Session 3 Introduction to Stata Session 3 Tarjei Havnes 1 ESOP and Department of Economics University of Oslo 2 Research department Statistics Norway ECON 3150/4150, UiO, 2015 Before we start 1. In your folder statacourse:

More information

Migration and the Labour Market: Data and Intro to STATA

Migration and the Labour Market: Data and Intro to STATA Migration and the Labour Market: Data and Intro to STATA Prof. Dr. Otto-Friedrich-University of Bamberg, Meeting May 27 and June 9, 2010 Contents of today s meeting 1 Repetition of last meeting Repetition

More information

Intro to E-Views. E-views is a statistical package useful for cross sectional, time series and panel data statistical analysis.

Intro to E-Views. E-views is a statistical package useful for cross sectional, time series and panel data statistical analysis. Center for Teaching, Research & Learning Research Support Group at the CTRL Lab American University, Washington, D.C. http://www.american.edu/provost/ctrl/ 202-885-3862 Intro to E-Views E-views is a statistical

More information

Introduction to Statistical Analyses in SAS

Introduction to Statistical Analyses in SAS Introduction to Statistical Analyses in SAS Programming Workshop Presented by the Applied Statistics Lab Sarah Janse April 5, 2017 1 Introduction Today we will go over some basic statistical analyses in

More information

Introduction to Stata: An In-class Tutorial

Introduction to Stata: An In-class Tutorial Introduction to Stata: An I. The Basics - Stata is a command-driven statistical software program. In other words, you type in a command, and Stata executes it. You can use the drop-down menus to avoid

More information

Workshop for empirical trade analysis. December 2015 Bangkok, Thailand

Workshop for empirical trade analysis. December 2015 Bangkok, Thailand Workshop for empirical trade analysis December 2015 Bangkok, Thailand Cosimo Beverelli (WTO) Rainer Lanz (WTO) Content a. Resources b. Stata windows c. Organization of the Bangkok_Dec_2015\Stata folder

More information

Lab 1: Basics of Stata Short Course on Poverty & Development for Nordic Ph.D. Students University of Copenhagen June 13-23, 2000

Lab 1: Basics of Stata Short Course on Poverty & Development for Nordic Ph.D. Students University of Copenhagen June 13-23, 2000 Lab 1: Basics of Stata Short Course on Poverty & Development for Nordic Ph.D. Students University of Copenhagen June 13-23, 2000 This lab is designed to give you a basic understanding of the tools available

More information

Intro to Stata for Political Scientists

Intro to Stata for Political Scientists Intro to Stata for Political Scientists Andrew S. Rosenberg Junior PRISM Fellow Department of Political Science Workshop Description This is an Introduction to Stata I will assume little/no prior knowledge

More information

Source:

Source: Time Series Source: http://www.princeton.edu/~otorres/stata/ Time series data is data collected over time for a single or a group of variables. Date variable For this kind of data the first thing to do

More information

INTRODUCTION TO PANEL DATA ANALYSIS

INTRODUCTION TO PANEL DATA ANALYSIS INTRODUCTION TO PANEL DATA ANALYSIS USING EVIEWS FARIDAH NAJUNA MISMAN, PhD FINANCE DEPARTMENT FACULTY OF BUSINESS & MANAGEMENT UiTM JOHOR PANEL DATA WORKSHOP-23&24 MAY 2017 1 OUTLINE 1. Introduction 2.

More information

After opening Stata for the first time: set scheme s1mono, permanently

After opening Stata for the first time: set scheme s1mono, permanently Stata 13 HELP Getting help Type help command (e.g., help regress). If you don't know the command name, type lookup topic (e.g., lookup regression). Email: tech-support@stata.com. Put your Stata serial

More information

ECONOMICS 452 TIME SERIES WITH STATA

ECONOMICS 452 TIME SERIES WITH STATA 1 ECONOMICS 452 01 Introduction TIME SERIES WITH STATA This manual is intended for the first half of the Economics 452 course and introduces some of the time series capabilities in Stata 8 I will be writing

More information

Graphics before and after model fitting. Nicholas J. Cox University of Durham.

Graphics before and after model fitting. Nicholas J. Cox University of Durham. Graphics before and after model fitting Nicholas J. Cox University of Durham n.j.cox@durham.ac.uk 1 It is commonplace to compute various flavours of residual and predicted values after fitting many different

More information

Intermediate Stata. Jeremy Craig Green. 1 March /29/2011 1

Intermediate Stata. Jeremy Craig Green. 1 March /29/2011 1 Intermediate Stata Jeremy Craig Green 1 March 2011 3/29/2011 1 Advantages of Stata Ubiquitous in economics and political science Gaining popularity in health sciences Large library of add-on modules Version

More information

Introduction to Stata. Written by Yi-Chi Chen

Introduction to Stata. Written by Yi-Chi Chen Introduction to Stata Written by Yi-Chi Chen Center for Social Science Computation & Research 145 Savery Hall University of Washington Seattle, WA 98195 U.S.A (206)543-8110 September 2002 http://julius.csscr.washington.edu/pdf/stata.pdf

More information

A QUICK INTRODUCTION TO STATA

A QUICK INTRODUCTION TO STATA A QUICK INTRODUCTION TO STATA This module provides a quick introduction to STATA. After completing this module you will be able to input data, save data, transform data, create basic tables, create basic

More information

ECON Stata course, 3rd session

ECON Stata course, 3rd session ECON4150 - Stata course, 3rd session Andrea Papini Heavily based on last year s session by Tarjei Havnes February 4, 2016 Stata course, 3rd session February 4, 2016 1 / 19 Before we start 1. Download caschool.dta

More information

Data analysis using Stata , AMSE Master (M1), Spring semester

Data analysis using Stata , AMSE Master (M1), Spring semester Data analysis using Stata 2016-2017, AMSE Master (M1), Spring semester Notes Marc Sangnier Data analysis using Stata Virtually infinite number of tasks for data analysis. Almost infinite number of commands

More information

INTRODUCTION to. Program in Statistics and Methodology (PRISM) Daniel Blake & Benjamin Jones January 15, 2010

INTRODUCTION to. Program in Statistics and Methodology (PRISM) Daniel Blake & Benjamin Jones January 15, 2010 INTRODUCTION to Program in Statistics and Methodology (PRISM) Daniel Blake & Benjamin Jones January 15, 2010 While we are waiting Everyone who wishes to work along with the presentation should log onto

More information

Stat 500 lab notes c Philip M. Dixon, Week 10: Autocorrelated errors

Stat 500 lab notes c Philip M. Dixon, Week 10: Autocorrelated errors Week 10: Autocorrelated errors This week, I have done one possible analysis and provided lots of output for you to consider. Case study: predicting body fat Body fat is an important health measure, but

More information

An Econometric Study: The Cost of Mobile Broadband

An Econometric Study: The Cost of Mobile Broadband An Econometric Study: The Cost of Mobile Broadband Zhiwei Peng, Yongdon Shin, Adrian Raducanu IATOM13 ENAC January 16, 2014 Zhiwei Peng, Yongdon Shin, Adrian Raducanu (UCLA) The Cost of Mobile Broadband

More information

STAT 2607 REVIEW PROBLEMS Word problems must be answered in words of the problem.

STAT 2607 REVIEW PROBLEMS Word problems must be answered in words of the problem. STAT 2607 REVIEW PROBLEMS 1 REMINDER: On the final exam 1. Word problems must be answered in words of the problem. 2. "Test" means that you must carry out a formal hypothesis testing procedure with H0,

More information

Minitab 17 commands Prepared by Jeffrey S. Simonoff

Minitab 17 commands Prepared by Jeffrey S. Simonoff Minitab 17 commands Prepared by Jeffrey S. Simonoff Data entry and manipulation To enter data by hand, click on the Worksheet window, and enter the values in as you would in any spreadsheet. To then save

More information

GETTING DATA INTO THE PROGRAM

GETTING DATA INTO THE PROGRAM GETTING DATA INTO THE PROGRAM 1. Have a Stata dta dataset. Go to File then Open. OR Type use pathname in the command line. 2. Using a SAS or SPSS dataset. Use Stat Transfer. (Note: do not become dependent

More information

Applied Regression Modeling: A Business Approach

Applied Regression Modeling: A Business Approach i Applied Regression Modeling: A Business Approach Computer software help: SPSS SPSS (originally Statistical Package for the Social Sciences ) is a commercial statistical software package with an easy-to-use

More information

Heteroskedasticity and Homoskedasticity, and Homoskedasticity-Only Standard Errors

Heteroskedasticity and Homoskedasticity, and Homoskedasticity-Only Standard Errors Heteroskedasticity and Homoskedasticity, and Homoskedasticity-Only Standard Errors (Section 5.4) What? Consequences of homoskedasticity Implication for computing standard errors What do these two terms

More information

International Graduate School of Genetic and Molecular Epidemiology (GAME) Computing Notes and Introduction to Stata

International Graduate School of Genetic and Molecular Epidemiology (GAME) Computing Notes and Introduction to Stata International Graduate School of Genetic and Molecular Epidemiology (GAME) Computing Notes and Introduction to Stata Paul Dickman September 2003 1 A brief introduction to Stata Starting the Stata program

More information

Useful Stata Commands (for Stata versions 13 & 14)

Useful Stata Commands (for Stata versions 13 & 14) Useful Stata Commands (for Stata versions 13 & 14) Kenneth L. Simons This document is updated continually. For the latest version, open it from the course disk space. This document briefly summarizes Stata

More information

An Introduction to Stata Part I: Data Management

An Introduction to Stata Part I: Data Management An Introduction to Stata Part I: Data Management Kerry L. Papps 1. Overview These two classes aim to give you the necessary skills to get started using Stata for empirical research. The first class will

More information

THE LINEAR PROBABILITY MODEL: USING LEAST SQUARES TO ESTIMATE A REGRESSION EQUATION WITH A DICHOTOMOUS DEPENDENT VARIABLE

THE LINEAR PROBABILITY MODEL: USING LEAST SQUARES TO ESTIMATE A REGRESSION EQUATION WITH A DICHOTOMOUS DEPENDENT VARIABLE PLS 802 Spring 2018 Professor Jacoby THE LINEAR PROBABILITY MODEL: USING LEAST SQUARES TO ESTIMATE A REGRESSION EQUATION WITH A DICHOTOMOUS DEPENDENT VARIABLE This handout shows the log of a Stata session

More information

Economics 561: Economics of Labour (Industrial Relations) Empirical Assignment #2 Due Date: March 7th

Economics 561: Economics of Labour (Industrial Relations) Empirical Assignment #2 Due Date: March 7th Page 1 of 5 2/16/2017 The University of British Columbia Vancouver School of Economics Economics 561: Economics of Labour (Industrial Relations) Professor Nicole M. Fortin Winter 2017 Professor Thomas

More information

A Short Guide to Stata 14

A Short Guide to Stata 14 Short Guides to Microeconometrics Fall 2016 Prof. Dr. Kurt Schmidheiny Universität Basel A Short Guide to Stata 14 1 Introduction 2 2 The Stata Environment 2 3 Where to get help 3 4 Additions to Stata

More information

Gov Troubleshooting the Linear Model II: Heteroskedasticity

Gov Troubleshooting the Linear Model II: Heteroskedasticity Gov 2000-10. Troubleshooting the Linear Model II: Heteroskedasticity Matthew Blackwell December 4, 2015 1 / 64 1. Heteroskedasticity 2. Clustering 3. Serial Correlation 4. What s next for you? 2 / 64 Where

More information

Chapter 5 Parameter Estimation:

Chapter 5 Parameter Estimation: Chapter 5 Parameter Estimation: MODLER s regression commands at their most basic are essentially intuitive. For example, consider: IMP=F(GNP,CAPI) which specifies that IMP is a function F() of the variables

More information

book 2014/5/6 15:21 page v #3 List of figures List of tables Preface to the second edition Preface to the first edition

book 2014/5/6 15:21 page v #3 List of figures List of tables Preface to the second edition Preface to the first edition book 2014/5/6 15:21 page v #3 Contents List of figures List of tables Preface to the second edition Preface to the first edition xvii xix xxi xxiii 1 Data input and output 1 1.1 Input........................................

More information

Detailed Explanation of Stata Code for a Marginal Effect Plot for X

Detailed Explanation of Stata Code for a Marginal Effect Plot for X Detailed Explanation of Stata Code for a Marginal Effect Plot for X Below, I go through the Stata code for creating a marginal effect plot for X for an interaction model with the following basic form:

More information

Econ Stata Tutorial I: Reading, Organizing and Describing Data. Sanjaya DeSilva

Econ Stata Tutorial I: Reading, Organizing and Describing Data. Sanjaya DeSilva Econ 329 - Stata Tutorial I: Reading, Organizing and Describing Data Sanjaya DeSilva September 8, 2008 1 Basics When you open Stata, you will see four windows. 1. The Results window list all the commands

More information

Seminar Corporate Governance: Topics on Data Analysis with STATA

Seminar Corporate Governance: Topics on Data Analysis with STATA Seminar Corporate Governance: Topics on Data Analysis with STATA Yuhao Zhu y.zhu@ese.eur.nl 22 November 2017 Contents I Introductory 2 1 Why we are here and how we get there? 2 2 What to learn today? 2

More information

Here is Kellogg s custom menu for their core statistics class, which can be loaded by typing the do statement shown in the command window at the very

Here is Kellogg s custom menu for their core statistics class, which can be loaded by typing the do statement shown in the command window at the very Here is Kellogg s custom menu for their core statistics class, which can be loaded by typing the do statement shown in the command window at the very bottom of the screen: 4 The univariate statistics command

More information

Stata: A Brief Introduction Biostatistics

Stata: A Brief Introduction Biostatistics Stata: A Brief Introduction Biostatistics 140.621 2005-2006 1. Statistical Packages There are many statistical packages (Stata, SPSS, SAS, Splus, etc.) Statistical packages can be used for Analysis Data

More information

Week 1: Introduction to Stata

Week 1: Introduction to Stata Week 1: Introduction to Stata Marcelo Coca Perraillon University of Colorado Anschutz Medical Campus Health Services Research Methods I HSMP 7607 2017 c 2017 PERRAILLON ALL RIGHTS RESERVED 1 Outline Log

More information

Introduction to gretl

Introduction to gretl Introduction to gretl Applied Economics Department of Economics Universidad Carlos III de Madrid Outline 1 What is gretl? 2 gretl Basics 3 Importing Data 4 Saving as gretl File 5 Running a Script 6 First

More information

Data Management 2. 1 Introduction. 2 Do-files. 2.1 Ado-files and Do-files

Data Management 2. 1 Introduction. 2 Do-files. 2.1 Ado-files and Do-files University of California, Santa Cruz Department of Economics ECON 294A (Fall 2014)- Stata Lab Instructor: Manuel Barron 1 Data Management 2 1 Introduction Today we are going to introduce the use of do-files,

More information

Subject index. ASCII data, reading comma-separated fixed column multiple lines per observation

Subject index. ASCII data, reading comma-separated fixed column multiple lines per observation Subject index Symbols %fmt... 106 110 * abbreviation character... 374 377 * comment indicator...346 + combining strings... 124 125 - abbreviation character... 374 377.,.a,.b,...,.z missing values.. 130

More information

Econometrics I: OLS. Dean Fantazzini. Dipartimento di Economia Politica e Metodi Quantitativi. University of Pavia

Econometrics I: OLS. Dean Fantazzini. Dipartimento di Economia Politica e Metodi Quantitativi. University of Pavia Dipartimento di Economia Politica e Metodi Quantitativi University of Pavia Overview of the Lecture 1 st EViews Session I: Convergence in the Solow Model 2 Overview of the Lecture 1 st EViews Session I:

More information

API-202 Empirical Methods II Spring 2004 A SHORT INTRODUCTION TO STATA 8.0

API-202 Empirical Methods II Spring 2004 A SHORT INTRODUCTION TO STATA 8.0 API-202 Empirical Methods II Spring 2004 A SHORT INTRODUCTION TO STATA 8.0 Course materials and data sets will assume that you are using Stata to complete the analysis. Stata is available on all of the

More information

CDAA No. 4 - Part Two - Multiple Regression - Initial Data Screening

CDAA No. 4 - Part Two - Multiple Regression - Initial Data Screening CDAA No. 4 - Part Two - Multiple Regression - Initial Data Screening Variables Entered/Removed b Variables Entered GPA in other high school, test, Math test, GPA, High school math GPA a Variables Removed

More information

/23/2004 TA : Jiyoon Kim. Recitation Note 1

/23/2004 TA : Jiyoon Kim. Recitation Note 1 Recitation Note 1 This is intended to walk you through using STATA in an Athena environment. The computer room of political science dept. has STATA on PC machines. But, knowing how to use it on Athena

More information

Empirical trade analysis

Empirical trade analysis Empirical trade analysis Introduction to Stata Cosimo Beverelli World Trade Organization Cosimo Beverelli Stata introduction Bangkok, 18-21 Dec 2017 1 / 23 Outline 1 Resources 2 How Stata looks like 3

More information

Two-Stage Least Squares

Two-Stage Least Squares Chapter 316 Two-Stage Least Squares Introduction This procedure calculates the two-stage least squares (2SLS) estimate. This method is used fit models that include instrumental variables. 2SLS includes

More information

StatCalc User Manual. Version 9 for Mac and Windows. Copyright 2018, AcaStat Software. All rights Reserved.

StatCalc User Manual. Version 9 for Mac and Windows. Copyright 2018, AcaStat Software. All rights Reserved. StatCalc User Manual Version 9 for Mac and Windows Copyright 2018, AcaStat Software. All rights Reserved. http://www.acastat.com Table of Contents Introduction... 4 Getting Help... 4 Uninstalling StatCalc...

More information

Department of Economics Spring 2016 University of California Economics 154 Professor Martha Olney Stata Lesson Wednesday February 17, 2016

Department of Economics Spring 2016 University of California Economics 154 Professor Martha Olney Stata Lesson Wednesday February 17, 2016 University of Califnia Economics 154 Berkeley Profess Martha Olney Stata Lesson Wednesday February 17, 2016 [1] Where to find the data sets http://www.econ.berkeley.edu/~olney/spring16/econ154 There are

More information

Using SAS and STATA in Archival Accounting Research

Using SAS and STATA in Archival Accounting Research Using SAS and STATA in Archival Accounting Research Kai Chen Dec 2, 2014 Overview SAS and STATA are most commonly used software in archival accounting research. SAS is harder to learn. STATA is much easier.

More information

GRETL FOR TODDLERS!! CONTENTS. 1. Access to the econometric software A new data set: An existent data set: 3

GRETL FOR TODDLERS!! CONTENTS. 1. Access to the econometric software A new data set: An existent data set: 3 GRETL FOR TODDLERS!! JAVIER FERNÁNDEZ-MACHO CONTENTS 1. Access to the econometric software 3 2. Loading and saving data: the File menu 3 2.1. A new data set: 3 2.2. An existent data set: 3 2.3. Importing

More information

PubHlth 640 Intermediate Biostatistics Unit 2 - Regression and Correlation. Simple Linear Regression Software: Stata v 10.1

PubHlth 640 Intermediate Biostatistics Unit 2 - Regression and Correlation. Simple Linear Regression Software: Stata v 10.1 PubHlth 640 Intermediate Biostatistics Unit 2 - Regression and Correlation Simple Linear Regression Software: Stata v 10.1 Emergency Calls to the New York Auto Club Source: Chatterjee, S; Handcock MS and

More information

Fathom Dynamic Data TM Version 2 Specifications

Fathom Dynamic Data TM Version 2 Specifications Data Sources Fathom Dynamic Data TM Version 2 Specifications Use data from one of the many sample documents that come with Fathom. Enter your own data by typing into a case table. Paste data from other

More information

Introduction to Stata First Session. I- Launching and Exiting Stata Launching Stata Exiting Stata..

Introduction to Stata First Session. I- Launching and Exiting Stata Launching Stata Exiting Stata.. Introduction to Stata 2016-17 01. First Session I- Launching and Exiting Stata... 1. Launching Stata... 2. Exiting Stata.. II - Toolbar, Menu bar and Windows.. 1. Toolbar Key.. 2. Menu bar Key..... 3.

More information

Sacha Kapoor - Masters Metrics

Sacha Kapoor - Masters Metrics Sacha Kapoor - Masters Metrics 091610 1 Address: Max Gluskin House, 150 St.George, Rm 329 Email: sacha.kapoor@utoronto.ca Web: http://individual.utoronto.ca/sacha$_$kapoor 1 Basics Here are some data resources

More information

( ) = Y ˆ. Calibration Definition A model is calibrated if its predictions are right on average: ave(response Predicted value) = Predicted value.

( ) = Y ˆ. Calibration Definition A model is calibrated if its predictions are right on average: ave(response Predicted value) = Predicted value. Calibration OVERVIEW... 2 INTRODUCTION... 2 CALIBRATION... 3 ANOTHER REASON FOR CALIBRATION... 4 CHECKING THE CALIBRATION OF A REGRESSION... 5 CALIBRATION IN SIMPLE REGRESSION (DISPLAY.JMP)... 5 TESTING

More information

Introduction to STATA

Introduction to STATA Center for Teaching, Research and Learning Research Support Group American University, Washington, D.C. Hurst Hall 203 rsg@american.edu (202) 885-3862 Introduction to STATA WORKSHOP OBJECTIVE: This workshop

More information

MPhil computer package lesson: getting started with Eviews

MPhil computer package lesson: getting started with Eviews MPhil computer package lesson: getting started with Eviews Ryoko Ito (ri239@cam.ac.uk, itoryoko@gmail.com, www.itoryoko.com ) 1. Creating an Eviews workfile 1.1. Download Wage data.xlsx from my homepage:

More information

Results Based Financing for Health Impact Evaluation Workshop Tunis, Tunisia October Stata 2. Willa Friedman

Results Based Financing for Health Impact Evaluation Workshop Tunis, Tunisia October Stata 2. Willa Friedman Results Based Financing for Health Impact Evaluation Workshop Tunis, Tunisia October 2010 Stata 2 Willa Friedman Outline of Presentation Importing data from other sources IDs Merging and Appending multiple

More information