欢迎来到麦多课文档分享! | 帮助中心 海量文档,免费浏览,给你所需,享你所想!
麦多课文档分享
全部分类
  • 标准规范>
  • 教学课件>
  • 考试资料>
  • 办公文档>
  • 学术论文>
  • 行业资料>
  • 易语言源码>
  • ImageVerifierCode 换一换
    首页 麦多课文档分享 > 资源分类 > PPT文档下载
    分享到微信 分享到微博 分享到QQ空间

    Basic syntax for commands.ppt

    • 资源ID:378853       资源大小:165.17KB        全文页数:27页
    • 资源格式: PPT        下载积分:2000积分
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    二维码
    微信扫一扫登录
    下载资源需要2000积分(如需开发票,请勿充值!)
    邮箱/手机:
    温馨提示:
    如需开发票,请勿充值!快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如需开发票,请勿充值!如填写123,账号就是123,密码也是123。
    支付方式: 支付宝扫码支付    微信扫码支付   
    验证码:   换一换

    加入VIP,交流精品资源
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    Basic syntax for commands.ppt

    1、Computing for Research I Spring 2013,Primary Instructor: Elizabeth Garrett-Mayer,Stata Graphics February 12,Basic syntax for commands,prefix: command varlist, optionsExamples: regress y x, level(90) by race: sum y x, detail ttest y, by(x) unequal,Stata Graphics,Maybe we can just end class now! Check

    2、 out these links: http:/www.ats.ucla.edu/stat/stata/library/GraphExamples/default.htm http:/www.ats.ucla.edu/stat/stata/topics/graphics.htm http:/data.princeton.edu/stata/graphics.html http:/ univariate displays,Boxplots Stem and leaf Histograms Density plots,Ceramide Data,Lets look at the ceramide

    3、markers What are their distributions? Are there outliers? Should we consider taking logs, or using % change?Results of a phase II trial of gemcitabine plus doxorubicin in patients with recurrent head and neck cancers: serum C-ceramide as a novel biomarker for monitoring response. Saddoughi SA, Garre

    4、tt-Mayer E, Chaudhary U, OBrien PE, Afrin LB, Day TA, Gillespie MB, Sharma AK, Wilhoit CS, Bostick R, Senkal CE, Hannun YA, Bielawski J, Simon GR, Shirai K, Ogretmen B. Clin Cancer Res. 2011 Sep 15;17(18):6097-105. Epub 2011 Jul 26.,Histogram,hist c18,Lets make it prettier,* prettier histograms hist

    5、 c18 , freq xaxis(1 2) ylabel(0(2)24) xlabel(20 “Twenty“ 40 “Forty“)hist c18, title(“Histogram of C18 Ceramide“) subtitle(“PI: K. Shirai“)hist c18, ytitle(“number of patients“) freq yline(0(10)20)hist c18, xaxis(1 2) xlabel(19.6 “mean“ 11.9 “median“, axis(2) grid),finding help on these can sometimes

    6、 be tricky! e.g. help axis_choice_options,Boxplots,graph box c18,Boxplots,graph box c18, by(cycle) graph box c18, over(cycle)tab cycle graph box c18 if cycle7, over(cycle)sort patient cycle merge m:1 patient using “Ptdata.GemDox.dta“ graph box c18 if cycle7, over(cycle) over(gender)graph hbox c18, o

    7、ver(initial) capsize(5),graph hbox c18, over(initial) capsize(5),graph hbox c18, over(initial) medtype(marker)medmarker(msymbol(+) msize(large)graph hbox c18, over(initial) ytitle(“C18”),Labels,Sometimes xlabels cannot be applied (e.g. boxplots) need to label your values Example: cycle for boxplotsl

    8、abel define cycle 1 “cycle 1“ 3 “cycle 3“ 5 “cycle 5“ 7 “cycle 7“ label values cycle cycle graph box c18 if cycle7, over(cycle) (Hint: use this on the homework!),Stem and Leaf,. stem c18Stem-and-leaf plot for c18ceramide (C18 ceramide)c18ceramide rounded to nearest multiple of .1 plot in units of .1

    9、0* | 42,43,44,460* | 57,57,67,81,89,90,96,98,99,991* | 01,06,08,08,14,15,19,20,35,441* | 622* | 03,15,16,18,19,19,222* | 823* | 173* | 4* | 23,494* | 58,68,685* | 5* | 6* | 376* | 86,Dotplot,Excellent way to show data across groups when you have a relatively small dataset dotplot y, over(group) dotp

    10、lot c18, over(cycle) dotplot c18, over(gender) dotplot c18, over(gender) nogroup dotplot c18, over(gender) nogroup jitter(3) dotplot c18, over(gender) nogroup median center,Dotplot, by gender,Scatterplots,Two way graph Syntax: graph twoway scatter y x1 x2 graph twoway scatter y x1 Example: graph two

    11、way scatter c18 totalceramide,Regression example,Scatterplot Residual plots Leverage Fitted line with raw data,Code,graph twoway scatter c18 totalcer regress c18 totalcer* residual plot * (residual vs. fitted) rvfplot* the long way * 1. generate a new variable from the regression, residuals predict

    12、resid, res * 2. generate a new variable from the regression, fitted values predict fit scatter res fit, yline(0) * leverage vs. residual plot lvr2plot* take transform of C18? gladder c18 boxcox c18,* generate new variable gen logc18=log(c18) scatter logc18 totalcer scatter logc18 totalcer, mlabel(ge

    13、nder) scatter logc18 totalcer, mlabel(gender) s(i) scatter logc18 totalcer, s(Oh)* redo regression regress logc18 totalcer rvfplot, yline(0) lvr2plot predict logfit* make plot of fitted model and raw data scatter logfit logc18 totalcer scatter logfit logc18 totalcer, s(i o) c(l .) graph twoway scatt

    14、er logfit totalcer, s(i) c(l) | scatter logc18 totalcer, s(o) c(.),The next graph to create,Fancier way to put regression lines,* data is described at http:/data.princeton.edu/wws509/datasets/infile str14 country setting effort change /using http:/data.princeton.edu/wws509/datasets/effort.rawgraph t

    15、woway scatter change setting graph twoway (scatter change setting ) (lfit change setting ) graph twoway (scatter change setting ) (qfit change setting ) graph twoway (scatter change setting ) (lfitci change setting ),/ “continuation” comment scatter makes a scatterplot of the two variables lfit plot

    16、s the regression line of y on x qfit plots a fitted quadratic model of y on x lfitci plots the line AND a confidence interval!,Fancier way to put regression lines,Plot using qfit,Plot using lfitci,One slight problem with the labels is the overlap of Costa Rica and Trinidad Tobago (and to a lesser ex

    17、tent Panama and Nicaragua). We can solve this problem by specifying the position of the label relative to the marker using a 12-hour clock (so 12 is above, 3 is to the right, 6 is below and 9 is to the left) and the mlabv() option. We create a variable to hold the position set by default to 3 oclock

    18、 and then move Costa Rica to 9 oclock and Trinidad Tobago to just a bit above that at 11 oclock (we can also move Nicaragua and Panama up a bit, say to 2 oclock).,graph twoway (lfitci change setting) (scatter change setting, mlabel(country) ),gen pos=3 replace pos = 11 if country = “TrinidadTobago“

    19、replace pos = 9 if country = “CostaRica“ replace pos = 2 if country = “Panama“ | country = “Nicaragua“graph twoway (lfitci change setting) / (scatter change setting, mlabel(country) mlabv(pos) )* see marker_label_options in help,Legends,graph twoway (lfitci change setting) /(scatter change setting,

    20、mlabel(country) mlabv(pos) ) /, title(“Fertility Decline by Social Setting“) /ytitle(“Fertility Decline“) /legend(pos(5) order(2 “linear fit“ 1 “95% CI“) graph twoway (lfitci change setting) /(scatter change setting, mlabel(country) mlabv(pos) ) /, title(“Fertility Decline by Social Setting“) /ytitl

    21、e(“Fertility Decline“) /legend(off) * see help title_options for pos and ring in legend,Spaghetti plots,Command available from UCLA: spagplot* spaghetti plots clear insheet using “I:MUSC OncologyShirai, KeisukeOctober2010ceramide.csv“ findit spagplot spagplot c18 cycle, id(patient) spagplot c18 cycl

    22、e, id(patient) nofit* remove patients who only have cycle=1 sort patient cycle by patient: gen visit=_n egen maxvis=max(visit), by(patient) spagplot c18 cycle if maxvis1, id(patient) nofit* or, use c(L) graph twoway scatter c18 cycle if maxvis1, c(L) help connectstyle,other neat stuff,graph matrix saving graphs: click and save as desired format saving and combining (see princeton site, section 3.3) http:/data.princeton.edu/stata/graphics.htmlSee GraphExamples on ucla site: http:/www.ats.ucla.edu/stat/stata/library/GraphExamples/,


    注意事项

    本文(Basic syntax for commands.ppt)为本站会员(figureissue185)主动上传,麦多课文档分享仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知麦多课文档分享(点击联系客服),我们立即给予删除!




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1 

    收起
    展开