cptable {gRain} | R Documentation |
Creates conditional probability tables of the form p(v|pa(v)).
cptable(v,pa=NULL, levels=NULL, values = NULL, normalize = TRUE, smooth = 0) cptspec(x)
v |
A vertex |
pa |
The parents of vertex v |
values |
Probabilities; recycled if necessary |
normalize |
See 'details' below. |
smooth |
See 'details' below. |
levels |
See 'details' below. |
x |
A list of cpts |
If normalize=TRUE
then for each configuration of the parents
the probabilities are normalized to sum to one.
If smooth
is non–zero then zero entries of
values
are replaced with smooth
before normalization takes place.
If a gmData
object is given, then 'cpt' returns an object of
class 'ctab' (which is a general representation of a table).
If no gmData
object is given, then
'cpt' returns an object of class 'cptTemplate'.
'cptspec' returns an object of class 'cptspec' (which is just a list
with a special class attribute).
Søren Højsgaard, sorenh@agrsci.dk
yn <- c("yes","no") ynm <- c("yes","no","maybe") a <- cptable(~asia, values=c(1,99),levels=yn) t.a <- cptable(~tub+asia, values=c(5,95,1,99,1,999),levels=ynm) d.a <- cptable(~dia+asia, values=c(5,5,1,99,100,999),levels=ynm) cptspec(list(a,t.a,d.a))