Announcement

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

  • Missing data in Panel data Stata 17

    I am unfamiliar with stata and need it for my thesis. I am having some problems with my panel data. I currently have panel data for 4200 people between the years 2008 and 2022. However, I have missing data. There are two variables that are often missing. What I would like to do is:
    1. See how often someone is missing data. So, per person see how often they have one or more variables missing. If it happens in more than 20% of the years for that person, I want to delete this person.
    2. After I have done this, I want to impute the missing values. I have used mi set, and registered my imputed and regular data. Which next steps do I take? Does it matter how many imputations I add? What is the correct command for this? After I have done this, can I see the imputed values in the data in stata? Because I have tried a few things, but I never seem to see imputed data in my data if I type browse.
    3. After doing this, I want to run a xtivreg on the data. It is a normal OLS regression, with first an instrumental variable regression to show there is a relation between my dependent and independent variable.

    Thank you in advance for the help.

  • #2
    Laura:
    welcome to this forum.
    As far as your question is concerned:
    1) deleting missing values may have a rational if and only if their missingness is nor informative (the estimates remain inefficient though, because the sample size is reduced);
    2) 20 imputations are the rule of thumb. Stata .dta should include all the imputed datasets along with the original one (that is, the one with missing values);
    3) as fara as I know, there's no way to do what you're after, A previous thread on the very same topic (xtivreg with mi set data - Statalist) left unreplied.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you for the quick response. I have decided to do an xtivreg first, and then after fill in the missing data when doing the actual regression. I think this would be possible, as with the xtivreg I will only show that my instrument is good.

      I do have a question related to doing the xtivreg. If I am doing my xtivreg, do I need to include if it is fe or re already? Currently, my instrument is something that does not change over time. I do have panel data. So, if I were to use the fe here, it would not work, as my independent variable that I am estimating with my instrument will be omitted.

      Also, is it correct that the code for seeing if I have a good instrument would be: xtivreg dependentvariable (independentvariable = instrument) allcontrolvariables, fe? And then comparing this to doing the same thing only with xtreg? If I have done the xtivreg and the xtreg, how do I prove that my instrument is good? Do I prove this when in the xtivreg, the coefficient for the independent variable hat has a low p-value? Or is there another way to prove this.

      Next to this, I have a question related to the mi, so imputing data. I have finished trying to impute the data, and it says it is all complete. However, if I then codebook my variables, I get negative values too. For instance, one of my variables becomes in the range of -2.15 and 7, while it can only be 0 or higher. Can I do something about this?

      Also, once I have done the mi imputations, do I have to keep working within mi? If so, how do I do this? What would be the command to regres within my panel data after imputing the missing data? Do I also have to include if it is fe or re there?

      Sorry for all the questions, but I am a bit confused when it comes to stata. Thank you in advance for the help.

      Comment


      • #4
        Laura:
        1) if you just code -xtivreg- you call the -re- estimator (which is the default option). Its an -fe- characteristic to get rid of time-invariant variables (due to demeaning);
        2) see the Example available from -help xtivreg postestimation-;
        3) double-check the regression method(s) you used to impute your missing data;
        4) yes; see -help mi_estimation- that supports -xtreg-.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X