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 on April 23, and its replacement, is already up and running.

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

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

From   "Nick Cox" <>
To   <>
Subject   st: RE: RE: RE: multi-dimensional chi-squared?
Date   Thu, 22 Jul 2010 11:41:18 +0100

The -ipf- command [not function] is a user-written command from the STB. Use -search ipf- to get download locations. 

Official commands -poisson- or -glm- will also do fine for the same purpose of loglinear modelling. You just need first to reduce your data to counts, for which -contract- may be convenient. 


Barth Riley

This is admittedly not my area of expertise, however, loglinear modeling is
a kind of "multidimensional" contingency table analysis. The ipf function in
Stata can perform one type of loglinear analysis and provides an estimate of
expected frequencies for multidimensional contingency tables. I am not sure
what the sample size requirements or other statistical assumptions are
involved with this type of analysis.

Chevalier, Judy

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.  

*   For searches and help try:

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