ptable {gRbase}R Documentation

Representation of and operations on multidimensional tables

Description

General representation of multidimensional tables (by ptable objects).

Usage

ptable(varNames, nLevels, values = 1, normalize = c("none", "first", "all"), smooth = 0)
tableMarginPrim(t1, margin, normalize=FALSE)

## S3 method for class 'ptable':
varNames(x)
## S3 method for class 'ptable':
nLevels(x)
## S3 method for class 'ptable':
valueLabels(x)

Arguments

varNames Names of variables defining table
nLevels Levels of variables
values Table values
x Objects of class "ptable"
t1 Objects of class "ptable"
margin Set of nodes to marginalize onto
normalize Should result be normalized, see 'Details' below.
smooth Should values be smoothed, see 'Details' below.

Details

A ptable object represents a table defined by a set of variables and their levels, together with the values of the table. E.g. f(a,b,c) can be a table with a,b,c representing levels of binary variable

If normalize="first" then for each configuration of the parents, "pa", the probabilities are normalized to sum to one. Thus f(a,b,c) becomes a conditional probability table of the form p(a|b,c). If normalize="all" then the sum over all entries of f(a,b,c) is one.

If smooth is non–zero then zero entries of values are replaced with smooth before normalization takes place.

Value

An object of class ptable.

Author(s)

Søren Højsgaard, sorenh@agrsci.dk

Examples

t1 <- ptable(c("gender","answer"),list(c('male','female'),c('yes','no')), values=1:4)
t2 <- ptable(c("answer","category"), list(c('yes','no'),c(1,2)), values=1:4+10)
t3 <- ptable(c("category","foo"), c(2,2), values=1:4+100)

varNames(t1)
nLevels(t1)
valueLabels(t1)


[Package gRbase version 0.6.0 Index]