Version info: Code for this page has been updated to Stata 12.
In this chapter, Keppel shows how to do trend analysis. Let's start by running the overall anova as shown in table 7-1 on page 143.
use http://www.ats.ucla.edu/stat/stata/examples/da/chap7, clear
On page 145, Keppel shows a test of linear trend, and a test of quadratic trend on page 148, and a test of cubic trend on page 150. We will use the contrast command with the p. operator to test these trends.
anova numcorr a
Number of obs = 80 R-squared = 0.2973
Root MSE = 4.50424 Adj R-squared = 0.2695
Source | Partial SS df MS F Prob > F
-----------+----------------------------------------------------
Model | 652.3 3 217.433333 10.72 0.0000
|
a | 652.3 3 217.433333 10.72 0.0000
|
Residual | 1541.9 76 20.2881579
-----------+----------------------------------------------------
Total | 2194.2 79 27.7746835
contrast p.a, effects
Contrasts of marginal linear predictions
Margins : asbalanced
------------------------------------------------
| df F P>F
-------------+----------------------------------
a |
(linear) | 1 12.62 0.0007
(quadratic) | 1 19.52 0.0000
(cubic) | 1 0.01 0.9119
Joint | 3 10.72 0.0000
|
Residual | 76
------------------------------------------------
------------------------------------------------------------------------------
| Contrast Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
a |
(linear) | 1.788854 .5035891 3.55 0.001 .7858698 2.791839
(quadratic) | -2.225 .5035891 -4.42 0.000 -3.227985 -1.222015
(cubic) | .0559017 .5035891 0.11 0.912 -.9470829 1.058886
------------------------------------------------------------------------------
The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.