Announcement

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

  • How to include categorical variables into my model?

    Hello,

    I am trying to conduct a poisson regression on my data about what determines an Oscar-winning film. Overall I have 50 observations which include numerical variables (box office, IMDB scores) but also categorical (11 countries and 10 movie genres). How can I include the latter into my model? And which post-estimation methods could I use afterwards?

    Thank you for any guidance!

  • #2
    Categorical variables are usually best dealt with using factor-variable notation. This means that your country variable, for instance, might be coded 1 for UK, 2 for France, 3 for Spain, etc. And then in your regression, you enter this as i.country. Factor-variable notation, used in default mode as just shown, handles the commonest situations. Where there is need to control which category is used as base, or when you want to only include certain countries, the notation can be modified to accommodate these needs. See -help fvvarlist- for details.

    For post-estimation, factor-variable notation enables you to use the -margins- command. That command is rich, and complicated. While the Stata PDF documentation of -margins- is good, I think it is easier to learn it from the excellent Richard Williams' https://www3.nd.edu/~rwilliam/stats/Margins01.pdf.

    Comment


    • #3
      Thank you so much Clyde for your prompt response! I understand how to proceed now and I will surely check out the presentation on using the margin command!

      Comment


      • #4
        Thanks for the kind words Clyde. I'll add that if you only have 50 observations it may be very hard to get many independent variables in there. Even if all these variables do have nonzero effects in the population, the sample may be too small to detect them. My guess is that you'll have to go with a more parsimonious model. But you can try what you have in mind and see how far you get.
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        Stata Version: 17.0 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://www3.nd.edu/~rwilliam

        Comment

        Working...
        X