Description Usage Arguments Value Note Author(s) See Also Examples
This method returns the maximum deviation between each generated and desired margins of the input argument. It corresponds to the absolute maximum deviation between each target margin used to generate the estimates in the mipfp object and the generated one.
1 2 | ## S3 method for class 'mipfp'
error.margins(object, ...)
|
object |
An object of class |
... |
Further arguments passed to or from other methods. See
|
An array containing the absolute maximum deviations for each margin.
It is an alias for CompareMaxDev
when
only one object is passed to the function and the verbose parameter is set to
FALSE
.
Johan Barthelemy
Maintainer: Johan Barthelemy johan@uow.edu.au.
The estimation function Estimate
.
This function relies on
CompareMaxDev
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # 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% sample of spnamur
seed.df <- spnamur.sub[sample(nrow(spnamur), round(0.10*nrow(spnamur))), ]
seed.table <- table(seed.df)
# applying a fitting method
r.ipfp <- Estimate(seed=seed.table, target.list=tgt.list.dims,
target.data = tgt.data, method = "ipfp")
# print the maximum absolute deviation between targets and generated margins
print(error.margins(r.ipfp))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.