Calculate the log-likelihood of a sample with respect to a given catNetwork
object
cnLoglik(object, data, perturbations=NULL, bysample=FALSE)
A numeric value
a catNetwork
object
a data matrix
given in the column-sample format, or a data.frame
in the row-sample format
a binary matrix
with the dimensions of data
. A value 1
designates the corresponding node in the sample as perturbed.
a logical
N. Balov
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.
cnNodeLoglik
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