| check_rdca | R Documentation |
rdca()
AllocationsDiagnostic tools to verify the objective function and constraint
satisfaction for allocations computed by the rdca() algorithm.
rdca_obj_cnstr(x, n, H_counts, N, S, rho2, J = integer(0))
rdca_cnstr_check(x, n, H_counts, N, S, rho2, J = integer(0), tol_max = 0.1)
rdca_optcond_sU(H_counts, S, rho, s, U, return_diff = FALSE)
x |
(numeric) |
n |
( |
H_counts |
( |
N |
( |
S |
( |
rho2 |
( |
J |
( |
tol_max |
( |
rho |
( |
s |
( |
U |
( For example, if If
|
return_diff |
(
is satisfied for each unblocked stratum
instead of a logical vector, which can be used to assess by how much the condition is satisfied or violated. |
rdca_obj_cnstr(): Compute the value of the objective function and constraint functions for a
given allocation.
rdca_cnstr_check(): Check whether the equality and inequality constraints are satisfied
for a given allocation, within a specified tolerance.
The tolerance applies to equality constraints only.
rdca_optcond_sU(): Check the optimality condition related to s.
Specifically, verifies whether
s(\mathcal{U},\, \boldsymbol{v},\, d \mid p) \ge \rho_d / S_{d,h}
for all (d,h) \in \mathcal{U} such that d is not fully blocked
by \mathcal{U}.
H_counts <- c(2, 2) # 2 domains with 2 strata each
N <- c(140, 110, 135, 190)
S <- sqrt(c(180, 20, 5, 4))
total <- c(2, 3)
kappa <- c(0.4, 0.6)
rho <- total * sqrt(kappa)
rho2 <- total^2 * kappa
n <- 500
(x <- dca(n, H_counts, N, S, rho, rho2))
# internal functions (not exported) – examples skipped
## Not run:
rdca_obj_cnstr(x, n, H_counts, N, S, rho2)
rdca_obj_cnstr(x, n, H_counts, N, S, rho2, 2)
rdca_obj_cnstr(x, n, H_counts, N, S, rho2, NULL)
## End(Not run)
## Not run:
rdca_cnstr_check(x, n, H_counts, N, S, rho2)
rdca_cnstr_check(x, n, H_counts, N, S, rho2, 1)
rdca_cnstr_check(x, n, H_counts, N, S, rho2, 2)
rdca_cnstr_check(x, n, H_counts, N, S, rho2, NULL)
## End(Not run)
## Not run:
(n <- dca_nmax(H_counts, N, S) - 1)
U <- 1
(x <- dca(n, H_counts, N, S, rho, rho2, U = U, details = TRUE))
rdca_optcond_sU(H_counts, S, rho, x$s, U) # TRUE
U <- 2
(x <- dca(n, H_counts, N, S, rho, rho2, U = U, details = TRUE))
rdca_optcond_sU(H_counts, S, rho, x$s, U) # FALSE
U <- 3
(x <- dca(n, H_counts, N, S, rho, rho2, U = U, details = TRUE))
rdca_optcond_sU(H_counts, S, rho, x$s, U) # TRUE
U <- 1:2 # domain 2 blocked
(x <- dca(n, H_counts, N, S, rho, rho2, U = U, details = TRUE))
rdca_optcond_sU(H_counts, S, rho, x$s, U) # no unblocked strata in `U`
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.