Example: stock market

如何利用Stata進行統計分析 基礎篇

stata - / /Paul Wang 17651 stata [ ] stata /SE 13 !! Back to basic!! NEJM & Nature Medicine [ ] 2004 Original Articles NEJM*91 & Nat Med*34 80/20 ANOVA t / !! 2015 4 stata /SE 13 7F/ ( ) 6F/611R( ) 4F/ ( ) stata stata & RAM !! stata /SE!! Outline stata / stata ( ) Unit 1. Unit 2. & stata ( ) Unit 3.

如何利用Stata進行統計分析 -基礎篇 慈濟醫學中心/研究部 王仁宏/Paul Wang paulwang@tzuchi.com.tw 分機17651

Tags:

  Stata

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of 如何利用Stata進行統計分析 基礎篇

1 stata - / /Paul Wang 17651 stata [ ] stata /SE 13 !! Back to basic!! NEJM & Nature Medicine [ ] 2004 Original Articles NEJM*91 & Nat Med*34 80/20 ANOVA t / !! 2015 4 stata /SE 13 7F/ ( ) 6F/611R( ) 4F/ ( ) stata stata & RAM !! stata /SE!! Outline stata / stata ( ) Unit 1. Unit 2. & stata ( ) Unit 3.

2 Unit 4. Unit 5. 1. stata (1/2) 0. / (2/2) 0. / ( ) / SPSS Menu Bar Open Save Print Results Log Begin Viewer Graph Do-file Editor Data Editor Data Editor (Browse) Variables Manager Clear more- condition Break 2. -- / ( ) Hosmer & Lemeshow(2000) 189 (bwt) (<2500g)(low) (age) (lwt) (race) (smoke) (ptl) (ht) (ui) (ftv) Excel Step 1.

3 Import File Import Excel spreadsheet Step 2. Excel ( ) Import first row as variable names Excel stata stata import excel "D:\ stata \ ", sheet("Sheet1") firstrow 1. Ex: id identification code 2. Ex: (<2500g)(low) 0: No/ 1:Yes 3. Ex: smoke nonsmoker smoker 1 2 4. Ex: nonsmoker smoker 0 1 5. Ex: (1: <30 y/o/ 2: 30 y/o) 1 & 2 Data Variables Manager Label Value Label stata label variable id identification code label define yesno 0 "No" 1 "Yes" label values low yesno 1 & 2 Variables Manager Manage Value Label 3 & 4 1. Ex: smoke nonsmoker smoker 1 2 2.

4 Ex: nonsmoker smoker 0 1 stata encode smoke, generate(smoke1) stata recode smoke1 (1=0) (2=1) label define nysmoke 0 "nonsmoker" 1 "smoker" label values smoke1 nysmoke 5 Ex: (1: <30 y/o/ 2: 30 y/o) stata summarize age stata recode age (min/29=1) (30/max=2), generate(agegr) label variable agegr "age group" label define agr 1 "<30 y/o" 2 ">=30 y/o" label values agegr agr tab1 agegr stata PART I. ? -- & Mean Median Mode Max/Min Quartile(Q1,Q3) Range Standard Deviation Histogram Pie Chart Boxplot -- UNIT 1-1.

5 Vs A B A B RA RB / / ( ) (a) (b) (c) (c) = = (a) (b) stata (1/2) stata Statistics Summaries, tables and tests Summary and descriptive statistics Summary Statistics 1. (ex: age) 2. Standard display Display additional statistics 1 2 stata (2/2) !! Standard display Display additional statistics -- UNIT 1-2. / stata (1/2) stata Statistics Summaries, tables and tests Frequency tables One-way table 1. (ex: race) 2. (ex: missing bar chart ) 1 2 stata (2/2) !

6 ! Default Produce a bar chart stata tabulate race tab1 race stata tabulate race, plot stata (1/3) ( ) stata Statistics Summaries, tables and tests Frequency tables Two-way table with measures of association stata (2/3) 1 2 3 stata (3/3) (p-value< *) stata tabulate race smoke, chi2 exact row -- UNIT 2. & Bar Graph Boxplot Histogram Line Graph Pie Chart (Bar Graph) stata Graphics Bar chart 1 2 Main Y Categories X Title/Legend (Bar Graph) stata Graphics Bar chart 1 2 X title (Bar Graph) / stata graph bar (mean) bwt, over(smoke) over(race) title(Birth weight of different smoke/race) (Bar Graph) / stata graph bar (mean) bwt, over(smoke) over(race) title(Birth weight of different smoke/race) asyvars (Histogram)

7 stata Graphics Histogram 1 2 3 Main Y Density plot/X axis/Y axis/Title (Histogram) Fit Y axis/X axis/Title (Histogram) stata histogram age, frequency normal ytitle(Count) xtitle(Age) title(Overall age distribution) (Box Plot) stata Graphics Box plot 1 Main Y Categories X Y axis/Title (Box Plot) stata Graphics Box plot 1 2 X title (Box Plot) / stata graph box bwt, over(smoke) over(race) title(Birth weight of different race/smoke group) (Line Graph) stata Graphics Twoway graph 1 Plots X Y Y X axis/Y axis/Title (Line Graph) stata Graphics Twoway graph 1 2 3 (Line Graph) id stata twoway (line bwt id, sort), ytitle(Birth weight) xtitle(Id sequence) title(Trend of birthweight by id sequence) (Pie Chart) stata Graphics Pie chart 1 Main Title/Legend (Pie Chart) stata Graphics Pie chart 1 (Pie Chart) stata graph pie, over(race) title(Pie chart of race) stata !

8 ! stata stata Graph File Save As *.gph( stata ) *.png *.tif *.pdf stata graph save Graph "D:\ stata \ graph export "D:\ stata \ ", as(tif) replace stata Graph Edit Start Graph Editor / stata Window Do-file editor New Do-file editor /// row() col() ; xsize() ysize() !! title() ; note() race/smoke (meanbwt) (sdbwt) (n) Error bar (hibwt & lobwt) Mean SD (smrace) !! Do-file Review stata & stata ( ) Unit 1.

9 Unit 2. & stata ( ) Unit 3. Unit 4. Unit 5. !! / (Y) / (X) (central tendency) Independent t-test Paired t-test ANOVA Repeated measures ANOVA Linear regression Wilcoxon rank-sum test Wilcoxon signed-rank test Kruskal-Wallis test Friedman test Spearman s correlation (association) (Yate ) McNemar s test Cochran s Q test Logistic regression Cochran s Q test Cochran s Q test Multilnomial/ Ordinal Logistic regression Reference stata ( , 2012) An Introduction to stata for Health Researchers(Svend, 2008) Q & A


Related search queries