IPF Call
performs an iterative proportional fit
- CALL IPF( fit, status, dim, table, config<,
initab><, mod>);
The inputs to the IPF subroutine are as follows:
- fit
- is a returned matrix.
The argument fit specifies an array of
the estimates of the expected number in each
cell under the model specified in config.
This matrix conforms to table.
- status
- is a returned matrix.
The status argument specifies a row vector of length 3.
If you specify STATUS={error, obs-maxdev, no-iterate},
then error is 0 if there is convergence to the
desired accuracy and is 3 if there is no convergence to
the desired accuracy; obs-maxdev is the maximum
difference between estimates of the last two iterations;
and no-iterate is the number of iterations performed.
- dim
- is an input matrix.
The dim argument is a vector specifying
the number of variables and the number of
their possible levels in a contingency table.
If dim is 1 ×v, then there are v
variables, and the value of the ith element
is the number of levels of the ith variable.
- table
- is an input matrix.
The table argument specifies an array of the
number of observations at each level of each variable.
Variables are nested across columns and then across rows.
- config
- an input matrix.
The config argument gives an array
specifying which marginal totals to fit.
Each column specifies a distinct marginal
in the model under consideration.
Because the model is hierarchical, all subsets
of specified marginals are included in fitting.
- initab
- is an input matrix.
The initab argument is an array of
initial values for the iterative procedure.
If you do not specify values, 1s are used.
For incomplete tables, initab is set to 1 if the
cell is included in the design, and 0 if it is not.
- mod
- is an input matrix.
The mod argument
is a two-element vector specifying the stopping criteria.
If mod= {maxdev, maxit}, then the
procedure iterates until either maxit iterations
are completed or the maximum difference between estimates
of the last two iterations is less than maxdev.
Default values are maxdev=0.25 and maxit=15.
The IPF subroutine performs an iterative proportional
fit of the marginal totals of a contingency table.
The arguments used with the IPF function
can be matrix names or literals.
The matrix table must conform in size to
the contingency table as specified in dim.
In particular, if table is n ×m, the
product of the entries in dim must equal nm.
Furthermore, there must be some integer k such that the
product of the first k entries in dim equals m.
If you specify initab, then it
must be the same size as table.
For example, consider the no-three-factor-effect
model for interpreting Bartlett's data as
described in Bishop, Fienberg, and Holland (1975):
dim={2 2 2};
table={156 84 84 156,
107 133 31 209};
config={1 1 2,
2 3 3};
call ipf(fit,status,dim,table,config);
The result is
FIT
161.062 78.938 78.907 161.093
101.905 138.095 36.119 203.881
STATUS
0 .166966 4
Equivalent results are obtained by the statement
table={156 84,
84 156,
107 133,
31 209};
or the statement
table={156 84 84 156 107 133 31 209};
In the first specification, TABLE is interpreted as
variable 2: 1 2
_________ _________
variable 3 variable 1: 1 2 1 2
_________________________________________________________________
1 156 84 84 156
2 107 133 31 209
In the second specification, TABLE is interpreted as
variable 3 variable 2 variable 1: 1 2
__________________________________________________________________
1 1 156 84
2 84 156
2 1 107 133
2 31 209
And in the third specification, TABLE is interpreted as
variable 3: 1 2
________________________ _________________________
variable 2: 1 2 1 2
__________ __________ ___________ ___________
variable 1: 1 2 1 2 1 2 1 2
_______________________________________________________
156 84 84 156 107 133 31 209 .
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.