1 Research Methods Lecture 2 The dummies’ guide to STATA Wiji Arulampalam 18/10/2006.

Slides:



Advertisements
Similar presentations
1 Application Software Course Simulink By: Mahdi Akbari 2010.
Advertisements

© 2002 D & D Enterprises 1 Linking Images For Navigation & Clickable Image Maps.
Follow the instruction to install the PC Suite from the SD card: 1.Go to the settings -> SD Card & phone storage -> Enable the mass storage only mode 2.Connect.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Introduction to XHTML Programming the World Wide Web Fourth edition.
Advanced Piloting Cruise Plot.
Getting Started with Microsoft Office 2007
Our library has two forms of encyclopedias: Hard copy and electronic versions. The first is simply the old-fashioned "book on the shelf" type of encyclopedia.
Chapter 16 Graphical User Interfaces
Chapter 1 The Study of Body Function Image PowerPoint
McGraw-Hill/Irwin Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. Extended Learning Module D (Office 2007 Version) Decision Analysis.
BASIC SKILLS AND TOOLS USING ACCESS
The Reinberger Childrens Library Center Step-by-step instructions for capturing a MARC record and adding a 658 Tag to a record.
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
Tutorial 9 – Creating On-Screen Forms Using Advanced Table Techniques
XP New Perspectives on Microsoft Office Word 2003 Tutorial 6 1 Microsoft Office Word 2003 Tutorial 6 – Creating Form Letters and Mailing Labels.
State of New Jersey Department of Health and Senior Services Patient Safety Reporting System Module 2 – New Event Entry.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Excel PivotTable List Feature Creating a PivotTable List Web Page Using Excel.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
My Alphabet Book abcdefghijklm nopqrstuvwxyz.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Addition Facts
Module Introduction and Getting Started with Stata
Housekeeping: Variable labels, value labels, calculations and recoding
Mike Scott University of Texas at Austin
Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the.
Microsoft Office 2010 Basics and the Internet
BT Wholesale October Creating your own telephone network WHOLESALE CALLS LINE ASSOCIATED.
ABC Technology Project
South Dakota Library Network ALEPH v20 Tables © South Dakota Library Network, 2012 ©Ex Libris (USA), 2009 Modified for SDLN Version Last Update:
School of Geography FACULTY OF ENVIRONMENT Working with Tables 1.
PEPS Weekly Data Extracts User Guide September 2006.
Microsoft Access.
Vanderbilt Business Objects Users Group 1 Reporting Techniques & Formatting Beginning & Advanced.
Review Chapter 11 - Tables © 2010, 2006 South-Western, Cengage Learning.
XP New Perspectives on Introducing Microsoft Office 2003 Tutorial 1 1 Using Common Features of Microsoft Office 2003 Tutorial 1.
Microsoft Office Illustrated Fundamentals Unit C: Getting Started with Unit C: Getting Started with Microsoft Office 2010 Microsoft Office 2010.
VOORBLAD.
Benchmark Series Microsoft Excel 2013 Level 2
1 Welcome to SAPS Webmail. 2 Things we will learn about: 1. Login to mail.
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Chapter 5 Microsoft Excel 2007 Window
© 2012 National Heart Foundation of Australia. Slide 2.
Collin College Credit Exam
Chapter 5 Test Review Sections 5-1 through 5-4.
Working with Tables for Page Design – Lesson 41 Working with Tables for Page Design Lesson 4.
Macromedia Dreamweaver MX 2004 – Design Professional Dreamweaver GETTING STARTED WITH.
Addition 1’s to 20.
INTRODUCTORY MICROSOFT WORD Lesson 7 – Working With Documents
Pasewark & Pasewark Microsoft Office XP: Introductory Course 1 INTRODUCTORY MICROSOFT WORD Lesson 8 – Increasing Efficiency Using Word.
25 seconds left…...
1 Wiki Tutorial. 2 Outline of Wiki Tutorial 1) Welcome and Introductions 2) What is a wiki, and why is it useful for our work in moving forward the program.
Week 1.
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
©2004 Brooks/Cole FIGURES FOR CHAPTER 12 REGISTERS AND COUNTERS Click the mouse to move to the next page. Use the ESC key to exit this chapter. This chapter.
PSSA Preparation.
1 SPSS Tutorial 101: Import, Merge and Save Data Sets Dr. Daisy Dai Department of Medical Research.
Use the buttons on the top to navigate through the presentation 1 PrevNext Menu.
Contract Audit Follow-Up (CAFU) 3.5 Pre-Defined & Ad hoc Reports November 2009 ITCSO Training Academy.
Windfall Web Throughout this slide show there will be hyperlinks (highlighted in blue). Follow the hyperlinks to navigate to the specified Topic or Figure.
Benchmark Series Microsoft Excel 2010 Level 1
HTML Concepts and Techniques Fourth Edition Project 2 Creating and Editing a Web Page.
A Brief Introduction to Stata(1). 1. Getting Started.
Evaluation of Public Policy
Presentation transcript:

