+ Reply to Thread
Results 1 to 8 of 8

Thread: stata logit (logistic regression)

  1. #1
    Points: 3,183, Level: 34
    Level completed: 89%, Points required for next Level: 17

    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    stata logit (logistic regression)



    Can you use the following command

    logit con gender agegrps

    if agegrps has 3 values? Does the resulting table make any sense if the variable agegrps is not binary and coded 0 and 1?

    Thank you

    qim

  2. #2
    Points: 2,940, Level: 33
    Level completed: 27%, Points required for next Level: 110

    Location
    Washington, DC
    Posts
    100
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm guessing from your variable names you're regressing consumption on gender and age group?

    First of all, in a logit regression the dependent variable must be binary.

    As for age group, see my answer to your question about dummy variables. You'll want to decompose this into dummies for each group.

  3. #3
    Points: 2,965, Level: 33
    Level completed: 44%, Points required for next Level: 85

    Location
    Oxford
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I guess con is the dependent variable? if so, you might declare a categorical (dummy) variable by using i or xi or so... you might want to check the command book of stata. I am not sure.

  4. #4
    Points: 3,183, Level: 34
    Level completed: 89%, Points required for next Level: 17

    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, I could do

    xi: logit con *** i.agegrps


    The problem is that I am supposed to calculate predicted possibilities and while I can read the normal regression I CANNOT read (I am ashamed to say) the regression when you have the agegrps split up into 3. I can't relate the coefficients to 'con' and especially how to read the Iagegrps_2 which is omitted.

    . xi: logit con *** i.agegrps [pw=weight]
    i.agegrps _Iagegrps_1-3 (naturally coded; _Iagegrps_2 omitted)

    (sum of wgt is 2.2190e+03)
    Iteration 0: log pseudolikelihood = -1651.5837
    Iteration 1: log pseudolikelihood = -1642.1845
    Iteration 2: log pseudolikelihood = -1642.1614
    Iteration 3: log pseudolikelihood = -1642.1614

    Logistic regression Number of obs = 2756
    Wald chi2(3) = 14.33
    Prob > chi2 = 0.0025
    Log pseudolikelihood = -1642.1614 Pseudo R2 = 0.0057

    ------------------------------------------------------------------------------
    | Robust
    con | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    *** | .1102079 .0998779 1.10 0.270 -.0855492 .305965
    _Iagegrps_1 | -.1929194 .1292349 -1.49 0.135 -.4462152 .0603765
    _Iagegrps_3 | .2774401 .1120542 2.48 0.013 .0578179 .4970622
    _cons | -1.103701 .1715891 -6.43 0.000 -1.440009 -.7673924
    ------------------------------------------------------------------------------

    The first independent variable is xes (the other way roun which the forum does not allow!)


    Can you help there?

    qim
    Last edited by qim; 12-09-2008 at 04:00 PM.

  5. #5
    Points: 2,940, Level: 33
    Level completed: 27%, Points required for next Level: 110

    Location
    Washington, DC
    Posts
    100
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok the coefficient on agegrp_1, for example, is the effect of being in agegrp_1 relative to being in the omitted group, in this case _2. (It has to be omitted to avoid multicollinearity. Alternately you could omit the constant by adding noconstant in the command. If you do this the interpretation of the coefficients will be slightly different) So in your example, age grp 1 is insignificant, while agegrp3 is significant at about 2%.

    To predict expected values of the dependent variable you should just be able to use the predict command with appropriate options--check the manual for this.

  6. #6
    Points: 3,183, Level: 34
    Level completed: 89%, Points required for next Level: 17

    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank ou veru much. But now I have another proble. The next step was to do something like this:

    generate prob = exp(-1.652666+0.01183*agegrps)/ (1 + exp(-1.652666+0.01183*agegrps))

    If I have several (3) agegrps which coefficient am I going to use to generate the rob? Or do I need to generate more than one? if I do that it does not make sense (to me).

    Or do I keep adding the various agegroups before dividing by the denominator?

    Help...
    qim

  7. #7
    Points: 2,940, Level: 33
    Level completed: 27%, Points required for next Level: 110

    Location
    Washington, DC
    Posts
    100
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I really think you want to split agegrps into 3 separate variables. You can do this by:

    gen agegrp1=0
    replace agegrp1=1 if agegrps==1 (I forget the proper syntax for "else" in STATA but you get the point)

    gen agegrp2=0
    replace agegrp2=1 if agegrps==2

    gen agegrp3=0
    replace agegrp3=1 if agegrps==3

    Then you run:
    logit con sx agegrp1 agegrp3


    Then predict. The predict command would do this but if you want to do it manually you can just take the data for one observation and put it in the estimated equation--you'll include both agegrp1 and agegrp3 since it'll just zero out if eith value is 0, and if both are the effect is captured in the constant.

    I'm happy to keep this up, but it seems like you're unclear on what exactly a logit regression will tell you, why you put certain variables in, etc. I'd suggest you read up on the basics of linear regression before worrying too much about logit--the principles of multicollinearity, dummy variables, predicted values, etc will translate well.

  8. #8
    Points: 3,183, Level: 34
    Level completed: 89%, Points required for next Level: 17

    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks AtlasFrysmith

    I'm sorry, you're right. I haven't got a clue. I am not a statistics student, but somehow I was lumped with this and have to finish it tonight. I have read as much as I could but 1 week is not enough.

    Somehow I need to get from xi: command ... i.agegrp to generate prob (manually). from the notes there was no splitting into 3 variables, although I am sure tha is the right, best way to do it.

    Anyway, I'm now editing this message to say thank you very much for your help, and that the assignment has now been delivered by e-mail. So, that will be the end of staistics for the rest of my life!

    Many thanks

    qim
    Last edited by qim; 12-09-2008 at 05:56 PM.

+ Reply to Thread

Similar Threads

  1. Need help with logit equation (logistic regression)
    By Knockout in forum Statistics
    Replies: 0
    Last Post: 04-15-2011, 12:46 PM
  2. Logit/logistic regression-non-binary variables
    By Dr.Appalayya in forum SPSS
    Replies: 0
    Last Post: 07-04-2010, 07:37 AM
  3. Logit regression using STATA
    By bearhokie in forum Stata
    Replies: 0
    Last Post: 06-24-2009, 02:09 PM
  4. Replies: 4
    Last Post: 09-03-2008, 04:21 AM
  5. Stata - ordered logistic regression
    By cinnamon_nut in forum Stata
    Replies: 0
    Last Post: 08-05-2008, 10:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats