Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • generate separate group variables instead of categorical variable. Need your help!

    Hi everyone,

    I have a logistic model to test the effect of different individual characteristics on participation in charitable giving.

    My model looks like logit charity_participation i.generation sex i.income_class i.educ_level happiness char_conf marital_status i.religion

    The variable of interest in generation which I have created recoded the variable from WVS:

    gen generation = .
    replace generation = 1 if V241 >= 1943 & V241 <= 1963
    replace generation = 2 if V241 >= 1964 & V241 <= 1979
    replace generation = 3 if V241 >= 1980 & V241 <= 1995
    label define gencuts 1 "Baby Boomers" 2 "Generation X" 3 "Millennials"
    label values generation gencuts



    V241 is a variable which corresponds the birth age of the respondents.

    As a result using i.generation in the logic model I can interpret the results for Generation X and Millennials related to the Baby Boomers (difference Millennials and Gen X from Baby Boomers).

    My question: I would like to have 3 separate generations to interpret their variables separately (not related to base group - Baby Boomers). Should I then create instead of categorical variable separate variable for each of 3 generations? can you help with the coding in that case?


    Thank you in advance.


  • #2
    It's not clear to me exactly what you want here. If you try to include indicators for all three generations in the model, then they will be colinear with the constant and something has to be left out in order to identify the model. If you do that by omitting the constant that changes the interpretation of the coefficients.

    If what you would like to see are modeled adjusted rates of charity participation in all three groups, you don't need to change your model. Just run
    Code:
    margins generation
    after it.

    See https://www3.nd.edu/~rwilliam/stats/Margins01.pdf for an outstanding introduction to the -margins- command by the excellent Richard Williams.

    Comment


    • #3
      Dear Clyde,
      Thank you for your answer.

      I would like to ask: does this margins command work with the binary variable ( in case I will have only 2 generations:

      gen generation = .
      replace generation = 1 if V241 >= 1943 & V241 <= 1963
      replace generation = 2 if V241 >= 1980 & V241 <= 1995
      label define gencuts 1 "Baby Boomers" 2 "Millennials"
      label values generation gencuts

      I have tried to run the same command margins in the case where I have only 2 age groups and I have received the result:
      factor 'generation' not found in list of covariates
      As I understood correctly it doesn't"t work with binary variable.

      Can use advise please which command can be used to see the modeled adjusted rates of charity participation if I have only 2 age groups

      Comment


      • #4
        The error message you received suggests that i.generation was not included in the logit command you ran most recently before running the margins command.

        As I understood correctly it doesn't work with binary variable.
        That is not a correct understanding. I too recommend the reading Clyde suggested in post #2.

        We can further help you if we know what commands (logit and margins) you tried and what Stata output from each. Please review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. See especially sections 9-12 on how to best pose your question. Section 12.1 is particularly pertinent

        12.1 What to say about your commands and your problem

        Say exactly what you typed and exactly what Stata typed (or did) in response. N.B. exactly!
        It's particularly helpful to copy commands and output from your Stata Results window and paste them into your Statalist post using code delimiters [CODE] and [/CODE], as described in section 12 of the FAQ.



        Comment

        Working...
        X