Statalist


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

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


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: What form of data needed for ipf function?
Date   Fri, 15 Aug 2008 18:24:03 +0100

The -ipf- command (not function) is written by Adrian Mander, who I
think is only intermittently a member of this list. 

It was written up in STB-55. Have you read that account, accessible at 

<http://www.stata.com/products/stb/journals/stb55.pdf> 

I'd expect -ipf- to expect an observation on each person, coded
according to their category on each of several categorical variables,
but I've never tried it. 

If this doesn't help, I suggest you contact the program author directly.


Nick 
n.j.cox@durham.ac.uk 

lcrawley@stanford.edu

I apparently don't have my data in a form that allows stata v 10.1 to  
run the ipf function.

I have a dataset of 262 observations coded by 6 variables, all  
categorical and all, hypothetically, independent.

varlist is
genre
race
type
condition
fda_cat
page_size


  I ran a multiple correspondence analysis (using XLStat) to look at  
patterns with and without the binary variable (race).  It was  
recommended that I should also run log-linear models on the data.

What form does the data need to be in for stata to perform the ipf  
command?  I have tried several forms:
1. full spreadsheet data of 262 observations, each observation coded  
with string variables.  Six variables of interest, range from  
dichotomous choices, three choices, or five choices.  None are  
ordinal.  All categorical.
describe

Contains data
   obs:           262
  vars:             6
  size:        14,410 (99.9% of memory free)
------------------------------------------------------------------------
---------
               storage  display     value
variable name   type   format      label      variable label
------------------------------------------------------------------------
---------
genre           str3   %9s
race            byte   %8.0g
type            str7   %9s
condition       str28  %28s
fda_cat         str4   %9s
page_size       str4   %9s

2. multiway contingency (freq) table, where freq counts of 262  
observations were combined into like combinations showing 63 similar  
observations (rows).  The frequencies (cell counts) for each of the 63  
rows ranged from 1 to 35.

Contains data from C:\Documents and Settings\LaVera  
Crawley\Desktop\transformed
>  log linear data.dta
   obs:            63
  vars:             7                          14 Aug 2008 20:52
  size:         1,008 (99.9% of memory free)
------------------------------------------------------------------------
-------
               storage  display     value
variable name   type   format      label      variable label
------------------------------------------------------------------------
-------
genre           byte   %8.0g
race            byte   %8.0g
type            byte   %8.0g
condition       byte   %8.0g
fda_cat         byte   %8.0g
page_size       byte   %8.0g
freq            int    %8.0g
------------------------------------------

Neither form of the data worked. I still get the error r(109) type  
mismatch message as below (despite what linear equation I use - with  
or without interaction terms):
For example:
. ipf [fw=freq], fit( race+ genre+ type+ condition+ fda_cat+ page_size)
Deleting all matrices......

Expansion of the various marginal models
----------------------------------------
marginal model 1 varlist :  race
marginal model 2 varlist :  genre
marginal model 3 varlist :  type
marginal model 4 varlist :  condition
marginal model 5 varlist :  fda_cat
marginal model 6 varlist :  page_size
unique varlist  race genre type condition fda_cat page_size
invalid syntax
r(198);


*
*   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   |   What's new   |   Site index