Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Variable names incompatable with aflogit?


From   rps <[email protected]>
To   <[email protected]>
Subject   st: Variable names incompatable with aflogit?
Date   Fri, 11 Aug 2006 14:09:47 -0400

Title: Variable names incompatable with aflogit?
I have encountered the following problem when using the aflogit (sbe21.pkg) user-supplied module for calculating population attributable fraction (AF) following a logistic regression (the data set is tuyns.dta, which is distributed with the package):

The following logistic regression command is issued:

xi: logit case i.alcohol [fw=n]

which produces:

i.alcohol         _Ialcohol_0-3       (naturally coded; _Ialcohol_0 omitted)

Iteration 0:   log likelihood = -494.74421
Iteration 1:   log likelihood = -428.70187
Iteration 2:   log likelihood = -421.84193
Iteration 3:   log likelihood = -421.49571
Iteration 4:   log likelihood = -421.49545

Logistic regression                               Number of obs   =        975
                                                  LR chi2(3)      =     146.50
                                                  Prob > chi2     =     0.0000
Log likelihood = -421.49545                       Pseudo R2       =     0.1481

------------------------------------------------------------------------------
        case |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
 _Ialcohol_1 |    1.27124    .232332     5.47   0.000     .8158777    1.726602
 _Ialcohol_2 |   2.054459   .2611044     7.87   0.000     1.542704    2.566214
 _Ialcohol_3 |   3.304162   .3236511    10.21   0.000     2.669817    3.938506
       _cons |  -2.588542   .1925445   -13.44   0.000    -2.965922   -2.211161
------------------------------------------------------------------------------

Then the aflogit command is given:

aflogit _Ialcohol* [fw=n], cc

which produces the following error:

Population attributable fraction from logistic regression
Case-control data (n=975)

Using weights [fweight = n]

Term      Ref.     A.F.        s.e.      [95% Conf. Int.]*
----------------------------------------------------------
l_1 not found
r(111);

Referring to the model terms explicitly does not help, as in

aflogit _Ialcohol_1 _Ialcohol_2 _Ialcohol_3 [fw=n], cc

However, renaming _Ialcohol_1 _Ialcohol_2 _Ialcohol_3 as alcohol1 alcohol2 alcohol3, respectively, allows the aflogit module to execute:

logit case alcohol1 alcohol2 alcohol3 [fw=n]
aflogit alcohol1 alcohol2 alcohol3 [fw=n], cc

producing

[logistic regression outout omitted]
Population attributable fraction from logistic regression
Case-control data (n=975)

Using weights [fweight = n]

Term      Ref.     A.F.        s.e.      [95% Conf. Int.]*
----------------------------------------------------------
alcohol1   0      0.2698      0.0451      0.1759   0.3530
alcohol2   0      0.2223      0.0340      0.1526   0.2863
alcohol3   0      0.2167      0.0287      0.1584   0.2710
----------------------------------------------------------
TOTAL             0.7089      0.0508      0.5903   0.7931

* CI calculated on log(1-AF) scale

Any insight anyone can give as to why aflogit doesn’t accept the original indicator variable names will be appreciated. For the present example, renaming the variables is a reasonable solution, but it becomes tedious is there are several factors in the model each with multiple indicator variables.

Thanks,

Richard Steiner
The University of Akron



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