Announcement

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

  • Problem in converting Monthly Panel Data in Wide form

    Dear Statalist

    I am working with monthly panel data. to recognize monthly panel data i have used following commands
    gen years =monthly(year, "YM")
    format years %tm

    Actually, my data contains lot of missing observations in almost all variables and i want to impute those missing values by using multiple imputation method. for this i need to convert data in wide form. i used the following command

    reshape wide ltir cpi m3 cbpr stir indpro, i(id) j(years)


    but wide command is not working and the following error is noted.



    *******
    variable years not constant within id
    Your data are currently long. You are performing a reshape wide. You typed something like

    . reshape wide a b, i(id) j(year)

    There are variables other than a, b, id, year in your data. They must be constant within id because that is the only way they can fit
    into wide data without loss of information.

    The variable or variables listed above are not constant within id. Perhaps the values are in error. Type reshape error for a list of
    the problem observations.

    Either that, or the values vary because they should vary, in which case you must either add the variables to the list of xij variables
    to be reshaped, or drop them.
    r(9);
    *********

    Kindly guide me how can i resolve this issue

    Regards

    Uzma

  • #2
    With monthly data -- even if there are gaps -- it should be no surprise to get up to 12 observations in each year. So, the error message is expected.

    How would you intend to impute? Sometimes with panel data there is a case for interpolation, although it's perhaps more common that you should work with the data as they come. Imputation that pays no attention to dependence structure in time will usually be a bad idea.

    Comment


    • #3
      Thank you Sir for your reply. Basically i want to apply Markov Chain Method to investigate the causal relationship between variables. for this i need balanced data. for balanced panel, first i though to take moving averages, but i lost variation in data, then i learnt that multiple imputation in stata works better.

      Comment


      • #4
        But how would you intend to impute? And why are there gaps in the first place?

        Comment


        • #5
          I am using secondary data on different variables like interest rate, consumer price index, industrial production index of OECD countries. data is missing because it is not publically available for some time period. .
          For imputation, i am not sure, which method will give me better results. none of the varaiable has complete data, so linear regression i think is not suitable to predict missing data. i need your expert advice to move forward.

          Comment


          • #6
            Sorry, but I can't add usefully to my previous comments because you are not really answering my question. You say you want to use multiple imputation but don't address the point about dependence structure.

            Comment

            Working...
            X