bn.fit.dag: Bayesian Network Analysis

Description Usage Arguments Value Examples

View source: R/bayesian.R

Description

This function is an Interface to the fitting function for Bayesian Networks from bnlearn

Usage

1
bn.fit.dag(data, dag, method = "bayes")

Arguments

data

R data frame to fit the Bayesian network

dag

DAG generated by

method

Method used to analyze. Default is 'bayes'. Alternative is 'mle'

Value

bn.fit object

Examples

 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")

thogaertner/cinof1 documentation built on Jan. 8, 2022, 10:37 a.m.