五月天婷亚洲天久久综合网,婷婷丁香五月激情亚洲综合,久久男人精品女人,麻豆91在线播放

  • <center id="8gusu"></center><rt id="8gusu"></rt>
    <menu id="8gusu"><small id="8gusu"></small></menu>
  • <dd id="8gusu"><s id="8gusu"></s></dd>
    樓主: niuniuyiwan
    23964 20

    [Stata] Stata基礎(chǔ)操作:繪圖(五) [推廣有獎(jiǎng)]

    • 7關(guān)注
    • 91粉絲

    VIP

    學(xué)科帶頭人

    89%

    還不是VIP/貴賓

    -

    威望
    0 級(jí)
    論壇幣
    14017 個(gè)
    通用積分
    1902.7157
    學(xué)術(shù)水平
    1119 點(diǎn)
    熱心指數(shù)
    1167 點(diǎn)
    信用等級(jí)
    1061 點(diǎn)
    經(jīng)驗(yàn)
    8347 點(diǎn)
    帖子
    1625
    精華
    1
    在線時(shí)間
    2458 小時(shí)
    注冊(cè)時(shí)間
    2010-10-10
    最后登錄
    2024-11-19

    相似文件 換一批

    +2 論壇幣
    k人 參與回答

    經(jīng)管之家送您一份

    應(yīng)屆畢業(yè)生專(zhuān)屬福利!

    求職就業(yè)群
    趙安豆老師微信:zhaoandou666

    經(jīng)管之家聯(lián)合CDA

    送您一個(gè)全額獎(jiǎng)學(xué)金名額~ !

    感謝您參與論壇問(wèn)題回答

    經(jīng)管之家送您兩個(gè)論壇幣!

    +2 論壇幣

    Stata 12 Graphics


    Dawn Koffman

    Office of  Population Research  

    Princeton University


    前言.PNG


    輸入數(shù)據(jù)

    1. clear
    2. input str14 country school1 school2 agemarriage1 agemarriage2
    3.         bangladesh       3.3      4.5      14.8         15.2
    4.         bolivia          6.9      7.6      19.8         20.1
    5.         colombia         7.9      8.6      20.3         20.3
    6.         dr               7.9      8.6      18.3         18.3
    7.         egypt            5.5      7.3      18.9         19.7
    8.         haiti            3.1      4.3      19.6         19.4
    9.         india            3.6      4.3      16.9         17.1
    10.         indonesia        5.9      7.5      18.1         19.3
    11.         morocco          1.6      2.7      18.7         19.6
    12.         nepal            2.4      3.6      16.9         17.4
    13.         pakistan         1.5      2.8      17.9         18.4
    14.         peru             8.1      8.8      20.2         20.6
    15. end
    復(fù)制代碼

    /*標(biāo)記趨勢(shì),分析樣本點(diǎn)-pcarrow*/

    1. local sample MARRIED
    2. local x school
    3. local y agemarriage
    4. local note "Source: Two most recent DHS standard surveys, as of 5/2013"
    5. local xtitle "years of school"
    6. local ytitle "age at marriage"
    7. local ylabel ", angle(0)"
    8. gen pos = 3
    9. replace pos = 12 if country == "morocco"
    10. #delimit ;
    11. twoway pcarrow `y'1 `x'1 `y'2 `x'2,
    12. barbsize(1) lcolor(black) mcolor(black)
    13. || scatter `y'2 `x'2, mcolor(none)
    14. mlabel(country) mlabvposition(pos)
    15. || scatter `y'1 `x'1, msym(o)
    16. mcolor(black) msize(small)
    17. note("`note'", size(vsmall))
    18. ytitle("`ytitle'") xtitle("`xtitle'")
    19. ylabel(`ylabel')
    20. legend(off);
    21. #delimit cr
    復(fù)制代碼

    Displaying Changes.png

    例二:See SJ 5(2):282-284 (2005) and 9(4):621-639 (2009).

    1. u anorexia, replace
    2. bysort treatment (before after) : gen order1 = _n - _N/2
    3. twoway pcarrow before order1 after order1, pstyle(p1) || ///
    4. scatter before order1, pstyle(p1) ms(O) xla(none) xtitle("") yla(, ang(h)) ///
    5. ytitle("weight, lb") by(treatment, row(1) note("") legend(off)) ///
    6. saving(g12, asis replace)
    復(fù)制代碼

    g12.png

    數(shù)據(jù): anorexia.rar (852 Bytes) 本附件包括:

    • anorexia.dta


    直方圖:

    1. set scheme s2mono
    2. sysuse nlsw88.dta, clear
    3. keep if age >=40 | age <= 44
    4. #delimit ;
    5. twoway histogram wage if wage <= 20, percent fcolor(gs12) lcolor(gs12) bin(30)
    6. title("Hourly Wage Distribution, Women 40-44")
    7. note("Source: Stata 12 NLSW 1988 extract", span)
    8. ylabel(, angle(0));
    9. #delimit cr
    復(fù)制代碼

    Histogram.png

    疊加直方圖:

    Overlaying Histograms.png

    1. #delimit ;
    2. twoway histogram wage if union == 1 & wage <= 20,
    3. percent fcolor(gs12) lcolor(gs12) bin(30) ||
    4. histogram wage if union == 0 & wage <= 20,
    5. percent fcolor(none) lcolor(black) bin(30)
    6. title("Hourly Wage Distribution by Union Status, Women 40-44")
    7. note("Source: Stata 12 NLSW 1988 extract", span) ylabel(, angle(0))
    8. legend(ring(0) pos(1) cols(1) order(1 "Union" 2 "Non-Union"));
    9. #delimit cr
    復(fù)制代碼

    盒形圖(box plot)

    Boxplot.png

    1. #delimit ;
    2. graph box wage if age >= 40 & age <= 44, over(race)
    3. title("Hourly Wage by Race, Women 40-44 (n=918)")
    4. note("Source: Stata 12 NLSW 1988 extract")
    5. ylabel(, angle(0));
    6. #delimit cr
    復(fù)制代碼

    分類(lèi)別散點(diǎn)圖

    Scatter and Categorical Variable.png

    1. #delimit ;
    2. twoway scatter wage race if age >= 40 & age <= 44,
    3. title("Hourly Wage by Race, Women 40-44 (n=918)")
    4. note("Source: Stata 12 NLSW 1988 extract")
    5. xlabel(1 "white" 2 "black" 3 "other")
    6. xtitle("") xscale(range(0.5 3.5))
    7. ylabel(, angle(0));
    8. #delimit cr
    復(fù)制代碼

    分類(lèi)別散點(diǎn)圖(抖動(dòng))

    Scatter and Categorical Variable抖動(dòng).png

    1. #delimit ;
    2. twoway scatter wage race if age >= 40 & age <= 44,
    3. jitter(25) msize(tiny) mcolor(gs5)
    4. title("Hourly Wage by Race, Women 40-44 (n=918)")
    5. note("Source: Stata 12 NLSW 1988 extract")
    6. xlabel(1 "white" 2 "black" 3 "other", noticks)
    7. xtitle("") xscale(range(0.5 3.5)) ylabel(, angle(0));
    8. #delimit cr
    復(fù)制代碼

    雙向條形圖

    twoway rbar.png

    1. egen median = median(wage), by(race)
    2. egen upq = pctile(wage), p(75) by(race)
    3. egen loq = pctile(wage), p(25) by(race)
    4. egen iqr = iqr(wage), by(race)
    5. #delimit ;
    6. twoway rbar med upq race, barwidth(0.7) blc(black) bfc(none) lwidth(medthick) ||
    7. rbar med loq race, barwidth(0.7) blc(black) bfc(none) lwidth(medthick)
    8. title("Hourly Wage by Race, Women 40-44 (n=918)")
    9. note("Source: Stata 12 NLSW 1988 extract")
    10. xlabel(1 "white" 2 "black" 3 "other", noticks) xtitle("")
    11. xscale(range(0.5 3.5))
    12. yscale(range(0 42))
    13. ylabel(0 (10) 40, angle(0))
    14. ytitle("hourly wage")
    15. legend(off);
    16. #delimit cr
    復(fù)制代碼

    盒形圖(+散點(diǎn))

    Boxplot with Scatter.png

    1. *Boxplot with Whiskers and Scatter
    2. sysuse nlsw88.dta, clear
    3. set scheme s2mono
    4. egen median = median(wage), by(race)
    5. egen upq = pctile(wage), p(75) by(race)
    6. egen loq = pctile(wage), p(25) by(race)
    7. egen iqr = iqr(wage), by(race)
    8. egen upper = max(min(wage, upq + 1.5 * iqr)), by(race)
    9. egen lower = min(max(wage, loq - 1.5 * iqr)), by(race)
    10. #delimit ;
    11. twoway scatter wage race, jitter(25) msize(tiny) mcolor(gs9) ||
    12. rbar med upq race, barwidth(0.70) blc(black) bfc(none) lwidth(medthick) ||
    13. rbar med loq race, barwidth(0.70) blc(black) bfc(none) lwidth(medthick) ||
    14. rspike upq upper race, lwidth(medthick) ||
    15. rspike loq lower race, lwidth(medthick)
    16. title("Hourly Wage by Race, Women 40-44 (n=918)")
    17. note("Source: Stata 12 NLSW 1988 extract")
    18. xlabel(1 "white" 2 "black" 3 "other", noticks) xtitle("")
    19. xscale(range(0.5 3.5))
    20. yscale(range(0 42))
    21. ylabel(0 (10) 40, angle(0))
    22. ytitle("hourly wage")
    23. legend(off);
    24. #delimit cr
    復(fù)制代碼

    Boxplot with Whiskers and Scatter.png

    1. egen median = median(wage), by(race)
    2. egen upq = pctile(wage), p(75) by(race)
    3. egen loq = pctile(wage), p(25) by(race)
    4. egen iqr = iqr(wage), by(race)
    5. #delimit ;
    6. twoway scatter wage race, jitter(25) msize(tiny) mcolor(gs9) ||
    7. rbar med upq race, barwidth(0.70) blc(black) bfc(none) lwidth(medthick)||
    8. rbar med loq race, barwidth(0.70) blc(black) bfc(none) lwidth(medthick)
    9. title("Hourly Wage by Race, Women 40-44 (n=918)")
    10. note("Source: Stata 12 NLSW 1988 extract")
    11. xlabel(1 "white" 2 "black" 3 "other", noticks) xtitle("")
    12. xscale(range(0.5 3.5))
    13. yscale(range(0 42))
    14. ylabel(0 (10) 40, angle(0))
    15. ytitle("hourly wage")
    16. legend(off);
    17. #delimit cr
    復(fù)制代碼

    盒式-散點(diǎn)-虛線圖-帽線

    Boxplot with Whiskers,Caps and Scatter.png

    1. egen median = median(wage), by(race)
    2. egen upq = pctile(wage), p(75) by(race)
    3. egen loq = pctile(wage), p(25) by(race)
    4. egen iqr = iqr(wage), by(race)
    5. egen upper = max(min(wage, upq + 1.5 * iqr)), by(race)
    6. egen lower = min(max(wage, loq - 1.5 * iqr)), by(race)
    7. #delimit ;
    8. twoway scatter wage race, jitter(25) msize(tiny) mcolor(gs9) ||
    9. rbar med upq race, barwidth(0.70) blc(black) bfc(none) lwidth(medthick) ||
    10. rbar med loq race, barwidth(0.70) blc(black) bfc(none) lwidth(medthick) ||
    11. rspike upq upper race, lwidth(medthick) ||
    12. rspike loq lower race, lwidth(medthick)
    13. title("Hourly Wage by Race, Women 40-44 (n=918)")
    14. note("Source: Stata 12 NLSW 1988 extract")
    15. xlabel(1 "white" 2 "black" 3 "other", noticks) xtitle("")
    16. xscale(range(0.5 3.5))
    17. yscale(range(0 42))
    18. ylabel(0 (10) 40, angle(0))
    19. ytitle("hourly wage")
    20. legend(off);
    21. #delimit cr
    復(fù)制代碼

    盒式-散點(diǎn)-虛線-帽線-均值圖

    Boxplot with Whiskers, Caps,Scatter and Means.png

    1. egen median = median(wage), by(race)
    2. egen upq = pctile(wage), p(75) by(race)
    3. egen loq = pctile(wage), p(25) by(race)
    4. egen iqr = iqr(wage), by(race)
    5. egen upper = max(min(wage, upq + 1.5 * iqr)), by(race)
    6. egen lower = min(max(wage, loq - 1.5 * iqr)), by(race)
    7. #delimit ;
    8. twoway scatter wage race, jitter(25) msize(tiny) mcolor(gs9) ||
    9. rbar med upq race, barwidth(0.70) blc(black) bfc(none) lwidth(medthick) ||
    10. rbar med loq race, barwidth(0.70) blc(black) bfc(none) lwidth(medthick) ||
    11. rcap loq lower race, lcolor(black) msize(*4) lwidth(medthick) ||
    12. rcap upq upper race, lcolor(black) msize(*4) lwidth(medthick)
    13. title("Hourly Wage by Race, Women 40-44 (n=918)")
    14. note("Source: Stata 12 NLSW 1988 extract")
    15. xlabel(1 "white" 2 "black" 3 "other", noticks) xtitle("")
    16. xscale(range(0.5 3.5))
    17. yscale(range(0 42))
    18. ylabel(0 (10) 40, angle(0))
    19. ytitle("hourly wage")
    20. legend(off);
    21. #delimit cr
    復(fù)制代碼

    柱狀圖

    Bar Graph.png

    1. #delimit ;
    2. graph bar (mean) wage,
    3. over(union) over(married) over(collgrad)
    4. blabel(bar, format(%9.2f)) yscale(off)
    5. title("1988 Mean Hourly Wage of Women Age 40-44")
    6. subtitle("by union status, marital status, and college graduation")
    7. note("Source: Stata 12 NLSW 1988 extract", span);
    8. #delimit cr
    復(fù)制代碼

    水平條形圖:

    1. #delimit ;
    2. graph hbar wage, over(ind, sort(1))
    3. over(collgrad)
    4. title("1988 Mean Hourly Wage of Women
    5. Age 40-44", span size(med))
    6. note("Source: Stata 12 NLSW 1988
    7. extract", span)
    8. nofill ytitle("") ysize(8);
    9. #delimit cr
    復(fù)制代碼

    Horizontal Bar Graph.png

    點(diǎn)圖:

    Dot Plot.png

    1. delimit ;
    2. graph dot wage, over(ind, sort(1))
    3. over(collgrad)
    4. title("1988 Mean Hourly Wage of Women
    5. Age 40-44", span size(med))
    6. note("Source: Stata 12 NLSW 1988
    7. extract", span)
    8. nofill ytitle("") ysize(8);
    9. #delimit cr
    復(fù)制代碼

    雙變量點(diǎn)圖:

    Dot Plot with 2 Variables.png

    1. #delimit ;
    2. graph dot (p25) wage (p75) wage,
    3. over(ind, sort(2)) over(collgrad)
    4. title("Upper and Lower Quartile of
    5. Hourly Wage", span)
    6. subtitle("Women Age 40-44, by College
    7. Graduation Status, 1988", span)
    8. note("Source: Stata 12 NLSW 1988
    9. extract", span)
    10. nofill ytitle("") ysize(8) xsize(6)
    11. legend(off);
    12. #delimit cr
    復(fù)制代碼
    二維碼

    掃碼加我 拉你入群

    請(qǐng)注明:姓名-公司-職位

    以便審核進(jìn)群資格,未注明則拒絕

    關(guān)鍵詞:Stata基礎(chǔ) Stata 基礎(chǔ)操作 tata Bangladesh University country india

    已有 1 人評(píng)分經(jīng)驗(yàn) 論壇幣 學(xué)術(shù)水平 熱心指數(shù) 信用等級(jí) 收起 理由
    xddlovejiao1314 + 100 + 100 + 5 + 5 + 5 精彩帖子

    總評(píng)分: 經(jīng)驗(yàn) + 100  論壇幣 + 100  學(xué)術(shù)水平 + 5  熱心指數(shù) + 5  信用等級(jí) + 5   查看全部評(píng)分

    本帖被以下文庫(kù)推薦

    沙發(fā)
    xddlovejiao1314 學(xué)生認(rèn)證  發(fā)表于 2015-7-13 10:51:57 |只看作者 |壇友微信交流群
    好貼,謝謝分享,再接再厲。
    藤椅
    ydb8848 發(fā)表于 2015-7-13 11:24:54 |只看作者 |壇友微信交流群
    厲害,收下啦。。。呵呵
    已有 1 人評(píng)分經(jīng)驗(yàn) 論壇幣 收起 理由
    xddlovejiao1314 + 10 + 3 鼓勵(lì)積極發(fā)帖討論

    總評(píng)分: 經(jīng)驗(yàn) + 10  論壇幣 + 3   查看全部評(píng)分

    板凳
    niuniuyiwan 在職認(rèn)證  發(fā)表于 2015-9-2 10:54:26 |只看作者 |壇友微信交流群
    1. sysuse lifeexp, clear
    2. gen gnp000 = gnppc/1000
    3. label var gnp000 "GNP per capita, thousands of dollars"
    4. scatter lexp gnp000, xsca(log) ///
    5. xlabel(.5 2.5 10(10)40, grid)
    復(fù)制代碼

    Graph.png




    已有 1 人評(píng)分經(jīng)驗(yàn) 論壇幣 學(xué)術(shù)水平 熱心指數(shù) 信用等級(jí) 收起 理由
    xddlovejiao1314 + 50 + 20 + 1 + 1 + 1 精彩帖子

    總評(píng)分: 經(jīng)驗(yàn) + 50  論壇幣 + 20  學(xué)術(shù)水平 + 1  熱心指數(shù) + 1  信用等級(jí) + 1   查看全部評(píng)分

    報(bào)紙
    niuniuyiwan 在職認(rèn)證  發(fā)表于 2015-9-17 10:58:35 |只看作者 |壇友微信交流群

    1.PNG


    2.PNG


    Graph.png


    jscatter.rar (831 Bytes) 本附件包括:

    • jscatter.do


    已有 1 人評(píng)分經(jīng)驗(yàn) 論壇幣 學(xué)術(shù)水平 熱心指數(shù) 信用等級(jí) 收起 理由
    xddlovejiao1314 + 50 + 20 + 1 + 1 + 1 精彩帖子

    總評(píng)分: 經(jīng)驗(yàn) + 50  論壇幣 + 20  學(xué)術(shù)水平 + 1  熱心指數(shù) + 1  信用等級(jí) + 1   查看全部評(píng)分

    地板
    玄一無(wú)相 在職認(rèn)證  學(xué)生認(rèn)證  發(fā)表于 2015-10-2 22:42:27 |只看作者 |壇友微信交流群
    為什么這個(gè)箭頭趨勢(shì)圖我實(shí)線不了呢,stata13.1
    已有 1 人評(píng)分經(jīng)驗(yàn) 論壇幣 收起 理由
    xddlovejiao1314 + 10 + 3 鼓勵(lì)積極發(fā)帖討論

    總評(píng)分: 經(jīng)驗(yàn) + 10  論壇幣 + 3   查看全部評(píng)分

    7
    tkt718 發(fā)表于 2015-10-2 23:37:30 來(lái)自手機(jī) |只看作者 |壇友微信交流群
    niuniuyiwan 發(fā)表于 2015-7-13 10:47
    [/td][/tr]
    [/table]

    太神奇了!支持經(jīng)管代碼庫(kù)……呵呵
    已有 1 人評(píng)分經(jīng)驗(yàn) 論壇幣 收起 理由
    xddlovejiao1314 + 10 + 3 鼓勵(lì)積極發(fā)帖討論

    總評(píng)分: 經(jīng)驗(yàn) + 10  論壇幣 + 3   查看全部評(píng)分

    8
    niuniuyiwan 在職認(rèn)證  發(fā)表于 2015-10-3 09:37:08 |只看作者 |壇友微信交流群
    tkt718 發(fā)表于 2015-10-2 23:37
    太神奇了!支持經(jīng)管代碼庫(kù)……呵呵
    感謝支持
    已有 1 人評(píng)分經(jīng)驗(yàn) 論壇幣 收起 理由
    xddlovejiao1314 + 10 + 3 鼓勵(lì)積極發(fā)帖討論

    總評(píng)分: 經(jīng)驗(yàn) + 10  論壇幣 + 3   查看全部評(píng)分

    9
    niuniuyiwan 在職認(rèn)證  發(fā)表于 2015-10-3 09:52:57 |只看作者 |壇友微信交流群
    玄一無(wú)相 發(fā)表于 2015-10-2 22:42
    為什么這個(gè)箭頭趨勢(shì)圖我實(shí)線不了呢,stata13.1
    您好,這里是帖子代碼編輯錯(cuò)誤,原帖已修正,同時(shí)感謝您的回復(fù)和支持。
    已有 1 人評(píng)分經(jīng)驗(yàn) 論壇幣 收起 理由
    xddlovejiao1314 + 10 + 3 鼓勵(lì)積極發(fā)帖討論

    總評(píng)分: 經(jīng)驗(yàn) + 10  論壇幣 + 3   查看全部評(píng)分

    10
    niuniuyiwan 在職認(rèn)證  發(fā)表于 2015-10-15 11:41:57 |只看作者 |壇友微信交流群
    1. sysuse bplong, clear
    2. #delimit ;
    3. graph box bp,
    4.   over(when) over(sex)
    5.   ytitle("Systolic blood pressure")
    6.   title("Response to treatment, by Sex")
    7.   subtitle("(120 Preoperative Patients)" " ")
    8.   note("Source:  Fictional Drug Trial, Stata Corporation, 2003") ;
    9. #delimit cr
    復(fù)制代碼

    Graph.png



    本版微信群
    加好友,備注jltj
    拉您入交流群

    京ICP備16021002-2號(hào) 京B2-20170662號(hào) 京公網(wǎng)安備 11010802022788號(hào) 論壇法律顧問(wèn):王進(jìn)律師 知識(shí)產(chǎn)權(quán)保護(hù)聲明   免責(zé)及隱私聲明

    GMT+8, 2024-12-23 05:19