Calculates the expections and second moments for a pairwise binary Markov network using the junction tree algorithm.

1 |

`thetaMat` |
Theta matrix of the model (assumed to be symmetric). |

`adjMat` |
Adjacency matrix of the underlying graph. If not given, inferred from |

`var` |
if given, the expectation and second moments of variable var only will be calculated. Otherwise, for all variables. |

`onlyActive` |
If |

`timeout` |
Number of seconds until the functions terminates automatically. |

Uses the junction tree algorithm to calculate the matrix of second moments of the underlying pairwise binary Markov model. This is useful for inference on this type of models as the matrix of second moments is the derivative of the partition function in this class of models. The function provides the option to calculate the second moments only for one variable with all the others (variables are numbered from 1 to p; see `var`

). Also, the juntion tree algorithm is by a factor p more efficient if only second moments corresponding to edges in the underlying graph (non-zero values in the `thetaMat`

or `adjMat`

) are being calculated. This can be done using the switch `onlyActive`

.

The return value is a list with elements:

`Expectation` |
Expectation of the variables. |

`SecondMomentMatrix` |
Second moments of the variables (only present if |

`SecondMomentVector` |
Vector of second moments of variable |

Holger Hoefling

1 2 3 4 5 6 |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.