应用stata做统计分析.doc_第1页
应用stata做统计分析.doc_第2页
应用stata做统计分析.doc_第3页
应用stata做统计分析.doc_第4页
应用stata做统计分析.doc_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1) Describe 数据的简要描述 d2) List 将所有数据列在result里面 l3) Summarize 分析统计指标 su4) correlate 统计各个变量之间的相关系数 cor5) graph twoway connected math score,yaxis(1)|connected english score,yaxis(2) title(“”)横坐标表示score 左y轴表示数学 右y轴表示英语6) browse chinese math if score640只显示总分大于640的数学和语文的成绩7) edit math ability score 只显示数学 基本能力和总分,可以进行编辑8) gen any=uniform() 新建一个随机变量 ,从0-19) list math chinese english in 60/70 列出其中60-70个观测值的数学语文和英语10) replace any=100*any 将ANY这个变量的值*100,然后取代原来的变量11) sample 10 仅剩下随即的10%,sample 30,count随机的剩下30个观测值12) gsort math 按数学从高到低排序13) gsort name 将观测值的姓名顺序排序14) gsort name 姓名逆序排序15) help gesort 排序的帮助16) tabulate math if score600 在result窗口中显示 总分600以上的数学得 频数 百分比及累计百分比17) edit math score 在编辑器窗口中只显示数学和总分18) list in 4在result窗口中只显示第4个观测值19) list in 10/20列出第10-20个观测值20) sum if score660 只对总分大于660的观测值进行统计分析21) sun if place !=”canada”对字符串的除外统计22) sum if score600&score620|(math=140&english=135)列出其中的总分大于620 或者数学大于140和英语大于135 的观测值24) help datafun寻找日期的命令25) help strfun字符串函数26) dispay 作为统计显示的计算器使用27) sum math ,display r(mean),gen mathdev=math-r(menn),sum math mathdev28) help egen生成函数的扩展29) tabulate class,gen (class) 在编辑窗口 新生成16个变量,class26-41,并且以0-1 表示30) list class class10-class14 在result 中只显示10-14班的内容31) sum math if class!=28 对数学进行求统计量,然后排出28班32) replace score2=1 if score =600&score.主要针对缺失值的运算 因为缺失值.被认为是非常大的数。33) gen score3=autocode(score,4,600,700) 将编辑器中的数据,按照625 650 675 700进行分类34) list score score2 score3 此时result窗口显示的是每一个分数对应的指标,是否是600以上的,在哪个区间上?35) gen score5=group(5) 将编辑器中的数据按规模分为5组36) gen caseid=_n 在编辑器里面创建一个变量 从1-2-3.。37) display score45 此时是在上一步的基础上选择第45条观测值38) gen difscore=score-score_n-1生成一个新变量difscore其数值=序列2的数据减去序列1的数据,依次排列。39) use laizhou20;uselaizhou40;append using laizhou20注意最后那个合并命令中的using指的是当前编辑器中的文件数据,所以后面应该是加上最开始打开的那个数据laizhou2040) xpose,clear varname在result中转置的命令prov1v2v3v4v5a2223345566b2355533445c3345434366d3344444343555里面是三个变量组成 的图标,现在要将其变成长格式。Reshape long v,i(pro) j(n) +-+ | pro n v | |-| 1. | a 1 22 | 2. | a 2 23 | 3. | a 3 34 | 4. | a 4 55 | 5. | a 5 66 | |-| 6. | b 1 23 | 7. | b 2 55 | 8. | b 3 53 | 9. | b 4 34 | 10. | b 5 45 | |-| 11. | c 1 33 | 12. | c 2 45 | 13. | c 3 43 | 14. | c 4 43 | 15. | c 5 66 | |-| 16. | d 1 334 | 17. | d 2 444 | 18. | d 3 43 | 19. | d 4 43 | 20. | d 5 555 | +-+41) reshape long grow,i(pro)j(year)42) graph twoway connected v n,yline(0) by(pro)43) collapse (mean) grow,by(pro)44) set obs 1000 模拟1000次随机的掷骰子的程序obs was 0, now 1000. gen roll=1+trunc(6*uniform(). tab roll roll | Freq. Percent Cum.-+- 1 | 168 16.80 16.80 2 | 179 17.90 34.70 3 | 139 13.90 48.60 4 | 175 17.50 66.10 5 | 171 17.10 83.20 6 | 168 16.80 100.00-+- Total | 1,000 100.0045) histogram english,frequency xlabel(0(2)150) ylabel(0(2)100) ytick(1(2)101) start(0) width(2)46) histogram english,frequency xlabel(0(5)150) ylabel(0(2)33) ytick(1(5)21) start(0) width(1)47) histogram english,frequency title(chenkui) xlabel(0(5)150) ylabel(0(2)33) ytick(1(5)21) start(0) width(1)48) graph twoway line cl ca t 49) graph twoway line cl t,connect(stairstep) 50) graph twoway line cl t 51) graph twoway connected cl t 52) graph hbar math english ,over(class)53) 54) graph bar (sum) math english chinese,over(class) 55) histogram score ,start(0) width(25) xlabel(0(50)700) frequency norm 56) qnorm score,grid 分位-正态图57) graph combine 111.gph 222.gph 58) tabstat

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论