1 Research Methods Lecture 2 The dummies’ guide to STATA Wiji Arulampalam 18/10/2006

2 Econometrics Software You can use any software that does what you need See Timberlake for details of what does what well [ PC Give is hard to beat for time series analysis –Microfit, EViews are good alternatives STATA does (just about) everything. STATA (and everything else) is available as a delivered application on the network.

3 WHY STATA Need to know how to use STATA for (i) Econometrics A [next term] (ii) Econometrics B [this term] (iii) Panel Data Econometrics [next term] E-Views demo will be given by the Econometrics tutors! The above two should be sufficient

4 STATA Hopefully you will have access by next week So full demo next week Stata command file wages.do and data file wages.dta on the module web page for you to practice

5 STATA Use STATA: FOR –large survey datasets (merging them) –complex nonlinear models (e.g. LDV’s) But see also LimDep –nonparametric and evaluation methods –you want to continue studying economics be a professional economist learn something new –you hate PC Give.

6 Some useful websites Stata’s own resources for learning STATA –Stata website, Stata journal, Stata library, Statalist archiveStata websiteStata journalStata libraryStatalist archive – Michigan’s web-based guide to STATA (for SA)web-based guide UCLA resources to help you learn and use STATA: – ats.ucla.edu/stat/statahttp://www. ats.ucla.edu/stat/stata –including movies and “web-books”

7 Accessing STATA Available from your ‘Delivered Applications’ Double click on icon!

8 Buttons/Menu

9 Enter commands here

10 OR use the do editor to create a.do file

11 Results window Better to save the output – more later

12 Click for Extensive Help OR Type help in command line help

13 Type help in command line help xxx

14 Exit, clear

15 Click and point in v9 Exit, clear Menu/tabs

16 Important features (1) NOTE –Always use lowercase in STATA –Otherwise you can get very confused More --more-- in your output window  more output to come. [Press spacebar and the next page appears] –Command set more off turn this off Not enough memory [so reset!] –. set mem XXXm (allocate XXX mb of data) –. set matsize XXX (max matrix size XXX square)

17 Important features (2) To Break –To stop anything hit the “break” (menu button with red cross, or hit Ctrl and C simultaneously)

18 Using data on disk (1) Opening a dataset –datasets need to be rectangular [variables in columns; observations in rows ] –Stata datasets have a.dta extension –Will read excel or text files –Otherwise use Stat/Transfer to convert other format files to stata files

19 Using data on disk (2) There are several ways of getting data into STATA: eg: wages.dta. use wages (or click: file/open on the menu bar). use lwage ed exp in 1/1000 if fem==1. insheet using wages.csv (or.txt) (imports an Excel csv file or a “text” file)

20 Opens the file List of variables

21 Basic data reporting (1).describe (or press F3 key) –Lists the variable names and labels. describe using wages –Lists the variable names etc WITHOUT loading the data into memory (useful if the data is too big to fit). codebook –Tells you about the means, labels, missing values etc

22

23 Basic data reporting (2) sort and count –.sort personid sorts data by personid –.count if personid==personid[_n-1] counts how many unique separate personids _n-1 is the previous observation

24

25

26 First look at the data (1).list lwage ed exp in 1/10 if fem>=0 –Lists the first 10 rows of var1 to var3 for which var4≥0.tab fem union (or tabulate) [variables should be integers] –gives a crosstab of fem vs union

27

28 First look at the data (2).summ fem union (or summarize or sum) –means, std devs etc for x1 and x2.corr ed exp in 1/100 if fem<1 (,cov) –correlation coeffs (or covariances) for selected data –.pwcorr ed exp lwage [does all pairwise corr coeffs]

29

30

31

32 Tabulating (1) tab x1 x2 if x4==0, sum(x3) –gives the means of x3 for each cell of the x1 vs x2 crosstabulation for observations where x4=0 tab x1 x2, missing –Includes the missing values tab x1 x2, nolabel –Uses numeric codes instead of labels –Eg “1” instead of “NorthWest” etc

33 Tabulating (1) tab x1 x2, col –Gives % of column instead of count –Can get row percentages by using row instead –Or both by using row col table educ ethnic, c(mean wage) row col –Customises the table so it includes the mean (or median or mx or count or sd ….) of wage by cells

34 Labelling Always have your data comprehensively labelled.label data “This is pooled GHS 90-99”.label variable reg “region”.lab define reglab 0 “North” 1 “South” 2 “Middle”.lab values region reglab Tedious to do for lots of variables –but then your output will be intelligibly labelled –other people will be able to understand it in future

35 Data manipulation (1) Data can be renamed, recoded, and transformed: Command.generate or gen for short. gen logrw=log((earn/hours)/rpi). gen agesq=age^2 (squares). gen region1=(region==1) (1 if true, 0 if not). gen ylagged=y[ _n-1 ] (_n is the obs # in STATA)

36 Data manipulation (2) Command recode:. recode x1.=0, 1/5=1 (. is missing value (mv)). replace rate=rate/100. replace age=25 if age==250. egen meaninc=mean(income), by (region) (see help egen for details)

37

38 Data selection (1) You can also organise your data set with various commands:. keep if _n<=1000 ( _n is the observation number). drop region. drop if ethnic~=1 keeps only the first 1000 observations, drops region, and drops all the observations where the variable ethnic≠1 (~= is “not equal to”)

39 Data selection (2) Then save the smaller file for subsequent analysis. save newfile. save, replace (take care – it overwrites existing file)

40

41 Functions Lots of functions are possible. See. help functions –Obvious ones like Log(), abs(), int(), round(), sqrt(), min(), max(), sum() –And many very specialised ones. – Statistical functions distributions –String functions Converting strings to numbers and vice versa –Date functions Converting dates to numbers and vice versa –And lots more

42 Command files Stata command files have a.do extension It is ALWAYS good practice to use a.do file –you will know exactly what you have done. –It makes it easy to develop ideas. –And correct mistakes.. do wages.do, nostop –(echoes to screen, and keeps going after error encountered) Or. run wages.do(executes “silently”)

43 Keeping track of output (1) Can scroll back your screen (upto a point) But better to open a log file at the beginning of your session, and close it at the end. Click on file, log, begin. Or type. log using myoutput. Commands……………………. log close [log command allows the replace and append options.]

44 Keeping track of output (2) Default is.smcl file extension (that STATA can read).log extension gives an ASCII file that anything can edit ALWAYS LOG your output is a good way of developing a.do file – since it saves the commands as well as the output

45 Next Lecture Monday 23 rd October F107 11:00-12:00 STATA demo