Title: Stata 2, Bivariate
1Stata 2, Bivariate
- Hein Stigum
- Presentation, data and programs at
- http//folk.uio.no/heins/
Nov-09
H.S.
1
2Datatypes
- Categorical data
- Nominal married/ single/ divorced
- Ordinal small/ medium/ large
- Numerical data
- Discrete number of children
- Continuous weight
Nov-09
H.S.
2
3Data type dictates type of analysis
Nov-09
H.S.
3
4Continuous symmetric outcome
Nov-09
H.S.
4
5Distribution
kdensity weight
drop if weightlt2000 kdensity weight
Nov-09
H.S.
5
6Central tendency and dispersion
Mean and standard deviation
Mean with confidence interval
Nov-09
H.S.
6
7Compare groups, equal variance?
Nov-09
H.S.
7
82 independent samples
- Are birth weights the same for boys and girls?
Density plot
Scatterplot
Nov-09
H.S.
8
92 independent samples test
Nov-09
H.S.
9
10K independent samples
- Is birth weight the same over parity?
Density plot
Scatterplot
Equal means? Linear effect? Outliers?
Equal variances?
Nov-09
H.S.
10
11K independent samples test
Nov-09
H.S.
11
12Continuous by continuous
- Does birth weight depend on gestational age?
Scatterplot
Scatterplot, outlier dropped
Nov-09
H.S.
12
13Continuous by continuous tests
- Cut gestational age up in groups, then
use T-test or ANOVA - or
- Use linear regression with 1 covariate
Nov-09
H.S.
13
14Test 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
Nov-09
H.S.
14
15Continuous skewed outcome
- Example
- Number of sexual partners
Nov-09
H.S.
15
16Distribution
kdensity partners if partnerslt50
Nov-09
H.S.
16
17Central tendency and dispersion
Median and percentiles
Nov-09
H.S.
17
182 independent samples
- Do males and females have the same number of
partners?
Scatterplot
Density plot
Nov-09
H.S.
18
192 independent samples test
Nov-09
H.S.
19
20K independent samples
- Do partners vary with age?
Scatterplot (partnerslt20)
Density plot (partnerslt20)
Scatterplot
Nov-09
H.S.
20
21K independent samples test
Nov-09
H.S.
21
22Table of tests
Categorical ordered use nonparametric tests
Nov-09
H.S.
22
23Categorical data
Nov-09
H.S.
23
24Frequency and proportion
Frequency
Proportion with CI
Nov-09
H.S.
24
25Proportion, confidence interval
xdisease ntotal number
- proportion
- standard error
- confidence interval
Nov-09
H.S.
25
26Crosstables
Are boys bullied as much as girls?
Nov-09
H.S.
26
27Ordered categories, trend
Does bullied vary with age?
twoway (fpfitci bullied agegr) /// (lfit
bullied agegr)
28Ordered categories, trend
Nov-09
H.S.
28
29Table of tests
Categorical ordered use nonparametric tests
Nov-09
H.S.
29