Announcement

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

  • Combining dummy & categorical variable

    Hi there!
    I am new to stata, and need to work something out. I have a dummy variable (Pmov) for if somebody has recently moved into a private rental, and a categorical variable (Ethn) which lists their ethnicity. What I want to do is to create a new categorical variable that still categorises by ethnicity, but only shows movers into private rentals from those ethnicities. I've been searching high and low for answers, can somebody please point me in the right direction? This seems like it's probably a really simple question, but it's been causing me a lot of trouble, as I say, big novice right here. Here's what the data looks like:
    Pmov Native Turks Moroc Other_nonwestern West_Mig
    0 10,414 389 650 923 2,414 1,114
    1 1,473 84 204 346 366 328
    Cheers
    C

  • #2
    Welome to Stata, and to Statalist, Chris.

    Since the new categorical variable must have values for every observation, it's clear that for those observations with Pmov==1 it will have the same values as the current categorical variable. What's unclear is what values you want it to have for those observations where Pmov==0. Or is that question where your hangup is - that for your analysis you aren't sure what the value should be? In that case, you'll need to tell us more about the analysis you plan. It could be as simple as not needing to create any new variables, but just rely on Stata's factor variable capability (see help factor variable) to create an interaction between your two categorical variables (the "dummy" variable Pmov is just a categorical variable with two categories).

    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. Note especially sections 9-12 on how to best pose your question. The more you help others understand your problem, the more likely others are to be able to help you solve your problem.

    And, because you admit to being a novice, as we all were once, let me offer a piece of advice on climbing the Stata learning curve. I'm sympathetic to you as a new user of Stata - it's a lot to absorb. And even worse if perhaps you are under pressure to produce some output quickly. Nevertheless, I'd like to encourage you to take a step back from your immediate tasks.

    When I began using Stata in a serious way, I started, as have others here, by reading my way through the Getting Started with Stata manual relevant to my setup. Chapter 18 then gives suggested further reading, much of which is in the Stata User's Guide, and I worked my way through much of that reading as well. There are a lot of examples to copy and paste into Stata's do-file editor to run yourself, and better yet, to experiment with changing the options to see how the results change.

    All of these manuals are included as PDFs in the Stata installation (since version 11) and are accessible from within Stata - for example, through the PDF Documentation section of Stata's Help menu. The objective in doing the reading was not so much to master Stata as to be sure I'd become familiar with a wide variety of important basic techniques, so that when the time came that I needed them, I might recall their existence, if not the full syntax, and know how to find out more about them in the help files and PDF manuals.

    The Stata documentation is really exemplary - there's just a lot of it. The path I followed surfaces the things you need to know to get started in a hurry and to work effectively. If you haven't systematically explored the documentation, I encourage you to do so.

    Comment


    • #3
      Thank you William.
      Yes, reading through the 'getting started' manual is something I'm doing as and when problems come up, but reading through it progressively sounds like a good plan. I already have 'a Gentle Introduction...' by Acock and refer to it from time to time- it's very early days, though!
      I plan to run an mlogit with movers into private rentals by ethnicity being the dependent (native being the reference category), using different geographical locations as the independent variables, and a move into a private rental being the dependent.
      Many thanks!
      Last edited by Chris Pynn; 20 Mar 2017, 11:33.

      Comment


      • #4
        Thanks for the statement of your model. I'm not quite certain I understand, because you twice use "dependent" in your description.

        Let's suppose for each individual you have
        Pmov = 1 if they moved into a private rental, 0 otherwise
        eth = 1, 2, 3, 4, 5 for ethnicity, in the order shown in post #1
        geog = categorical variable for geographic locations

        If you are trying to predict mobility, it seems to me you want Pmov as your dependent variable, eth and geog as your independent variables, and a simple logistic regression.

        If you are trying to predict ethnicity given mobility, then ... I'm in over my head. I hope someone else can weigh in with advice.

        If not, you might want to start a new topic with a title that includes "mlogit" (e.g. "setting up my data for mlogit") and a more precise description of your variables, your objective in the real world (that is, what is the question you are trying to address), and how you propose to address that with mlogit using the variables you describe.



        Comment

        Working...
        X