assoc_data | R Documentation |
Reorders the entries of a frequency table to approximate a given target association or correlation.
The reordering preserves the marginal frequencies of the table. Note that the target association may not always be achievable, especially for extreme values (e.g., +1, -1, or values near these limits).
assoc_data(
tab,
zero = FALSE,
FUN = nom.cc,
target = NA,
tol = 0.001,
maxit = 500,
...
)
reorder_association_data(
tab,
zero = FALSE,
FUN = nom.cc,
target = NA,
tol = 0.001,
maxit = 500,
...
)
dassoc(
tab,
zero = FALSE,
FUN = nom.cc,
target = NA,
tol = 0.001,
maxit = 500,
...
)
tab |
table A contingency table of absolute frequencies. |
zero |
logical Whether zeros are allowed in the resulting table (default: |
FUN |
function A function that computes the association or correlation from a frequency table (default: nom.cc). |
target |
numeric Desired association or correlation value (default: |
tol |
numeric Maximum allowed deviation between the achieved and target association (default: |
maxit |
integer Maximum number of iterations to reach the target (default: |
... |
Additional parameters passed to |
The function attempts to reorder the table entries to reach the target association. If the target is extreme
(e.g., +1, -1, or values near these limits), a solution may not be possible.
If attr(joint, "iterations")
equals maxit
, consider increasing maxit
,
reducing tol
, or choosing a more feasible target
value:
Nominal measures: 0 \le target \le 1
Ordinal measures: -1 \le target \le +1
A frequency table reordered to approximate the target association. The returned object includes attributes:
iterations
Number of iterations performed.
target
Achieved association or correlation value.
tab <- table_data(3, 2)
tab
tab2 <- assoc_data(tab, target = 0.5)
tab2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.