Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: multi-dimensional chi-squared?


From   Steven Samuels <sjhsamuels@earthlink.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: multi-dimensional chi-squared?
Date   Wed, 21 Jul 2010 09:06:42 -0400

For your problem, the relevant section in the -mgof- help is "Test against non-uniform distribution". If you have one observation for each week, use the first example in that section. Ssubstitute the name of your count variable for "x" and your predicted probabilities in the recode statement.

Steve


On Jul 20, 2010, at 10:13 PM, Steven Samuels wrote:

Download -mgof-, Goodness-of-fit tests for multinomial data,  from SSC

There are assumptions behind -mgof-. One is that there is no dependence of the counts in different weeks (This is different from assuming that the decision to put an item on sale each week was independent of the decision for the other items that week.) . A second is that the probabilities were constant from week-to-week. Without more information on how the data were generated, it's difficult to say more.

Steve

On Jul 20, 2010, at 10:54 AM, Chevalier, Judy wrote:


Hello. I am fairly new to this listserve. I have a question about how one my think about constructing a test statistic and then how to program it in STATA. I may be missing a good way to think about it. I will present this in the context of an economics/marketing dataset, though it may have a close analog in other domains.

Consider a dataset with multiple products (let's call them 4 different brands of peanut butter to be concrete) observed over multiple weeks. I have coded whether each product for each week is at its regular price or on sale. I am interested in the question of whether one and only one product being on sale in a given week occurs more frequently than would be predicted if the product sales were independent of one another. So, I have (easily calculated) the frequency with which:

0 items are on sale
1 item is on sale
2 items are on sale
3 items are on sale
All 4 items are on sale.

Also, given the overall frequency that each item is on sale, I have also easily calculated the predicted probability (under the null hypothesis of independence) that 0 items would be on sale, 1 item would be on sale, 2 items would be on sale, 3 items would be on sale, etc.

I can see that 1 item is on sale more frequently in the data than would be predicted under the null hypothesis of independence, and, of course, the other categories are somewhat less frequent than would be predicted under the null. However, I am stymied as to how to construct an appropriate test statistic. I can test for the independence of the sales for each item, pairwise, easily, using Stata, but I can't quite manage the right test statistic nor how to compute it in Stata. I will actually repeat this test for some other samples--- the products will be different, the number of products will be different, but the hypothesis will be the same-- that 1 and only 1 product is on sale more often than would be predicted under the null of independence.

If you have gotten this far-thanks for reading!

Judy

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index