Announcement

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

  • longitudinal model - creating independent variable

    Data and description of variables

    Image 1: Picture 1 and Sample unbalanced paneldata

    Click image for larger version

Name:	Picture 1 and Sample unbalanced paneldata.png
Views:	1
Size:	205.1 KB
ID:	1375501
    • Picture 1 shows a balanced panel data that I have created using an unbalanced one provided as a sample in the same image, where I had multiple products (ID) for different amount of years (YEAR). For each product, there were a different number of Shops offering the given product (ID). So as stated, this is a balanced set created by sorting out for the same years, same products (ID), and same shops (marked by the orange area in the sample unbalanced paneldata). This is an important assumption that might affect the perception of the issue stated below. The following is therefore a description of the table shown in Picture 1:
    • Years indicates the amount of period a product lasts for a given product (ID)
    • Shop 1, Shop 2, Shop 3 indicate different prices for a given product (ID) by different firms
    • The minimum and second minimum value depict what shops for a given year and product (ID), have the lowest and second lowest price for that given year. This is needed to calculate the Price difference, which is **(Second minimum value - Minimum Value) / (Minimum Value)
    • An example of this, is given for row 5 (Year 01.01.1995 - ID 101) where Price difference would be (3999-3790)/3790 = 5,51% (In Picture 1)

    Issue
    • In my balanced panel data, (Picture 1), I want to run a fixed effect regression in STATA using xtreg function, where the dependent variable is the Price difference, and number of shops selling a product are the independent variables. This is, so I can say how Price difference as a dependent variable is affected when there is 1 shop selling, when there are two shops selling, and when there are three shops selling.
    • Another problem is, is my assumption valid at all of creating a balanced panel? Is it correct to create a balanced from the unbalanced paneldata, or must I use the unbalanced panel to create such a variable?
    • So my main issue is how to create such independent variables, that measure the dimension of number of shops offering products. To clarify what I mean, I have included an example of a sample fixed effect regression that may explain the structure that I attempt to seek, in Picture 2 below:
    NOTE (In picture 2 expected cell mean to the right is the same as Price difference in Picture 1, and is used as dependent variable. They are regressed on number of firms/shops as independent variables, and these I have an issue creating)

    Image 2: Picture 2
    Click image for larger version

Name:	Picture 2.png
Views:	1
Size:	141.2 KB
ID:	1375502



    What I have tried
    • I have tried, using dummy variables, on shops, but they ended up getting dropped. The dataset provided in picture 1 is a balanced data set as mentioned, which is needed to run (I assume) a fixed effect regression on a paneldata.

    End remark

    The problem I think, might be that I have to use the unbalanced set in order to create this independent variable, i.e. that I am attempting to use a balanced set instead of the unbalanced one. I also posted the question, in a MUCH more unclear format on stack exchange earlier, and I received therefore an answer there accordingly. But now, I have corrected the question to the best of my ability, and posted it here as well, as it is perhaps more relevant with regards to the software used. The link to the question on stack exchange that is added under:

    http://stackoverflow.com/questions/4...75393#42375393

  • #2
    Thank you for informing it was cross posted.

    It seems Nick already gave a reply to your query in stackoverflow.

    As a side note, I kindly ask you to prefer to write Stata (with only the first letter in upper case), as recommend in the FAQ. Thank you in advance.
    Last edited by Marcos Almeida; 23 Feb 2017, 06:32.
    Best regards,

    Marcos

    Comment


    • #3
      Dear Marcos,
      Thanks a lot for your reply.

      I believe however, that nick posted his solution before I edited it properly to include all details, which is why he said
      '' I'm not sure I exactly understand your question, but it seems like you're interested in running (in Stata): ''.
      So I corrected the question by adding all neccessary details to make the question more precise.

      Best regards,

      Dave

      Comment


      • #4
        Hi Dave,

        I see your point.

        For now, I cannot test commands in Stata. But I underline that the best way to inform is like you read in the FAQ.

        In short, a brief display of the data (under CODE delimiters or by installing the SSC dataex) plus a column with your "wishful" result.

        It is the best way simply because it provides enough information "in a nutshell", prompting the members of this Forum to resolve the problem.

        All in all, hopefully you'll get a definitive answer for you query!



        Best regards,

        Marcos

        Comment

        Working...
        X