Description Usage Arguments Value Examples
This function is an Interface to the fitting function for Bayesian Networks from bnlearn
1 | bn.fit.dag(data, dag, method = "bayes")
|
data |
R data frame to fit the Bayesian network |
dag |
DAG generated by |
method |
Method used to analyze. Default is 'bayes'. Alternative is 'mle' |
bn.fit object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # specify column names
id <- "patient_id"
time_col <- "day"
# Load data
load("data/simpatdag.rda")
load("data/simpatdat.rda")
# Dag preprocessing
bn.dag <- bn.prep.dag(simpatdag)
# Data Preprocessing (Factorization)
simpatdat$Uncertain_Low_Back_Pain <- as.factor(simpatdat$Uncertain_Low_Back_Pain)
simpatdat$Activity <- cut(simpatdat$Activity, 3, labels=c("low Activity", "middle Activity", "high Activity"))
bn.data <- bn.prep.data(bn.dag, simpatdat, id, time_col)
bn.fit.dag(bn.data, bn.dag, method="bayes")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.