Announcement

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

  • Confused about something

    Hello,

    I am completely new to STATA and have a problem I am struggling to solve. I am taking a course at a university, but are doing this on my spare time so do not have the possibility to attend classes etc. This forum seem to very good and I have a question regarding what I would think is panel data. The task is about seatbelts and I think it is a quite common task. Seatbelts is a balanced panel from 50 U.S. States, plus the District of Columbia, for the years 1983-1997. It contains the following variables:

    fatalityrate, speed65, speed70, ba08, drinkage21, Income, age, sb_useage, vmt, primary, secondary, state, year and fips.

    I know how to do a regression, but I am struggling with how to account for state effects. Fips is here State ID code, but how do I use stata to find say how the fatality rate differs between Florida and California if I check for sb_useage and Income? How do I see in stata what state ID is connected to what state and also how do I account for state effects compared to not doing it at all? Just use .reg fatalityrate sb_useage Income fips compared to just .reg fatalityrate sb_useage Income to not look at state effects? This is very basic, but it is quite frustrating when you are starting to learn something and you have no one to ask so hope someone could help me out.


  • #2
    Well, I would guess that just looking at the variable called state in your existing data set would tell you which state corresponds to which FIPS code. -browse state fips-. But if that's not the case, you can find a crosswalk at https://www.mcc.co.mercer.pa.us/dps/...de_listing.htm.

    how do I use stata to find say how the fatality rate differs between Florida and California if I check for sb_useage and Income?
    The question is unclear. Do you mean you want to know if, after adjusting for sb_useage and income there is a difference in the levels of the fatality rates in Florida and California? Or do you want to know whether the associations of sb_useage and income with fatality rates differ between California and Florida? Those are very different questions.

    Neither of them, however, would be approached by running reg fatalityrate sb_useage Income fips. The problem is that this code treats fips as a single continuous variable, whereas what you want is a set of indicator variables for the different states. The direct way to do that is to write it as i.fips in the regression command instead of just fips. But depending on what you are trying to do overall, you might be better off declaring fips as your panel variable in the -xtset- command and running some analyses using -xtreg- or similar commands. Without a clearer picture of your research goals it is hard to advise more specifically.

    Comment


    • #3
      Hello Simen,

      Just as a side note, after Clyde's excellent advice.

      The clearer we write the post, the higher the odds of a helpful advice. The FAQ are surely a must read.

      I kindly recommend to select an informative title in the forfhcoming messages. By doing so, there are at least two advantages: one corcerns your issue, since you will entice members whose expertise is mostly related to the theme; the other touches each one of us, presently or in the future, dealing with a similar problem, for we will easily find the topic after a simple 'search'.

      Thank you in advance.
      Best regards,

      Marcos

      Comment


      • #4
        Thank you for your response Clyde. I am sorry for not being clearer. I meant that I want to know whether the associations of sb_useage and income with fatality rates differ between California and Florida.

        Understood Marcos. I tried the search function, but was not successful in finding the answer to this. That might be due to me being completely new to STATA. My title is not clear I agree, but that is partly because I am not sure if this actually categorizes as panel data, but I will follow your advice in the future.

        Best regards,
        Simen

        Comment


        • #5
          That is nice of you, Simen. Also, let me kindly remind you the spelling of Stata (i.e., only the first letter is in upper case) as recommended in the FAQ. Thanks again.
          Best regards,

          Marcos

          Comment


          • #6
            I meant that I want to know whether the associations of sb_useage and income with fatality rates differ between California and Florida.
            So, this requires the use of state X sb_useage and state X income interaction terms in your regression analysis. So it would look something like this

            Code:
            xtset fips year
            xtreg fatality_rate i.fips##c.(sb_useage income) /*OTHER APPROPRIATE COVARIATES*/, fe
            test 6.fips#sb_useage = 12.fips#sb_useage
            test 6.fips#income = 12.fips#income
            Note: 6 and 12 are the FIPS codes for California and Florida, respectively.

            Be aware that since fips is colinear with the fixed effect (in fact, it is the fixed effect), fips will show up in your regression output table as "omitted." That is OK and don't waste a second worrying about it. The fips#income and fips#sb_useage interaction terms will be there, and they are what you need to look at.

            The above code assumes that sb_useage and income are continuous variables. If that is not true, replace c. by i.. If one is discrete and the other continuous, then you need i.fips##(c.sb_useage i.income) or something like that. Do read -help fvvarlist- to understand factor variable notation before proceeding.



            Comment

            Working...
            X