probDiscreteVariable {MoTBFs} | R Documentation |
Probability distribution of discrete variables
Description
Compute the probabilities of a discrete variable from a dataset.
Usage
probDiscreteVariable(stateNames, Variable)
Arguments
stateNames |
A |
Variable |
A |
Value
A list of "numeric"
arrays:
coeff |
Contains the probabilities. |
sizeDataLeaf |
Number of records in each leaf of the discrete tree. |
See Also
Examples
## Discrete Variable
data <- data.frame(X=rep(c("yes", "no", "maybe"), 500))
data <- discreteVariables_as.character(data, "X")
n <- nrow(data)
## Probabilities
s <- discreteVariablesStates(namevariables="X", discreteData=data)
states <- s[[1]]$states
p <- probDiscreteVariable(stateNames=states, Variable=data$X)
p
[Package MoTBFs version 1.4.1 Index]