Announcement

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

  • rangestat command

    Hello all,

    I need your help regarding rangestat command. I have a panel dataset with the panel dimensions as stores and weeks. I have the sales price of 11 products in each combination of stores and weeks.

    I want to create an average price for each product across the other stores but within the same week. For instance, for product 1, I want the average price of product 1 sold at all the stores in a given week, etc.

    I am using the command

    rangestat (mean) average_price = price, interval(store 1 137) excludeself by (product week)

    I am not sure if I am using the command correctly. I tried to compute the values of a couple of observations manually to validate te results and I think they are not the same. For instance, I filtered my data to only include product 1 and week 1. I then calculated the average price of product 1 sold in week 1 at all the stores. I got a different result.

    Would you please help? Am I defining the command correctly? the interval should include the stores, am I right?

  • #2
    The command looks okay to me, but a data example (use dataex) and your calculation would help understand what is going on.

    Comment


    • #3
      Like Hemanshu Kumar I would like to see an example, but the syntax looks odd to me.


      Code:
      rangestat (mean) average_price = price, interval(week 0 0) excludeself by(product)
      You report a test using the average of all stores, but also a desire to average all the other stores.

      Note that there is an easy test

      mean for other stores = (total value for all stores MINUS value for this store) / (number of stores MINUS 1)

      except that the test is a little more subtle if missing values are present.

      Comment

      Working...
      X