| data_prob2 {exams.forge} | R Documentation |
Probability/Frequency Matrix Generation
Description
Generates a nrow × ncol matrix with probabilities / frequencies.
If data is given it will be normalized such that sum(data[is.finite(data)])==1.
If no rownames or colnames are given then event names from LETTERS are used.
The returned matrix will have the following attributes:
-
marginalsa list of the row and column marginal distributions -
byrowa matrix with conditional probabilities by row -
bycola matrix with conditional probabilities by column -
expecteda matrix with the expected probabilities under independence -
proba vector of all the probabilities computed (except the expected ones)
Usage
data_prob2(
data = NULL,
nrow = 2,
ncol = 2,
colnames = NULL,
rownames = NULL,
...
)
prob_mx(data = NULL, nrow = 2, ncol = 2, colnames = NULL, rownames = NULL, ...)
dprob2(data = NULL, nrow = 2, ncol = 2, colnames = NULL, rownames = NULL, ...)
Arguments
data |
an optional data vector. Non-atomic classed R objects are coerced
by |
nrow |
numeric: desired number of rows (default: |
ncol |
numeric: desired number of columns (default: |
colnames |
character: names of column events |
rownames |
character: names of row events |
... |
further parameters given to |
Value
A matrix and some attributes.
Examples
x <- data_prob2()
str(x)
data_prob2(colnames="E")
data_prob2(nrow=3)