Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Re: Programmatically determining if predictors have been dropped from a model


From   Steve Samuels <sjsamuels@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: Programmatically determining if predictors have been dropped from a model
Date   Thu, 16 Sep 2010 13:32:27 -0400

--
capture the statements or the block of statements that might stop the
run because of a dropped predictor. Capture has no options that I know
of.


Steve




On Thu, Sep 16, 2010 at 1:10 PM, Barth Riley <BarthRiley@comcast.net> wrote:
> What particular option with capture would I use?
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Steve Samuels
> Sent: Thursday, September 16, 2010 12:06 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: Re: Programmatically determining if predictors have been
> dropped from a model
>
> --
> Barth, if your only goal is to keep the -do file- going,  how about
> -capture- or -capture noisily-?
>
> Steve
>
> Steven J. Samuels
> sjsamuels@gmail.com
>
> On Thu, Sep 16, 2010 at 12:53 PM, Joseph Coveney <jcoveney@bigplanet.com>
> wrote:
>> Barth Riley wrote:
>>
>> I am running a series of Monte Carlo simulations using logistic
> regression.
>> Occasionally, the regression analysis will drop a variable (due to
>> collinearity, the variable having only one value, or the variable
> perfectly
>> predicting the outcome). I would like to know when a variable has been
>> dropped in order to prevent my do file from crashing (i.e., when I call
> test
>> <indep. Var> and the variable doesn't exit in the model). I have tried
> using
>> both logistic and logit functions and neither provide information on the
>> variables left in the model (i.e., via return list), nor does the confirm
>> function work with variables as they exist in a model. Does anyone have
> any
>> suggestions?
>>
>>
> ----------------------------------------------------------------------------
> ----
>>
>> Isn't that kind of information in the coefficient vector (coefficients
> fixed to
>> zero, and column equation names containing the letter "o" for "omitted"),
> and
>> other ereturn matrixes, like e(Cns), e(rules) and so on?
>>
>> Joseph Coveney
>>
>> . sysuse auto
>> (1978 Automobile Data)
>>
>> . generate byte k = 1
>>
>> . generate int weight1 = weight - 1
>>
>> . logistic foreign i.k c.(weight weight1), nolog
>> note: 1.k omitted because of collinearity
>> note: weight1 omitted because of collinearity
>>
>> Logistic regression                               Number of obs   =
>   74
>>                                                  LR chi2(1)      =
>  31.96
>>                                                  Prob > chi2     =
> 0.0000
>> Log likelihood = -29.054002                       Pseudo R2       =
> 0.3548
>>
>>
> ----------------------------------------------------------------------------
> --
>>     foreign | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf.
> Interval]
>>
> -------------+--------------------------------------------------------------
> --
>>         1.k |  (omitted)
>>      weight |    .997416   .0006078    -4.25   0.000     .9962254
>  .9986079
>>     weight1 |  (omitted)
>>
> ----------------------------------------------------------------------------
> --
>>
>> . foreach matrix in b Cns rules {
>>  2. matrix list e(`matrix')
>>  3. }
>>
>> e(b)[1,4]
>>       foreign:    foreign:    foreign:    foreign:
>>            1o.                      o.
>>             k      weight     weight1       _cons
>> y1           0  -.00258739           0   6.2825993
>>
>> e(Cns)[2,5]
>>     foreign:  foreign:  foreign:  foreign:     _Cns:
>>          1o.                  o.
>>           k    weight   weight1     _cons        _r
>> r1         1         0         0         0         0
>> r2         0         0         1         0         0
>>
>> e(rules)[2,4]
>>         c1  c2  c3  c4
>>    1.k   4   0   0   0
>> weight1   4   0   0   0
>>
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index