您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 商业计划书 > 连玉君STATA教程
EstimationwithSTATA1arlion@stu.xjtu.edu.cn2006.041—-STATALATEXBBS§2.1......................................32.1.1......................................32.1.2......................................3§2.2..........................................32.2.1......................................32.2.2...................................42.2.3......................................5§2.3.............................................52.3.1......................................52.3.2...............................62.3.3.......................................6§2.4..........................................6§2.5..........................................62.5.1........................................62.5.2...................................62.5.3...................................6§2.6..........................................82.6.1Wald.....................................8§2.7...................................9§2.8.............................................122.8.1..............................12§2.9.............................................122.9.1....................................122.9.2....................................12§2.10.........................................132.10.1..................................13122.10.2........................................132.10.3...................................142.10.4...................................152.10.5.......................................192.10.6.......................................202.10.7....................................202.10.8......................................21§2.11.......................................212.11.1egen......................................212.11.2confirm....................................212.11.3....................................22§2.12.........................................232.12.1......................................232.12.2MC.........................................252.12.3BS..........................................252.12.4......................................25STATA§2.1D:nstata8cD:nstata8nadonpersonalSTATApersonalplusadoD:nstata8nadonpersonalprofile.dologusingd:\stata8\ado\personal\stata.log,textreplacecmdlogusingd:\stata8\ado\personal\command.log,appendsysdirsetPLUSD:\stata8\ado\plussysdirsetOLDPLACED:\stata8\datasysdirsetPERSONALD:\stata8\ado\personal2.1.1PrefsSaveWindowingPreferencesLoadWindowingPreferences2.1.2STATAdoFont§2.22.2.1STATAdoEviewsSPSSSTATAdoSTATAdo//Greenechp12exercisesclear3§2.2.4caplogclosecapcmdlogcloselogusingGreene12,textreplacecmdlogusingGreene12_cmd,replaceuseD:\stata8\ado\Examples\others\Greene4th\TBL5-1.DTA,clear*=======================================================*===============------Example12.1------=================*=======================================================labelvarx3Avg.monthlycreditcardexpenditurelabelvarx1Ageinyears+12thsofayearlabelvarx2Income,dividedby10,000renamex1agerenamex2incomerenamex3expendituregenincome2=incomeˆ2regexpenditureageincomeincome2ifexp02.2.2STATA1logusingGreene12,textreplaceGreene12.txtreplacedoWordLATEXExcelCopyCopyastableExcelWord1quietlyquiregyx1x2§2.3.52.2.3STATASTATA10STATAEviewsGausshelp[command]whelp[command][]whelpregress2findit[command]search[,...]§2.32.3.1,32STATA2STATAPreference!Generalpreferences!Internetprefs§2.4.62.3.2makepricempgrep78AMCConcord4099223AMCPacer4749173AMCSpirit379922.BuickCentury4816203BuickElectra7827154BuickLeSabre5788183BuickOpel445326.2.3.3§2.4helpfornumlistcollapse§2.52.5.1commandvarlist[if][in][weight],[options]2.5.2esttableeststore2.5.32.5.3.1STATAwhelpestcom2.5.3.2STATA2.5.3.2§2.5.72-1:anovaheckmanHeckmanintregTobitcnregintregivregIV2SLSneweyNewey-WestpraisPrais-Winsten,Cochrane-Orcutt,orHildreth-LuqregregOLSswreg3rregWhitesuregsvyheckmanHeckmansvyintregsvyregresstobitTobittreatregtreatmenttruncreg§2.6.82-2:clemao1zandrewsdfullerdfglspperroncoindwstatdwstat2,durbina2durbinh3§2.62.6.1Waldwhelptestsysuseautoquiregpricempgweighttestweight=0/**/test(weight=4)(mpg=1)/*F*/3whelppostest§2.7.9§2.72.7.0.1tssetidyearbyid:egenavgi=mean(invest)2.7.0.2sicmen4tabletabsicmenifyear==1998bysortbysortyear:tabsicmen2.7.0.3STATA1.generatereplaceforvalueforeachreplaceif1.1genage2530=agelabel==2genage30s=agelabel==3gendum1=size2002.tabulategen()kgroupktabsicmen,gen(sicdum)4123,13§2.7.1013133.xiregvarlisti.groupvartssetidyearxi:xtregvarlisti.year,fe2.6.1testWaldtest_Itime_2=_Itime_3=_Itime_4=_Itime_5=_Itime_6T=6xi:regbysortregion:xi:xtregyxi.sicmen,feswxi:regyxi.group4.xtile2.7.0.41xtgls.adoChkBalby5programdefineChkBalglobalS_1=0if$X_bal==0{exit}/*Checkforbalancedpanels*/globalS_10tempvarusemark‘use’5§2.7.11markout‘use’$X_depv$X_indv$X_ivar$X_tvar*replace‘use’=‘use’*$X_ttemptempvartestegen‘test’=sum(‘use’),by($X_itemp)summ‘test’ifr(min)!=r(max){globalS_11/*Notbalanced*/exit}/*Checkforduplicatevaluesinpanel&equalvaluesacrosspanels*/tempvart1t2sort$X_ttempquietlyby$X_ttemp:genlong‘t1’=1if_n==1quireplace‘t1’=sum(‘t1’)sort$X_itemp$X_ttempcaptureby$X_itemp:assert‘t1’!=‘t1’[_n-1]if_n1if_rc{globalS_12/*Duplicatev
本文标题:连玉君STATA教程
链接地址:https://www.777doc.com/doc-4847650 .html