您好,欢迎访问三七文档
STATA讲义目录Stata入门教程:Stata概貌Stata第一章数据输入,存盘和调用文件命令以及数据管理命令Stata第二章描述性统计命令与输出结果说明Stata第三章正态检验与作图命令Stata第四章t检验和单因素方差分析(上)Stata第四章t检验和单因素方差分析(下)Stata第五章多组计量资料比较的非参数检验命令与输出结果说明Stata第六章卡方检验Stata第七章相关分析Stata第八章单因素生存分析Stata第九章多因素方差分析命令与输出结果说明Stata第十章线性回归和逐步回归命令和输出结果说明Stata第十一章Logistic回归分析命令与输出结果说明Stata第十二章Cox回归分析命令与输出结果说明?????1.11.21.3STATA[[1]]1)input12…(end)2)infile12…musing()save[][,replace]outfileusing[][,replace]STATAuse[][,clear]gen=replace=[in][if]((miningdata).)STATA(ASC)DOSTransferFoxStatainput12…mend10(pp37):STATAx1x2STATAinputx1x21131401501381501401351351281351001201101471201141301381231202.(Foxbase)STATAinfile12…musing[]C:\userex1.txtSTATAinfilex1x2usingc:\user\ex1.txt•STATAsaveex1saveex1,replaceex1.dtac:\usersavec:\user\ex1.dtasavec:\user\ex1.dta,replace•STATAoutfile12…musing][,replace[replace]STATAex1.txtc:\useroutfilex1x2usingc:\user\ex1.txtc:\userex1.txtSTATA•(STATASTATA)use[][,clear]c:\userex1.dtaSTATAusec:\user\ex1usec:\user\ex1,clear•STATAgen=STATAx1x2x1-x2STATAreplace=[if][in]x999STATA1002x10051x50replacex=.ifx==999replacex=0ifx=5replacex=1ifx5&x=100[2]replacex=2ifx100[1][][2]“”==“”~=“”|“”&STATAby]summarize12…m[,detail]ci12…m[,level(#)binomialpoissonexposure(varname)by()]cii[,level(#)]tab1•()(,1978p21)STATAex2.dtax1x2xgroup=0group=1(2.6x=2.6group=01.98x1.98group1)STATAex2a.dtasummarizesummarizex1x2Variable|ObsMeanStd.Dev.MinMax---------+-------------------------------------------------------------------x1|114.7109091.3029772.66.53x2|133.3546151.3043681.675.78114.711(mg%)1.3032.66.53133.35461.30441.675.78summarizedetailuseex2,clearx1-------------------------------------------------------------PercentilesSmallest()1%2.62.65%2.63.2410%3.243.73Obs11()25%3.73()3.73SumofWgt.1150%4.73()()Mean4.710909()LargestStd.Dev.1.302977()75%5.78()5.5890%6.45.78Variance1.697749()95%6.536.4Skewness-.0813446()99%6.536.53Kurtosis1.809951()x2-------------------------------------------------------------PercentilesSmallest1%1.671.675%1.671.9810%1.981.98Obs1325%2.332.33SumofWgt.1350%3.6Mean3.354615LargestStd.Dev.1.30436875%4.174.1790%4.824.57Variance1.70137795%5.784.82Skewness.296394399%5.785.78Kurtosis1.875392summarizedetail(lowerquartile)(Median)(upperquartile)±(-interquartilerange,IQR)[1]x1MedianIQR:4.73(3.73-5.78)x2MedianIQR:3.6(2.33-4.17)ex2a.dtauseex2a,clearsortgroup(group)bygroup:summarizex-group=0x-------------------------------------------------------------PercentilesSmallest1%2.62.65%2.63.2410%3.243.73Obs1125%3.733.73SumofWgt.1150%4.73Mean4.710909LargestStd.Dev.1.30297775%5.785.5890%6.45.78Variance1.69774995%6.536.4Skewness-.081344699%6.536.53Kurtosis1.809951-group=1x-------------------------------------------------------------PercentilesSmallest1%1.671.675%1.671.9810%1.981.98Obs1325%2.332.33SumofWgt.1350%3.6Mean3.354615LargestStd.Dev.1.30436875%4.174.1790%4.824.57Variance1.70137795%5.784.82Skewness.296394399%5.785.78Kurtosis1.875392•[2]95%ci0-1ci,binomialpoissoncipoisson90%()ci,level(90)0-1ci,level(90)binomialpoissoncilevel(90)poissonex2.dtax1,x295useex2.dta,clearVariable|ObsMeanStd.Err.[95%Conf.Interval]---------+----------------------------------------------------------------------x1|114.710909.39286243.8355575.586261x2|133.354615.36176672.5663934.14283795%x195[3.8356,5.5863]x295[2.5664,4.1428]•[3]95cii[level(#)]90401295%cii904012Variable|ObsMeanStd.Err.[95%Conf.Interval]----------+----------------------------------------------------------------------|90401.26491137.4866542.5133590%[37.48665,42.51335]cii904012,level(90)Variable|ObsMeanStd.Err.[90%Conf.Interval]---------+---------------------------------------------------------------------------|90401.26491137.8975242.10248•tab1[,g()()g()50510(mg/g)(p220)xgroup=123455-tabulationofgroupgroup|Freq.PercentCum.------------+-----------------------------------1|1020.0020.002|1020.0040.003|1020.0060.004|1020.0080.005|1020.00100.00------------+-----------------------------------Total|50100.005051010%g(a)5():a1a2a3a4a5a111(group=1)a1=1(group¹1)a1=0a22a3a4a5345()[1][2]95%0.9510095%9595%[3]STATAswilk12…mgraph[,bin(#)]graph12[,]•:tShapiro-WilkShapiro-Wilkex2.dtauseex2.dta,clearswilkx1x2Shapiro-WilkWtestfornormaldataVariable|ObsWVzPrz----------+--------------------------------------------------------x1|110.962630.605-0.8560.80397x2|130.930791.2190.3880.34900H0:pp0.05•graph[bin(#1)]#15•graph12m(³1)graph12…m[,c(c1…cm)s(s1…sm)]c(c1…cm)c1…cmm.()l¡Lss(s1…sm)s1…smmO()STodp.igraphy1y2x,c(l.)s(Od)y1xy2xSTATAttestvarname=#ttestvarname1=varname2[,unequalunpaired]ttestvarname,by()[unequal]ttesti#ttesti111222[,unequal]sdtest12oneway[,meansbonferronischeffesidak]•tN(ms2)H0:m=m0STATAttest=#(#m0)ex1.dta(x1x2),gend=x2-x1H00t()ttestd=0Variable|ObsMeanStd.Dev.----------+-------------------------------------------d|10.67999991.645735Ho:mean=0t=1.31with9d.f.Pr|t|=0.2237tp[1](t)•tttSTATAttest1=2(ex1.dta),useex1.dta,clearttestx1=x2Variable|ObsMeanStd.Dev.----------+---------------------------------------x1|1012.591.632619x2|1013.271.080175----------+----------------------------------
本文标题:STATA-讲义
链接地址:https://www.777doc.com/doc-4776873 .html