seq_pa_ch_monitor {bnmonitor}R Documentation

Sequential parent-child node monitors

Description

Sequential node monitor for a vertex of a Bayesian network for a specific configuration of its parents

Usage

seq_pa_ch_monitor(dag, df, node.name, pa.names, pa.val, alpha = "default")

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

pa.names

vector including the names of the parents of node.name

pa.val

vector including the levels of pa.names considered

alpha

single integer. By default, the number of max levels in df

Details

Consider a Bayesian network over variables Y_1,\dots,Y_m and suppose a dataset (\boldsymbol{y}_1,\dots,\boldsymbol{y}_n) has been observed, where \boldsymbol{y}_i=(y_{i1},\dots,y_{im}) and y_{ij} is the i-th observation of the j-th variable. Consider a configuration \pi_j of the parents and consider the sub-vector \boldsymbol{y}'=(\boldsymbol{y}_1',\dots,\boldsymbol{y}_{N'}') of (\boldsymbol{y}_1,\dots,\boldsymbol{y}_n) including observations where the parents of Y_j take value \pi_j only. Let p_i(\cdot|\pi_j) be the conditional distribution of Y_j given that its parents take value \pi_j after the first i-1 observations have been processed. Define

E_i = \sum_{k=1}^Kp_i(d_k|\pi_j)\log(p_i(d_k|\pi_j)),

V_i = \sum_{k=1}^K p_i(d_k|\pi_j)\log^2(p_i(d_k|\pi_j))-E_i^2,

where (d_1,\dots,d_K) are the possible values of Y_j. The sequential parent-child node monitor for the vertex Y_j and parent configuration \pi_j is defined as

Z_{ij}=\frac{-\sum_{k=1}^i\log(p_k(y_{kj}'|\pi_j))-\sum_{k=1}^i E_k}{\sqrt{\sum_{k=1}^iV_k}}.

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

Value

A vector including the scores Z_{ij}.

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_pa_ch_monitor(chds_bn, chds, "Events", "Social", "High", 3)


[Package bnmonitor version 0.2.0 Index]