| ddiscrete2 | R Documentation |
Creates a bivariate discrete probability function based on the marginal probability fuctions
row and col. If unit is not given then unit will be the product of the units
used in row and col otherwise the least common multiple of unit product of
the units used in row and col.
If target is NA then the common distribution of two independent random variables
is returned otherwise an iterative algorithm is run to approach a target association or
correlation measure, see also assoc_data() called internally.
zero allows for zero entries in the common distribution.
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).
ddiscrete2(
row,
col,
unit = NULL,
zero = FALSE,
FUN = nom.cc,
target = NA,
tol = 0.001,
maxit = 500,
...
)
row |
numeric: marginal row distribution |
col |
numeric: marginal col distribution |
unit |
integer: reciprocal of smallest non-zero probability (default: |
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 discrete probability function
row <- ddiscrete(runif(5))
col <- ddiscrete(runif(3))
joint <- ddiscrete2(row, col)
joint
joint <- ddiscrete2(row, col, target=0.5)
joint
nom.cc(joint*attr(joint, "unit"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.