scoreagainstDAG {BiDAG} R Documentation

## Calculating the score of a sample against a DAG

### Description

This function calculates the score of a given sample against a DAG represented by its incidence matrix.

### Usage

```scoreagainstDAG(
scorepar,
incidence,
datatoscore = NULL,
marginalise = FALSE,
onlymain = FALSE
)
```

### Arguments

 `scorepar` an object of class `scoreparameters`; see constructor function `scoreparameters` `incidence` a square matrix of dimensions equal to the number of variables with entries in `{0,1}`, representing the adjacency matrix of the DAG against which the score is calculated `datatoscore` (optional) a matrix (vector) containing binary (for BDe score) or continuous (for the BGe score) observations (or just one observation) to be scored; the number of columns should be equal to the number of variables in the Bayesian network, the number of rows should be equal to the number of observations; by default all data from `scorepar` parameter is used `marginalise` (optional for continuous data) defines, whether to use the posterior mean for scoring (default) or to marginalise over the posterior distribution (more computationally costly) `onlymain` (optional), defines the the score is computed for nodes excluding 'bgnodes'; FALSE by default

### Value

the log of the BDe/BGe score of given observations against a DAG

### Author(s)

Jack Kuipers, Polina Suter

### References

Heckerman D and Geiger D, (1995). Learning Bayesian networks: A unification for discrete and Gaussian domains. In Eleventh Conference on Uncertainty in Artificial Intelligence, pages 274-284, 1995.

### Examples

``` Asiascore<-scoreparameters("bde", Asia[1:100,]) #we wish to score only first 100 observations
scoreagainstDAG(Asiascore, Asiamat)

```

[Package BiDAG version 2.0.4 Index]