欢迎来到天天文库
浏览记录
ID:39076415
大小:331.90 KB
页数:29页
时间:2019-06-24
《Introduction to Stata - Session 3STATA会话3介绍》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、IntroductiontoStata-Session3Simon,HongECON3150/4150,UiOJanuary15,20181/29Beforewestart1.Downloadcaschool.dtafromcoursewebpage2.StartSTATAfromtheStartmenu2.1Alternatively,fromkiosk.uio.nousinginternetexplorer:Logon,navigatetoanalyse,openStata2/29Outline1.Stataw
2、ork ow2.Workingwithdo-lesItextleswithStatacode,whybetter?Iformatting:makeyourlereadableIcomments:includedescriptionofthecode3.Regression,prediction,testing4.BasicgraphsIscatterplotsIlineplotsIoverlyinggraphsIbasicformattingIexporting3/29Statawork owAlwaysbe
3、ttertoseparatechanging&analysingthedata:1.FirstprepareyourdataforanalysisIcopydatafromdisktomemoryIdescribedataIchangedateIsavemodieddatatodiskundernewname2.ThenanalysethemodieddataIcopyanalysisdataintomemoryIstartloggingresultstoleIperformanalysisIcloselog
4、leAdvice:onedirectoryperproject&startsessioninprojectdirectory4/29DOlesUntilnowwehavemostlyusedthecommandline:IgreattodevelopbutnottoreproduceyouranalysisIALWAYSorganizeyourworkinStatascriptsStatascriptsarecalleddo-lesaftertheirextension(.do)Usedo-les(with
5、informativenames)toorganizeyourwork:Icreatedatasetcrincome.domakesdataleincome.dtaIanalysisandescr.docalculatesmydescriptivestatisticsanreg.doperformsmyregressionanalysisImakinggraphsgrwageplot.domakesthegraphwageplot.eps5/29Makeado-leUsecaschool.dta,thenope
6、nadoleandtrytodothefollowingthings1.ReadthedataintoStata2.Keeponlyread_scr,math_scr,enrl_tot,teachersandel_pct3.Makenewvariablescoreequaltomeanofreadingandmathscore4.Makenewvarstrequalthestudent-to-teacherratio5.Labelthevariables:enrl_totEnrollmentteachersTea
7、chersel_pctPercentenglish-learnersscoreMeantestscorestrStudent/Teachers6.Makeanewvariablezscoreasstandardizedscore,i.e.score mean(score)zscore=SD(score)6/29Incasesomethingwentwrongcd"PATH"use"PATH/caschool.dta",cleardesckeepread_scrmath_screnrl_totteachersel_p
8、ctegenscore=rowmean(read_scrmath_scr)genstr=enrl_tot/teacherslabelvarscore"Testscore"labelvarenrl_tot"Enrollment"labelvarteachers"Teachers"labelvarstr"Student/Teacher"labelvarel_pc
此文档下载收益归作者所有