Description Usage Arguments Value Note Author(s) References See Also Examples
This function provides several estimating methods to up multiway table (referred as the seed) subject to known constrains/totals: Iterative proportional fitting procedure (ipfp), maximum likelihood method (ml), minimum chi-squared (chi2) and weighted least squares (lsq). Note that the targets can also be multi-dimensional.
1 2 |
seed |
The initial multi-dimensional array to be updated. Each cell must
be non-negative if |
target.list |
A list of dimensions of the marginal target constrains in
|
target.data |
A list containing the data of the target marginal tables. Each
component of the list is an array storing a margin.
The list order must follow the ordering defined in |
method |
An optional character string indicating which method is to be used to
update the |
keep.input |
A Boolean indicating if |
... |
Additionals argument that can be passed to the functions Ipfp and ObtainModelEstimates. See their respective documentation for more details. |
An object of class mipfp
is a list containing at least the
following components:
x.hat |
An array with the same dimension of |
p.hat |
An array with the same dimension of |
error.margins |
A list returning, for each margin, the absolute maximum deviation between the desired and generated margin. |
conv |
A boolean indicating whether the algorithm converged to a solution. |
evol.stp.crit |
The evolution of the stopping criterion over the iterations (if selected
|
solnp.res |
The estimation process uses the |
method |
The selected method for estimation. |
call |
The matched call. |
The will be also added if keep.input
has been set to TRUE
:
seed
, target.data
, target.list
.
It is important to note that if the margins given in target.list
are
not consistent (i.e. the sums of their cells are not equals), the input data
is then normalised by considering probabilities instead of frequencies:
the cells of the seed are divided by sum(seed)
;
the cells of each margin i
of the list target.data
are
divided by sum(target.data[[i]])
.
Johan Barthelemy.
Maintainer: Johan Barthelemy johan@uow.edu.au.
Bacharach, M. (1965). Estimating Nonnegative Matrices from Marginal Data. International Economic Review (Blackwell Publishing) 6 (3): 294-310.
Bishop, Y. M. M., Fienberg, S. E., Holland, P. W. (1975). Discrete Multivariate Analysis: Theory and Practice. MIT Press. ISBN 978-0-262-02113-5.
Deming, W. E., Stephan, F. F. (1940). On a Least Squares Adjustment of a Sampled Frequency Table When the Expected Marginal Totals are Known. Annals of Mathematical Statistics 11 (4): 427-444.
Fienberg, S. E. (1970). An Iterative Procedure for Estimation in Contingency Tables. Annals of Mathematical Statistics 41 (3): 907-917.
Little, R. J., Wu, M. M. (1991) Models for contingency tables with known margins when target and sampled populations differ. Journal of the American Statistical Association 86 (413): 87-95.
Lang, J.B. (2004) Multinomial-Poisson homogeneous models for contingency tables. Annals of Statistics 32(1): 340-383.
Stephan, F. F. (1942). Iterative method of adjusting frequency tables when expected margins are known. Annals of Mathematical Statistics 13 (2): 166-178.
See the functions Ipfp
and
ObtainModelEstimates
for more details about the estimation process.
summary.mipfp
for summaries,
vcov.mipfp
for the (asymptotic) covariance of
the estimates and gof.estimates.mipfp
for testing if the seed agrees with the targets.
The genereric functions print
and
coef
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # loading the data
data(spnamur, package = "mipfp")
# subsetting the data frame, keeping only the first 3 variables
spnamur.sub <- subset(spnamur, select = Household.type:Prof.status)
# true table
true.table <- table(spnamur.sub)
# extracting the margins
tgt.v1 <- apply(true.table, 1, sum)
tgt.v1.v2 <- apply(true.table, c(1,2), sum)
tgt.v2.v3 <- apply(true.table, c(2,3), sum)
tgt.list.dims <- list(1, c(1,2), c(2,3))
tgt.data <- list(tgt.v1, tgt.v1.v2, tgt.v2.v3)
# creating the seed, a 10 pct sample of spnamur
seed.df <- spnamur.sub[sample(nrow(spnamur), round(0.10*nrow(spnamur))), ]
seed.table <- table(seed.df)
# applying one fitting method (ipfp)
r.ipfp <- Estimate(seed=seed.table, target.list=tgt.list.dims,
target.data = tgt.data)
print(r.ipfp)
|
Loading required package: cmm
Loading required package: Rsolnp
Loading required package: numDeriv
Call:
Estimate(seed = seed.table, target.list = tgt.list.dims, target.data = tgt.data)
Method: ipfp - convergence: TRUE
Estimates:
Household.type.Gender.Prof.status Estimate
C.F.A 3747.2802
F.F.A 6530.1204
I.F.A 3108.6032
N.F.A 2287.9962
C.H.A 5224.7512
F.H.A 11053.9135
I.H.A 3377.4804
N.H.A 1889.8549
C.F.E 1075.4530
F.F.E 7831.2019
I.F.E 606.6285
N.F.E 2534.7165
C.H.E 763.8990
F.H.E 8316.6075
I.H.E 1080.6607
N.H.E 1905.8328
C.F.I 7022.2668
F.F.I 11784.6776
I.F.I 5015.7683
N.F.I 3452.2872
C.H.I 5828.3498
F.H.I 6919.4790
I.H.I 2393.8590
N.H.I 1496.3123
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.