cnLoglik: Sample Log-likelihood

cnLoglik-methodR Documentation

Sample Log-likelihood

Description

Calculate the log-likelihood of a sample with respect to a given catNetwork object

Usage

cnLoglik(object, data, perturbations=NULL, bysample=FALSE)

Arguments

object

a catNetwork object

data

a data matrix given in the column-sample format, or a data.frame in the row-sample format

perturbations

a binary matrix with the dimensions of data. A value 1 designates the corresponding node in the sample as perturbed.

bysample

a logical

Details

If bysample is set to TRUE, the function output is a vector of log-likelihoods of the individual sample records. Otherwise, the total average of the log-likelihood of the sample is reported.

Value

A numeric value

Author(s)

N. Balov

See Also

cnNodeLoglik

Examples

  library(catnet)
  cnet <- cnRandomCatnet(numnodes=10, maxParents = 3, numCategories = 2)
  psamples <- cnSamples(object=cnet, numsamples=100)
  cnLoglik(object=cnet, data=psamples)

catnet documentation built on Nov. 10, 2022, 5:08 p.m.