data_prob2 | R Documentation |
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:
marginals
a list of the row and column marginal distributions
byrow
a matrix with conditional probabilities by row
bycol
a matrix with conditional probabilities by column
expected
a matrix with the expected probabilities under independence
prob
a vector of all the probabilities computed (except the expected ones)
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, ...)
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 |
A matrix and some attributes.
x <- data_prob2()
str(x)
data_prob2(colnames="E")
data_prob2(nrow=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.