310 likes | 488 Views
Stata 2, Bivariate. Hein Stigum Presentation, data and programs at: http://folk.uio.no/heins/. Aug-14. H.S. 1. Datatypes. Categorical data Nominal: married/ single/ divorced Ordinal: small/ medium/ large Numerical data Discrete: number of children Continuous: weight. Aug-14.
E N D
Stata 2, Bivariate Hein Stigum Presentation, data and programs at: http://folk.uio.no/heins/ Aug-14 H.S. H.S. 1
Datatypes • Categorical data • Nominal: married/ single/ divorced • Ordinal: small/ medium/ large • Numerical data • Discrete: number of children • Continuous: weight Aug-14 H.S. H.S. 2
Data type dictates type of analysis Aug-14 H.S. H.S. 3
Continuous symmetric outcome Example: Birth weight Aug-14 H.S. H.S. 4
Distribution kdensity weight drop if weight<2000 kdensity weight Aug-14 H.S. H.S. 5
Central tendency and dispersion Mean and standard deviation: Mean with confidence interval: Aug-14 H.S. H.S. 6
Equal Not equal Compare groups, equal variance? Aug-14 H.S. H.S. 7
2 independent samples Are birth weights the same for boys and girls? Density plot Scatterplot Aug-14 H.S. H.S. 8
2 independent samples test Aug-14 H.S. H.S. 9
K independent samples • Is birth weight the same over parity? Density plot Scatterplot Equal means? Linear effect? Outliers? Equal variances? Aug-14 H.S. H.S. 10
equal means? Equal variances? K independent samples test Aug-14 H.S. H.S. 11
Does birth weight depend on gestational age? Continuous by continuous Scatterplot Scatterplot, outlier dropped Aug-14 H.S. H.S. 12
Continuous by continuous tests • Cut gestational age up in groups, then use T-test or ANOVA or • Use linear regression with 1 covariate Aug-14 H.S. H.S. 13
Test situations • 2 independent samples • ttest weight, by(sex) • K independent samples • oneway weight parity • By continuous • regress weight gestAge • 2 dependent samples (Paired) • ttest weight_last_year = weight_today Aug-14 H.S. H.S. 14
Continuous skewed outcome Example: Number of sexual partners Aug-14 H.S. H.S. 15
Distribution kdensity partners if partners<=50 Aug-14 H.S. H.S. 16
Central tendency and dispersion Median and percentiles: Aug-14 H.S. H.S. 17
2 independent samples Do males and females have the same number of partners? Scatterplot Density plot Aug-14 H.S. H.S. 18
equal medians? 2 independent samples test Aug-14 H.S. H.S. 19
K independent samples Do partners vary with age? Scatterplot Scatterplot (partners<20) Density plot (partners<20) Aug-14 H.S. H.S. 20
equal medians? K independent samples test Aug-14 H.S. H.S. 21
Table of tests Categorical ordered: use nonparametric tests Aug-14 H.S. H.S. 22
Categorical data Example: Being bullied Aug-14 H.S. H.S. 23
Frequency and proportion Frequency: Proportion with CI: Aug-14 H.S. H.S. 24
Proportion, confidence interval proportion: standard error: confidence interval: x=”disease” n=total number Aug-14 H.S. H.S. 25
equal proportions? Crosstables Are boys bullied as much as girls? Aug-14 H.S. H.S. 26
Ordered categories, trend Does bullied vary with age? twoway (fpfitci bullied agegr) /// (lfit bullied agegr) H.S.
Trend? equal proportions? Ordered categories, trend Aug-14 H.S. H.S. 28
Table of tests Categorical ordered: use nonparametric tests Aug-14 H.S. H.S. 29