Learn R Programming

catnet (version 1.08.2)

cnLoglik-method: Sample Log-likelihood

Description

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

Usage

cnLoglik(object, data, 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
bysample
a logical

Value

  • A numeric value

Details

If bysample is set to TRUE, the function output is a vector of length the sample size with values the log-likelihood of each individual sample instance. Otherwise, the total sum of the log-likelihood of the sample instances is reported.

See Also

cnNodeLoglik

Examples

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

Run the code above in your browser using DataLab