Learn R Programming

sdnet (version 2.4.1)

cnSearchHist: Parent Histogram Matrix

Description

Estimation of the parent matrix of nodes from data. The frequency of node edges is obtained by fitting networks consistent to randomly generated node orders.

Usage

cnSearchHist(data, pert=NULL, 
	maxParentSet=1, parentSizes=NULL, maxComplexity=0, 
	nodeCats=NULL, parentsPool=NULL, fixedParents=NULL, 
	score = "BIC", weight="loglik", 
	maxIter=32, numThreads=2, echo=FALSE)

Arguments

data

a matrix in row-nodes format or a data.frame in column-nodes format

pert

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

maxParentSet

an integer, the maximal number of parents per node

parentSizes

an integer vector, maximal number of parents per node

maxComplexity

an integer, the maximal network complexity for the search

nodeCats

a list of node categories

parentsPool

a list of parent sets to choose from

fixedParents

a list of parent sets to choose from

score

a character, network selection score such as "AIC" and "BIC"

weight

a character, specifies how the

maxIter

an integer, the number of single order searches to be performed

numThreads

an integer value, the number of parallel threads

echo

a boolean that sets on/off some functional progress and debug information

Value

A matrix

Details

The function performs niter calls of cnSearchOrder for randomly generated node orders (uniformly over the space of all possible node orders), selects networks according to score and sum their parent matrices weighted by weight. Three scoring criteria are currently supported: "BIC", "AIC" and maximum complexity for any other value of score. The weight can be 1) "likelihhod", then the parent matrices are multiplied by the network likelihood, 1) "score", then the parent matrices are multiplied by the exponential of the network score, 3) any other value of weight uses multiplier 1. In this case the entries in the output matrix count the presence of the corresponding parent-child pairs.

The function can runs numThreads number of parallel threads each processing different order. cnSearchHist function can be useful for empirical estimation of the relationships in some multivariate categorical data.

See Also

cnMatParents, cnSearchOrder

Examples

Run this code
# NOT RUN {
  library(sdnet)
  cnet <- cnRandomCatnet(numnodes=8, maxpars=3, numcats=2)
  psamples  <- cnSamples(object=cnet, numsamples=100)
  mhisto <- cnSearchHist(data=psamples, pert=NULL, 
		maxParentSet=2, maxComplexity=100)
  mhisto
# }

Run the code above in your browser using DataLab