prob_vector_cat.Rd
Extract the probability vector from a tensor of probability.
For example, if there are only 2 categorical variables (Y1, Y2)
with
nlevels(Y1)=2, nlevels(Y2)=3
, then the tensor is a matrix of
probability. tensor[i,j]
is the probability of Y1=i, Y2=j
. If
obs=(NA,2)
, then prob_vector_cat
returns the probability vector
of Y1
when Y2=2
and the onehot probability vector of
Y2=2
. If obs=(NA,NA)
, then prob_vector_cat
returns the
marginal probability vector of Y1
and that of Y2=2
.
prob_vector_cat(obs, tensor, dict_name_cat)
One observation of all categorical variables.
A tensor (multidimensional array) of probability, with
dimension nlevels(Y1) x nlevels(Y2) x...x nlevels(Yk)
if there are k
categorical columns.
A dictionary of categorical variable names and their
corresponding onehot name. For example, Y7: Y7_1, Y7_2,...
.
Probability vector for all categorical columns.