Description Usage Arguments Value References See Also Examples
These functions reweight a reference sample to match constraints given by aggregate controls.
ml_fit()
accepts an algorithm as argument and calls the
corresponding function. This is useful if the result of multiple algorithms
are compared to each other.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | ml_fit(
ml_problem,
algorithm = c("entropy_o", "dss", "ipu", "hipf"),
verbose = FALSE,
...,
tol = 1e-06
)
is_ml_fit(x)
## S3 method for class 'ml_fit'
format(x, ...)
## S3 method for class 'ml_fit'
print(x, ...)
ml_fit_dss(
ml_problem,
method = c("raking", "linear", "logit"),
ginv = gginv(),
tol = 1e-06,
verbose = FALSE
)
ml_fit_entropy_o(
ml_problem,
verbose = FALSE,
tol = 1e-06,
dfsane_args = list()
)
ml_fit_hipf(
ml_problem,
diff_tol = 16 * .Machine$double.eps,
tol = 1e-06,
maxiter = 2000,
verbose = FALSE
)
ml_fit_ipu(
ml_problem,
diff_tol = 16 * .Machine$double.eps,
tol = 1e-06,
maxiter = 2000,
verbose = FALSE
)
|
ml_problem |
A fitting problem created by
|
algorithm |
Algorithm to use |
verbose |
If |
... |
Further parameters passed to the algorithm |
tol |
Tolerance, the algorithm has succeeded when all target values are reached within this tolerance. |
x |
An object |
method |
Calibration method, one of |
ginv |
Function that computes the Moore-Penrose pseudoinverse. |
dfsane_args |
Additional arguments (as a named list) passed to the
|
diff_tol |
Tolerance, the algorithm stops when relative difference of control values between iterations drops below this value |
maxiter |
Maximum number of iterations. |
All functions return an object of class ml_fit
, which is
a named list under the hood. The class matches the function called,
e.g., the return value of the ml_fit_ipu
function also is of class
ml_fit_ipu
.
All returned objects contain at least the following components, which can be
accessed with $
or [[
:
weights
: Resulting weights, compatible to the original reference sample
tol
: The input tolerance
iterations
: The actual number of iterations required to obtain the result
flat
: The flattened fitting problem, see flatten_ml_fit_problem()
flat_weights
: Weights in terms of the flattened fitting problem
residuals
: Absolute residuals
rel_residuals
: Relative residuals
success
: Are the residuals within the tolerance?
is_ml_fit()
returns a logical.
Deville, J.-C. and Särndal, C.-E. (1992) Calibration estimators in survey sampling. Journal of the American Statistical Association, 87 (418), 376–382.
Deville, J.-C., Särndal, C.-E. and Sautory, O. (1993) Generalized raking procedures in survey sampling. Journal of the American Statistical Association, 88 (423), 1013–1020.
Bar-Gera, H., Konduri, K. C., Sana, B., Ye, X., & Pendyala, R. M. (2009, January). Estimating survey weights with multiple constraints using entropy optimization methods. In 88th Annual Meeting of the Transportation Research Board, Washington, DC.
Müller, K. and Axhausen, K. W. (2011), Hierarchical IPF: Generating a synthetic population for Switzerland, paper presented at the 51st Congress of the European Regional Science Association, University of Barcelona, Barcelona.
Ye, X., K. Konduri, R. M. Pendyala, B. Sana and P. A. Waddell (2009) A methodology to match distributions of both household and person attributes in the generation of synthetic populations, paper presented at the 88th Annual Meeting of the Transportation Research Board, Washington, D.C., January 2009.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | path <- toy_example("Tiny")
fit <- ml_fit(ml_problem = readRDS(path), algorithm = "entropy_o")
fit
fit$weights
fit$tol
fit$iterations
fit$flat
fit$flat_weights
fit$residuals
fit$rel_residuals
fit$success
ml_fit_dss(ml_problem = readRDS(path))
ml_fit_dss(ml_problem = readRDS(path), ginv = solve)
ml_fit_entropy_o(ml_problem = readRDS(path))
ml_fit_hipf(ml_problem = readRDS(path))
ml_fit_ipu(ml_problem = readRDS(path))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.