seq_node_monitor {bnmonitor}R Documentation

Sequential node monitors

Description

Sequential marginal and conditional node monitors for a vertex of a Bayesian network.

Usage

seq_marg_monitor(dag, df, node.name)

seq_cond_monitor(dag, df, node.name)

Arguments

dag

an object of class bn from the bnlearn package

df

a base R style dataframe

node.name

node over which to compute the monitor

Details

Consider a Bayesian network over variables Y1,,YmY_1,\dots,Y_m and suppose a dataset (y1,,yn)(\boldsymbol{y}_1,\dots,\boldsymbol{y}_n) has been observed, where yi=(yi1,,yim)\boldsymbol{y}_i=(y_{i1},\dots,y_{im}) and yijy_{ij} is the i-th observation of the j-th variable. Let pip_i denote the marginal density of YjY_j after the first i1i-1 observations have been processed. Define

Ei=k=1Kpi(dk)log(pi(dk)),E_i = \sum_{k=1}^Kp_i(d_k)\log(p_i(d_k)),

Vi=k=1Kpi(dk)log2(pi(dk))Ei2,V_i = \sum_{k=1}^K p_i(d_k)\log^2(p_i(d_k))-E_i^2,

where (d1,,dK)(d_1,\dots,d_K) are the possible values of YjY_j. The sequential marginal node monitor for the vertex YjY_j is defined as

Zij=k=1ilog(pk(ykj))k=1iEkk=1iVk.Z_{ij}=\frac{-\sum_{k=1}^i\log(p_k(y_{kj}))-\sum_{k=1}^i E_k}{\sqrt{\sum_{k=1}^iV_k}}.

Values of ZijZ_{ij} such that Zij>1.96|Z_{ij}|> 1.96 can give an indication of a poor model fit for the vertex YjY_j after the first i-1 observations have been processed.

The sequential conditional node monitor for the vertex YjY_j is defined as

Zij=k=1ilog(pk(ykjyk1,,yk(j1),yk(j+1),,ykm))k=1iEkk=1iVk,Z_{ij}=\frac{-\sum_{k=1}^i\log(p_k(y_{kj}|y_{k1},\dots,y_{k(j-1)},y_{k(j+1)},\dots,y_{km}))-\sum_{k=1}^i E_k}{\sqrt{\sum_{k=1}^iV_k}},

where EkE_k and VkV_k are computed with respect to pk(ykjyk1,,yk(j1),yk(j+1),,ykm)p_k(y_{kj}|y_{k1},\dots,y_{k(j-1)},y_{k(j+1)},\dots,y_{km}). Again, values of ZijZ_{ij} such that Zij>1.96|Z_{ij}|> 1.96 can give an indication of a poor model fit for the vertex YjY_j.

Value

A vector including the scores ZijZ_{ij}, either marginal or conditional.

References

Cowell, R. G., Dawid, P., Lauritzen, S. L., & Spiegelhalter, D. J. (2006). Probabilistic networks and expert systems: Exact computational methods for Bayesian networks. Springer Science & Business Media.

Cowell, R. G., Verrall, R. J., & Yoon, Y. K. (2007). Modeling operational risk with Bayesian networks. Journal of Risk and Insurance, 74(4), 795-827.

See Also

influential_obs, node_monitor, seq_node_monitor, seq_pa_ch_monitor

Examples

seq_marg_monitor(chds_bn, chds[1:100,], "Events")
seq_marg_monitor(chds_bn, chds[1:100,], "Admission")


[Package bnmonitor version 0.2.0 Index]