Basic Graphs, Descriptive, and Inferential Statistics Using Stata Chuck Huber, PhD StataCorp
[email protected]
University of California Riverside November 14, 2016
Outline • • • • • •
Tabulate, pie charts and bar charts Summaries and histograms Tables and boxplots Correlation and scatterplots Measures of Association Measures of Differences
Statistics > Summaries, tables, and tests > Frequency tables > One-way tables
The tabulate command
Graphics > Pie chart
Graphics > Pie charts
graph pie, over(sex) plabel(_all percent, color(white) size(huge)) title(Sex) graph export piechart.png, as(png) width(3200) height(2400) replace
Graphics > Bar chart
Graph > Bar chart
graph bar, over(race) ylabel(, angle(horizontal)) title(Race) graph export barchart.png, as(png) width(3200) height(2400) replace
Outline • • • • • •
Tabulate, pie charts and bar charts Summaries and histograms Tables and boxplots Correlation and scatterplots Measures of Association Measures of Differences
The summarize command
Statistics > Summaries, tables, and tests > Summary and descriptive statistics > Summary statistics
The summarize command
Graphics > Histogram
histogram sbp, normal normopts(lcolor(blue) lwidth(thick)) /// kdensity kdenopts(lcolor(green) lwidth(thick))
Outline • • • • • •
Tabulate, pie charts and bar charts Summaries and histograms Tables and boxplots Correlation and scatterplots Measures of Association Measures of Differences
The table command
Statistics > Summaries, tables, and tests > Other tables > Flexible table of summary statistics
The table command
Graphics > Boxplots
Boxplot for Race
graph box sbp, over(race)
The table command
Statistics > Summaries, tables, and tests > Other tables > Flexible table of summary statistics
The table command
Graphics > Boxplots
Graphics > Boxplots
graph box sbp, over(sex) over(race) ylabel(, angle(horizontal)) title(SBP by Race and Sex) graph export boxplot_racesex.png, as(png) width(3200) height(2400) replace
Outline • • • • • •
Tabulate, pie charts and bar charts Summaries and histograms Tables and boxplots Correlation and scatterplots Measures of Association Measures of Differences
Graphics > Twoway graph
Scatterplot for SBP by Age
twoway (scatter sbp age) /// (lowess sbp age, lcolor(red) lwidth(thick))
The correlate command
Statistics > Summaries, tables, and tests > Summary and descriptive statistics > Correlations and covariances
The correlate command
Graphs > Graph matrix
Graphs > Graph matrix
graph matrix sbp dbp cholesterol triglycerides graph export graphmatrix.png, as(png) width(3200) height(2400) replace
Outline • • • • • •
Tabulate, pie charts and bar charts Summaries and histograms Tables and boxplots Correlation and scatterplots Measures of Association Measures of Differences
Measures of Association
Statistics > Summaries, tables, and tests > Frequency tables > Two-way table with measures of association
Measures of Association
The tabi command
Outline • • • • • •
Tabulate, pie charts and bar charts Summaries and histograms Tables and boxplots Correlation and scatterplots Measures of Association Measures of Differences
Student’s t-test
Statistics > Summaries, tables, and tests > Classical tests of hypotheses > t test (mean-comparison test)
Student’s t-test
The ttesti command
Statistics > Summaries, tables, and tests > Classical tests of hypotheses > t test calculator
The ttesti command
Measure of Effect Size
Statistics > Summaries, tables, and tests > Classical tests of hypotheses > Effect size based on mean comparison
Measure of Effect Size
Effect Size Calculator
Statistics > Summaries, tables, and tests > Classical tests of hypotheses > Effect-size calculator
Effect Size Calculator
Outline • • • • • •
Tabulate, pie charts and bar charts Summaries and histograms Tables and boxplots Correlation and scatterplots Measures of Association Measures of Differences