parray
objects).parray(varNames, levels, values = 1, normalize = c("none", "first", "all"), smooth = 0)
as.parray(values, normalize=c("none","first","all"), smooth=0)
## S3 method for class 'parray':
varNames(x)
## S3 method for class 'parray':
nLevels(x)
## S3 method for class 'parray':
valueLabels(x)
parray
.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 positive then smooth
is added to
values
before normalization takes place.
as.parray
can be used for coercing a an array to a parray
object.t1 <- parray(c("gender","answer"),list(c('male','female'),c('yes','no')), values=1:4)
t1 <- parray(~gender:answer,list(c('male','female'),c('yes','no')), values=1:4)
t1 <- parray(~gender:answer,c(2,2), values=1:4)
t2 <- parray(c("answer","category"), list(c('yes','no'),c(1,2)), values=1:4+10)
t3 <- parray(c("category","foo"), c(2,2), values=1:4+100)
varNames(t1)
nLevels(t1)
valueLabels(t1)
Run the code above in your browser using DataLab