final_node_monitor {bnmonitor}R Documentation

Final node monitors

Description

Marginal and conditional node monitors over the last observation of the data for all vertices of a Bayesian network using the full dataset

Usage

final_node_monitor(dag, df)

Arguments

dag

an object of class bn from the bnlearn package

df

a base R style dataframe

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 pnp_n denote the marginal density of YjY_j after the first n1n-1 observations have been processed. Define

En=k=1Kpn(dk)log(pn(dk)),E_n = \sum_{k=1}^Kp_n(d_k)\log(p_n(d_k)),

Vn=k=1Kpn(dk)log2(pn(dk))En2,V_n = \sum_{k=1}^K p_n(d_k)\log^2(p_n(d_k))-E_n^2,

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

Zj=log(pn(yij))EnVn.Z_j=\frac{-\log(p_n(y_{ij}))- E_n}{\sqrt{V_n}}.

Higher values of ZjZ_j can give an indication of a poor model fit for the vertex YjY_j.

The conditional node monitor for the vertex YjY_j is defined as

Zj=log(pn(ynjyn1,,yn(j1),yn(j+1),,ynm))EnVn,Z_j=\frac{-\log(p_n(y_{nj}|y_{n1},\dots,y_{n(j-1)},y_{n(j+1)},\dots,y_{nm}))- E_n}{\sqrt{V_n}},

where EnE_n and VnV_n are computed with respect to pn(ynjyn1,,yn(j1),yn(j+1),,ynm)p_n(y_{nj}|y_{n1},\dots,y_{n(j-1)},y_{n(j+1)},\dots,y_{nm}). Again, higher values of ZjZ_j can give an indication of a poor model fit for the vertex YjY_j.

Value

A dataframe including the names of the vertices, the marginal node monitors and the conditional node monitors. It also return two plots where vertices with a darker color have a higher marginal z-score or conditional z-score, respectively, in absolute value.

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

final_node_monitor(chds_bn, chds[1:100,])

[Package bnmonitor version 0.2.0 Index]