noisy_or {dagHMM} | R Documentation |
Calculating the probability of transition from multiple nodes to given node in the dag
Description
Calculating the probability of transition from multiple nodes to given node in the dag
Usage
noisy_or(hmm, prev_state, cur_state)
Arguments
hmm |
Object of class List given as output by |
prev_state |
vector containing state variable values for the previous nodes |
cur_state |
character denoting the state variable value for current node |
Value
The Noisy_OR probability for the transition
Examples
library(bnlearn)
tmat = matrix(c(0,0,1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0),
5,5, byrow= TRUE ) #for "X" (5 nodes) shaped dag
states = c("P","N") #"P" represent cases(or positive) and "N" represent controls(or negative)
bnet = model2network("[A][C|A:B][D|A:C][B|A]") #A is the target variable while
#B, C and D are covariates.
obsvA=data.frame(list(B=c("L","H","H","L","L"),C=c("H","H","L","L","H"),D=c("L","L","L","H","H")))
hmmA = initHMM(States=states, dagmat= tmat, net=bnet, observation=obsvA)
Transprob = noisy_or(hmm=hmmA,prev_state=c("P","N"),cur_state="P") #for transition from P & N
#simultaneously to P
[Package dagHMM version 0.1.1 Index]