Académique Documents
Professionnel Documents
Culture Documents
Bill Rising
Introduction
New Graphical Tools
Conclusion
Goals
Goals
Bill Rising
Introduction
New Graphical Tools
Conclusion
Goals
Getting Started
Bill Rising
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
Bill Rising
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
Can see that the parabola is concave down, and that women
have smaller BMIs then men
Bill Rising
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
Bill Rising
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
23
24
Linear Prediction
25
26
27
25
35
45
55
65
75
age in years
Male
Bill Rising
Female
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
Default Behavior
Stata is bright enough to use the at() variable for the x-axis and
to overlay the two curves
Bill Rising
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
Switching Axes
We can change this default behavior, of course
Here are the same data in a less-useful form (though it shows the
constant offset for the females)
. marginsplot, x(sex)
23
Linear Prediction
24
25
26
27
Male
Female
1=male, 2=female
age=25
age=45
age=65
Bill Rising
age=35
age=55
age=75
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
23
24
Linear Prediction
25
26
27
Predictive Margins
25
30
35
40
45
50
55
age in years
Male
Bill Rising
60
65
70
75
Female
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
.4
.2
25
30
35
40
45
50
55
age in years
age
Bill Rising
60
65
70
75
2.sex
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
Looking at a Logit
Bill Rising
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
Pr(Diabetes)
.1
.2
.3
Predictive Margins
25
30
35
40
45
50
55
age in years
White, Male
Black, Male
Other, Male
Bill Rising
60
65
70
75
White, Female
Black, Female
Other, Female
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
Bill Rising
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
Here are the same set of margins applied to this different model
. quietly margins, at(age=(20(5)75)) over(race sex)
. marginsplot, noci
Bill Rising
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
Contour Plots
Stata 12 now has both filled contour plots and contour line plots
These are both twoway plots
twoway contour for filled contour plots
twoway contourline for contour line plots
Bill Rising
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
Bill Rising
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
. twoway contour z y x
northing
2
1.5
.5
2.5
0
0
2
easting
Bill Rising
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
Bill Rising
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
northing
2
Bill Rising
2
easting
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
northing
2
Bill Rising
2
easting
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
Bill Rising
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
80000
8,000
70000
7,800
7,700
60000
7,600
30000
35000
40000
easting
Bill Rising
45000
50000
depth
northing
7,900
Introduction
New Graphical Tools
Conclusion
Visualizing Margins
Contour Plots
Bill Rising
Introduction
New Graphical Tools
Conclusion
Conclusion
80
age in years
40
.35
.3
.25
.2
.15
.1
20
.05
0
10
20
30
40
Body Mass Index (BMI)
Bill Rising
50
60
Pr(diabetes), predict()
60
.4