cnSetProb: Set Probability from Data

cnSetProb-methodR Documentation

Set Probability from Data

Description

The function sets the probability structure of a network from data according to the Maximum Likelihood criterion.

Usage

cnSetProb(object, data, perturbations=NULL, nodeCats=NULL)

Arguments

object

a catNetwork

data

a data matrix or data.frame

perturbations

a binary matrix with the dimensions of data

nodeCats

a list of node categories

Details

The function generates a new probability table for object and returns an updated catNetwork. The graph structure of the object is kept unchanged.

The data can be a matrix in the node-rows format, or a data.frame in the node-column format. If given, the nodeCats is used as a list of categories. In that case, nodeCats should include the node categories presented in the data.

Value

catNetwork

Author(s)

N. Balov

Examples

  library(catnet)
  cnet <- cnRandomCatnet(numnodes=10, maxParents=3, numCategories=3)
  psamples <- matrix(as.integer(1+rbinom(10*100, 2, 0.4)), nrow=10)
  rownames(psamples) <- cnet@nodes
  newcnet <- cnSetProb(object=cnet, data=psamples)

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