Stata Commands
and Table of Bivariate tests
This page offers detail on basic Stata commands along with a
schema detailing the appropriate test to use bivariate analysis.
Basic
Stata commands:
Stata commands
The basic Stata commands we will use in this workshop are:
Summary Statistics: this command provides summary statistics for
variables v1 v2 and v3 and provides further detail.
su v1 v2 v3, d
Histogram: this command provides a histogram for v1.
hist v1
Scatter plot: this command provides a scatterplot for v1 and v2
scatter v1 v2
Correlation: this command provides the correlation coefficient between
v1 and v2, with significance
corr v1 v2 (or "corr v1 v2, cov" for covariance)
Regression: this commands generates a regression with y as a function of
x
regr y x
Ttest: this command provides a ttest to determine if the mean of v1 is statistically
significant between the two categories presented in v2 (v1 must be a continuous
variable and v2 must be a dichotomous, i.e. 2category, variable)
ttest v1, by(v2)
ANOVA: This test provides you an ANOVA test with associated tables of
values and the post hoc Bonferroni test results.
oneway continuous categorical, t b
ChiSquare: this commands provides a
Chisquare test to determine if two categorical variables are independent of
one another. The options provide you with expected values, the chisquare test
and the contriburion of each cell to the chisquare value.
tab v1 v2, exp chi2 cchi2
Basic schema detailing the appropriate bivariate tests to be
done by type of variable:
Remember the schema I have asked you to put in your notes:
Continuous 
Cat(2) 
Cat(3+) 

Continuous 
Correlation 
ttest 
ANOVA 
Cat(2) 
ttest 
Chisquare 

Cat(3+) 
ANOVA 