| assoc_data | R Documentation |
Given a frequency table the function reorders the observations such that the given target association will be approximated and the marginal
frequencies are unchanged. Note that the target association may not be reached!
zero allows for zero entries in the common distribution.
If target is NA then the table is simply returned. FUN computes the association (or correlation) measure based on a
frequency table. tol gives the maximal deviation of the association (or correlation) measure
and the target value. maxit limits the number of steps.
Note that a solution is not guaranteed, especially for extreme values for target, for example
for +1 or -1 or values nearby.
If attr(joint, "iterations")==maxit then you need either to increase maxit, to decrease tol or
to check if you have choosen an appropriate target value (for a nominal measure in 0 <= target <= 1, for ordinal measure in -1 <= target <= +1).
attr(joint, "target") contains the achieved association.
assoc_data(
tab,
zero = FALSE,
FUN = nom.cc,
target = NA,
tol = 0.001,
maxit = 500,
...
)
tab |
table: table of absolute frequencies |
zero |
logical: zeros in the final probabilities allowed (default: |
FUN |
function: association or correlation function (default: |
target |
numeric: target association or correlation (default: |
tol |
numeric: tolerance for target association or correlation (default: |
maxit |
integer: maximal number of iterations (default: |
... |
further parameter for |
a modified frequency table
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.