3 Module Overview Module objectives are to provide you with Skills in data analysisKeeping in mind the analysis objectivesWhile learning the use of a specialised statistical software package StataThere will be a strong emphasis on conductingmeaningful analyses and on the interpretationof the results.
4 Module content Data management Data entry principles and practices using Epi Infodesigning data capture screens,labelling and entering data, etc.Simple statistical analysisin Epi Infoand using the statistics package, Instat.Report writing.4
5 Duration and timetable MorningAfternoonDay 1Getting started with StataContinuedDay 2TablesProject work part 1Day 3GraphsProject work part 2Day 4Reviewing inference: estimation and confidence intervalsReviewing inference: Hypothesis testingDay 5Tests of association in 2-way tablesSampling weightsDay 6Project work part 3: writing the reportPutting it all in context5
6 Module Learning Objectives At the end of the module, participants will :appreciate the power of Stata as a statistical packagebe able to undertake elementary data management and statistical analyses in Statahave updated their practical knowledge of the key statistical inference concepts of estimation and hypothesis testingbe able to produce graphs and tables using Stata,have sufficient knowledge of Stata to be able to work independently to produce other analyses6
7 Prerequisites Completion of Modules 1 and 2 At least a theoretical knowledge of statistical inference7
8 Resources Stata software - version 10 This should be installed alreadyIt may need updating and a Stata “package” adding – see later slidesGuide to survey data analysis using StataPart 1 (Chapters 1 to 10) is used herePart 2 (Chapters 11 to 20) is supplied for referenceInference guideUsed particularly in Sessions 7 and 88
9 Concepts more than software The emphasis is on the concepts of data analysis and statistical inferenceUsing StataRather than just on Stata itselfHere we largely use the menus and dialoguesThough ways of using and reading commands are introducedSoftware is now easy to masterIt is the statistical concepts that benefit from a course
10 Learning objectives – sessions 1 and 2 These two sessions are about StataParticipants will be able to:Load and save dataExplore dataUsing describe, codebook, summarize, etcCalculate new variablesUsing generate, recode, etcAdd labels to variables and to levels of a factorCreate subsets of data using drop and keep
11 Session Contents In this session we look in particular at: Windows and menus in StataOpening Stata data filesStata dialoguesTyping and editing commandsUsing Stata as a calculatorExiting Stata
12 The four Stata windows Review Stata Results Variables and window for typing Stata commands
13 The Stata menus and toolbar The three most important menusData (for organising and managing the data),Graphics (for visual exploration & presentation),Statistics (for analysis).Data, Graphics, Statistics
14 Check Stata is up-to-date Use Help => Official updatesIf updating is needed, either:Do it automatically if you are connected to the internetOr use the files on the CD/DVD that are under Stata resources
16 Your turn Check by finding the dialogue in Stata save data? Click on several menus and explain their usage to your neighbourYou can deduce the menu from the logic of the taske.g. to draw a graph you go to the graphics menu!Which menu would you probably need to use to:save data?sort a data set?produce a bar chart?tabulate the data?Check by finding the dialogue in Stata
17 Stata guide Section 1.2 You use Stata as a calculator Go through this section togetherCheck the buttons at the bottom of the dialogueThey are the same on all dialogues
18 Using Stata as a calculator To perform calculations, useData Other utilities Hand calculatorType 2+3 into the Expression slotPress the Submit buttonSee answer in Results Window, and appearance of corresponding command in both the Results and Review windows.
19 Results from the dialogue You can get back to any dialogue box by typing db in front of the command name.e.g. db display
20 Creating an expression Click create and then complete the resulting expression builder dialogue box.Or type:display ln(10)
21 Stata guide Section 1.3From this point you use a dataset that is suppliedCheck that you have a working directoryAnd that it has the files for this moduleCopy them in, if notThey are on the CD/DVD under Stata resourcesYou could install the Stata package as well if you wish.Then use Files => Change working directoryTo set this directory for the future
22 Opening a Stata data file Use the menu sequenceFile, Open…select (highlight) the file namedK_combined_short.dtaand click on OpenThis will load the data from the Kenya socio-economic survey into StataLook at the Variables Window. What do you observe?
24 An example of a dialogue box Dialogue results from using the menu sequenceData, Describe data, Describe data contents (codebook)
25 In the codebook dialogue box… The Submit buttoninstructs Stata to execute the command, leaving the dialogue box visible.The OK button does the same,but closes the dialogue box.Cancel closes the dialogue boxwithout submitting the command to Stata.The R button resets the dialogue boxto its empty form.‘?’ gives help on the commandassociated with the dialogue box.The word “codebook” at the top of the dialogueshows “codebook” is the command that will be generated
26 Another dialogue box Dialogue results from using the menu sequence Data,Describe data,Summary statistics
28 Your turn In Chapter 1 of the Stata guide, go through Section 1.3 Ask a resource person if you are unclear aboutany parts of the above sections.
29 Review What do each of these buttons do? Menus (and corresponding commands) used so far:displaydescribecodebooklistgeneratereplaceby/if//inWhat does each one do?
30 Your turn again In Chapter 1 of the Stata guide, go through Section 1.6Section 1.7Section 1.8Ask a resource person if you are unclear aboutany parts of the above sections.
31 Review again Explain to a neighbour why: (3<4) gives the value 1 in Stata(3>4) gives the value 0They then explain to you why the expression:1 + (age>24) + (age>60)Recodes a column into the values 1, 2 or 3(Hint – see Section 1.6 Fig 1.19 and 1.20 if you need help)
32 Typing and editing commands Professional use of Stata for data analysisbenefits by some use of Stata commandsThese are typed into the Command WindowTo execute a command just press <Enter>.To edit a previous command:Click on it in the review window,or use the Page-Up key – perhaps repeatedly.In the Results WindowA “dot” appears in front of executed commandswhether generated by a dialogue, or by typing the command.
33 Command for listing data In the command window, typinglist region district household clusterwill show the contents of each of the variables region, district, household and cluster.(Note: Stata is case sensitive)Pressing the GO button (see Stata menu bar) or the space bar allows you to scroll down the pageTo stop the display, press the red break icon button or press the letter q on your keyboard.To exit Stata, use:File Exit
34 Your turn yet again In Chapter 2 of the Stata guide, go through Sections 2.1 and 2.2(You can go further if you have time)If you have your own dataAnd it is not already in a Stata file, then:In Chapter 3 of the Stata guide, go throughSections 3.2.1, 3.2.2, 3.2.3And discuss importing with the resource persons
35 … and finally…Consider a data set from your own district or ministry that is available as an Excel file.Follow procedures similar to those in Section of the Stata Guide, to load your Excel data set into Stata.Save your data as a Stata file, giving it an appropriate name and noting the directory on your computer where it has been saved.Note: You will return to this data set in sessions that follow.