UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata Textbook Examples
Design and Analysis by Geoffrey Keppel
Chapter 7: Analysis of Trend

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. We use the o. prefix before a because we will want to examine the trend coefficients. You can download the xi3 command by typing findit xi3 (see How can I use the findit command to search for programs and get additional help? for more information about using findit).
use http://www.ats.ucla.edu/stat/stata/examples/da/chap7, clear
xi3: regress numcorr o.a

o.a               _Ia_1-4             (_Ia_4 for a==4 omitted)

      Source |       SS       df       MS              Number of obs =      80
-------------+------------------------------           F(  3,    76) =   10.72
       Model |      652.30     3  217.433333           Prob > F      =  0.0000
    Residual |     1541.90    76  20.2881579           R-squared     =  0.2973
-------------+------------------------------           Adj R-squared =  0.2695
       Total |     2194.20    79  27.7746835           Root MSE      =  4.5042

------------------------------------------------------------------------------
     numcorr |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _Ia_1 |   1.788854   .5035891     3.55   0.001     .7858698    2.791839
       _Ia_2 |     -2.225   .5035891    -4.42   0.000    -3.227985   -1.222015
       _Ia_3 |   .0559017   .5035891     0.11   0.912    -.9470829    1.058886
       _cons |      19.85   .5035891    39.42   0.000     18.84702    20.85298
------------------------------------------------------------------------------
We can use the test command below to get the overall test of the main effect of a.
test  _Ia_1 _Ia_2 _Ia_3

 ( 1)  _Ia_1 = 0.0
 ( 2)  _Ia_2 = 0.0
 ( 3)  _Ia_3 = 0.0

       F(  3,    76) =   10.72
            Prob > F =    0.0000
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. Because we use the o. prefix, we requested tests of orthogonal polynomials, meaning that the term _Ia_1 refers to the linear trend, _Ia_2 refers to the quadratic trend, and _Ia_3 refers to the cubic trend. The regression table above gives us the tests of all three trend components, but in terms of t-tests.  Below we can use the test command to request F tests as shown in the book.
test  _Ia_1

 ( 1)  _Ia_1 = 0.0

       F(  1,    76) =   12.62
            Prob > F =    0.0007

test  _Ia_2

 ( 1)  _Ia_2 = 0.0

       F(  1,    76) =   19.52
            Prob > F =    0.0000

test _Ia_3

 ( 1)  _Ia_3 = 0.0

       F(  1,    76) =    0.01
            Prob > F =    0.9119 

How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


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