MoTBFs (version 1.2)

probDiscreteVariable: Probabilities Discrete Variables

Description

Computes the probabilities of discrete variables.

Usage

probDiscreteVariable(stateNames, Variable)

Arguments

stateNames

A "character" array indicating the states of the variable.

Variable

A "numeric" array containing the records of the variable.

Value

A list of "numeric" arrays:

coeff

Contains the probabilities.

sizeDataLeaf

Number of records in each leaf of the discrete tree.

See Also

discreteVariablesStates

Examples

Run this code
# NOT RUN {
## 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

# }

Run the code above in your browser using DataCamp Workspace