Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: What form of data needed for ipf function?


From   Richard Williams <[email protected]>
To   [email protected], [email protected]
Subject   Re: st: What form of data needed for ipf function?
Date   Fri, 15 Aug 2008 14:38:32 -0500

At 01:01 PM 8/15/2008, [email protected] wrote:
Thanks for the correction (command, not function).  I had written
Adrian Mander and have not yet received a reply.  I have also read all
the suggested support info as well as other that I have found.  I
tried to put my data into the exact form of the example data that I
found on the suggested resources.  I still get the error message.
Just can't quite figure out what step I am missing.  Hopefully Dr.
Mander will come to my rescue! Thanks.
I don't use this stuff much but I think the glm command can give you the same info as ipf:

. use "http://www.nd.edu/~rwilliam/stats1/statafiles/categ-III.dta";, clear
(Categorical Case III - Tests of Association for N-Dimensional Tables)

. ipf [fw = freq], fit(gender + race + party)
Deleting all matrices......

Expansion of the various marginal models
----------------------------------------
marginal model 1 varlist : gender
marginal model 2 varlist : race
marginal model 3 varlist : party
unique varlist gender race party

N.B. structural/sampling zeroes may lead to an incorrect df
Residual degrees of freedom = 4
Number of parameters = 4
Number of cells = 8

Loglikelihood = 166.0760865136649
Loglikelihood = 166.0760865136649

Goodness of Fit Tests
---------------------
df = 4
Likelihood Ratio Statistic G� = 9.0042 p-value = 0.061
Pearson Statistic X� = 9.2798 p-value = 0.054
(Categorical Case III - Tests of Association for N-Dimensional Tables)

. glm freq gender party race, family(poisson) link(log)

Iteration 0: log likelihood = -21.182715
Iteration 1: log likelihood = -21.057385
Iteration 2: log likelihood = -21.057265
Iteration 3: log likelihood = -21.057265

Generalized linear models No. of obs = 8
Optimization : ML Residual df = 4
Scale parameter = 1
Deviance = 9.004151178 (1/df) Deviance = 2.251038
Pearson = 9.279843932 (1/df) Pearson = 2.319961

Variance function: V(u) = u [Poisson]
Link function : g(u) = ln(u) [Log]

AIC = 6.264316
Log likelihood = -21.05726505 BIC = .686385

------------------------------------------------------------------------------
| OIM
freq | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
gender | -.4054651 .2041241 -1.99 0.047 -.8055411 -.0053891
party | .2006707 .2010076 1.00 0.318 -.1932969 .5946383
race | -.9946226 .2252458 -4.42 0.000 -1.436096 -.5531489
_cons | 4.180543 .5201624 8.04 0.000 3.161044 5.200043
------------------------------------------------------------------------------

Note that ipf's G^2 and X^2 are the Deviance and Pearson stats in glm. If you want interaction terms, you have to compute them yourself.

Also, note the ipf warning that "structural/sampling zeroes may lead to an incorrect df." I wonder if that is causing you problems.


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME: (574)289-5227
EMAIL: [email protected]
WWW: http://www.nd.edu/~rwilliam


*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index