MoTBFs (version 1.2)

generateNormalPriorData: Prior Data

Description

Generate a prior dataset taking in to account the relationships between varibles inside a given network.

Usage

generateNormalPriorData(graph, data, size, means, deviations = NULL)

Arguments

graph

A network of the class "bn", "graphNEL" or "network".

data

A datase of class "data.frame" containing the continuous variables of the dataset.

size

A "numeric" value indicating the number of records to generate for each variable in the dataset.

means

A "numeric" vector with the averiage of each variable. The names of the vector must be the name of the variables of which the information is given a priori by the expert.

deviations

A "numeric" vector with the desviations of each variable. The names of the vector must be the name of the variables of which the information is given a priori by the expert. By default it is NULL and the desviations of the given data are taken.

Value

A normal prior data set of class "data.frame".

See Also

rnormMultiv

Examples

Run this code
# NOT RUN {
## Data
data(ecoli)
data <- ecoli[,-c(1,9)] ## remove sequece.name and class
X <- TrainingandTestData(data, percentage_test = 0.95)
Xtraining <- X$Training
Xtest <- X$Test

## DAG
dag <- LearningHC(data)
plot(dag)

## Means and desviations
colnames(data)

m <- sapply(data, mean)
m <- m[-which(is.na(m))]
names(m)

d <- sapply(data, sd)
d <- d[-which(is.na(m))]
names(d)

## Prior Dataset
n <- 5600
priorData <- generateNormalPriorData(dag, data = Xtraining, size = n, means = m)
summary(priorData)
ncol(priorData)
nrow(priorData)
class(priorData)

# }

Run the code above in your browser using DataLab