Statalist


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

Re: st: IPF troubles


From   Andrew Criswell <[email protected]>
To   [email protected]
Subject   Re: st: IPF troubles
Date   Fri, 15 May 2009 22:39:49 +0700

Thank you for the help. I deleted my existing version and re-installed
using the command

ssc install ipf

I was able replicate your results.

On 5/15/09, Tirthankar Chakravarty <[email protected]> wrote:
> I will try to figure out why it doesn't work for you. My output is below:
>
> ************************* Output ***********************************
> . clear
>
> . input str6 gender str8 party wgt
>
>         gender      party        wgt
>   1. male democrat 55
>   2. male repub 65
>   3. female democrat 50
>   4. female repub 30
>   5. end
>
> . encode gender, gen(numgender)
>
> . encode party, gen(numparty)
>
> . ipf [fweight = wgt], fit(numgender + numparty)
> Deleting all matrices......
>
> Expansion of the various marginal models
> ----------------------------------------
> marginal model 1 varlist :  numgender
> marginal model 2 varlist :  numparty
> unique varlist  numgender numparty
>
> N.B.  structural/sampling zeroes may lead to an incorrect df
> Residual degrees of freedom = 1
> Number of parameters        = 3
> Number of cells             = 4
>
> Loglikelihood = 586.68180806674
> Loglikelihood = 586.68180806674
>
> Goodness of Fit Tests
> ---------------------
> df = 1
> Likelihood Ratio Statistic G² =   5.3875 p-value = 0.020
> Pearson Statistic          X² =   5.3467 p-value = 0.021
> ******************************************************************************
>
> By the by,  do:
>
> . which ipf
> c:\ado\plus\i\ipf.ado
> *! Date    : 1 Nov 2006
> *! Version : 1.38
> *! Author  : Adrian Mander
> *! Email   : [email protected]
> *! Iterative proportional fitting in contingency tables
>
>
>
>
> T
>
>
> 2009/5/15 Andrew Criswell <[email protected]>:
>> Hello T
>>
>> I copied and pasted your code but this is what I got...
>>
>> . clear
>>
>> . input str6 gender str8 party wgt
>>
>>        gender      party        wgt
>>  1. male democrat 55
>>  2. male repub 65
>>  3. female democrat 50
>>  4. female repub 30
>>  5. end
>>
>> . encode gender, gen(numgender)
>>
>> . encode party, gen(numparty)
>>
>> . ipf [fweight = wgt], fit(numgender + numparty)
>> Deleting all matrices......
>>
>> Expansion of the various marginal models
>> ----------------------------------------
>> marginal model 1 varlist :  numgender
>> marginal model 2 varlist :  numparty
>> invalid syntax
>> r(198);
>>
>>
>> On 5/15/09, Tirthankar Chakravarty <[email protected]>
>> wrote:
>>> It does work:
>>>
>>> /* begin */
>>> clear
>>> input str6 gender str8 party wgt
>>> male democrat 55
>>> male repub 65
>>> female democrat 50
>>> female repub 30
>>> end
>>> encode gender, gen(numgender)
>>> encode party, gen(numparty)
>>> ipf [fweight = wgt], fit(numgender + numparty)
>>> /* end */
>>>
>>> T
>>>
>>> On Fri, May 15, 2009 at 3:50 PM, Adrian Mander
>>> <[email protected]> wrote:
>>>> Hi Andrew,
>>>>
>>>> IPF requires that the gender and party variables need to be numeric.
>>>> I shall tighten up this code but in the mean time use numbers for gender
>>>> and
>>>> party and it should work
>>>>
>>>> cheers
>>>> Ade
>>>>
>>>> Andrew Criswell wrote:
>>>>>
>>>>> Hello All,
>>>>>
>>>>> This seems like a straight forward example. But I don't understand why
>>>>> it fails. I am using version 10.1
>>>>>
>>>>> input str6 gender str8 party wgt
>>>>> gender party wgt
>>>>> male democrat 55
>>>>> male repub 65
>>>>> female democrat 50
>>>>> female repub 30
>>>>> end
>>>>>
>>>>> . ipf [fweight = wgt], fit(gender + party)
>>>>> Deleting all matrices......
>>>>>
>>>>> Expansion of the various marginal models
>>>>> ----------------------------------------
>>>>> marginal model 1 varlist :  gender
>>>>> marginal model 2 varlist :  party
>>>>> type mismatch
>>>>> r(109);
>>>>>
>>>>> end of do-file
>>>>>
>>>>> r(109);
>>>>>
>>>>> .
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> Dr Adrian Mander
>>>> Leader of Cambridge Hub in Trials Methodology Research
>>>> MRC Biostatistics Unit    Institute of Public Health University Forvie
>>>> Site
>>>>    Cambridge CB2 0SR
>>>>
>>>> Tel: 01223 330370       Fax: 01223 330365
>>>>
>>>> *
>>>> *   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/
>>>>
>>>
>>>
>>>
>>> --
>>> To every ω-consistent recursive class κ of formulae there correspond
>>> recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
>>> belongs to Flg(κ) (where v is the free variable of r).
>>>
>>> *
>>> *   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/
>>>
>>
>>
>> --
>> Andrew Criswell, Ph.D.
>> Graduate School
>> Bangkok University
>>
>> *
>> *   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/
>>
>
>
>
> --
> To every ω-consistent recursive class κ of formulae there correspond
> recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
> belongs to Flg(κ) (where v is the free variable of r).
>
> *
> *   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/
>


-- 
Andrew Criswell, Ph.D.
Graduate School
Bangkok University

*
*   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