assoc_data {exams.forge}R Documentation

Frequency Optimization

Description

Given a frequency table, the function reorders the observations such that the given target association will be approximated and the marginal frequencies remain 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. Please note that a solution is not guaranteed, especially for extreme values of target, for example for +1, -1 or nearby values. If attr(joint, "iterations")== maxit then you need either to increase maxit, to decrease tol, or check if you have chosen 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.

Usage

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,
  ...
)

Arguments

tab

table: table of absolute frequencies

zero

logical: zeros are allowed in the final probabilities (default: FALSE)

FUN

function: association or correlation function (default: nom.cc)

target

numeric: target association or correlation (default: NA)

tol

numeric: tolerance for target association or correlation (default: 0.001)

maxit

integer: maximal number of iterations (default: 100)

...

further parameters

Value

a modified frequency table

Examples

tab <- table_data(3, 2)
tab
tab2 <- assoc_data(tab, target=0.5)
tab2

[Package exams.forge version 1.0.10 Index]