Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: test for trend

From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: test for trend
Date   Mon, 06 Jun 2005 19:23:30 +0900

Manuela De Allegri wrote:

Can anyone tell me how I can do a test for trend for an adjusted odds ratio
estimate derived from a logistic regression? I am interested in exploring
whether there is an increasing effect on income on my outcome variable after
I control for all other variables in the model.


If your problem is that your income variable is categorical (income
categories), then take a look at -desmat-, a user-written command from John
Hendrickx (-findit desmat-).  Setting up an orthogonal polynomial contrast
for the income categories will enable you to test for trend (linear
component as well as higher-order polynomial terms) after logistic
regression.  Its use for this is illustrated below using an artificial
dataset.  You can also use Helmert contrasts with it.

If all of your predictor variables are categorical, then -tabodds- will give
a test for trend.  It's illustrated below, too.  Cochran-Mantel-Haenszel
weighting isn't the same as logistic regression, however.

Joseph Coveney

set more off
drawnorm outcome predictor1, corr(1 0.7 \ 0.7 1) ///
  n(200) seed(`=date("2005-06-06", "ymd")') clear
generate float predictor2 = uniform()
generate float predictor3 = uniform()
replace outcome = outcome > 0
compress outcome
generate byte income_category = 1
forvalues cut = 0.25(0.25)0.75 {
    replace income_category = income_category + ///
      ( norm(predictor1) > `cut' )
foreach var of varlist predictor2 predictor3 {
    generate byte cat_`var' = 1
    forvalues cut = 0.25(0.25)0.75 {
    replace cat_`var' = cat_`var' + ///
      ( norm(`var') > `cut' )
* Begin here
char income_category[pzat] orp(3)
char predictor2[pzat] dir
char predictor3[pzat] dir
desmat: logistic outcome income_category predictor2 ///
  predictor3, verbose desrep(all) nolog
tabodds outcome income_category, ///
  adjust(cat_predictor2 cat_predictor3)

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index