| dens.prod.ordi {LCAextend} | R Documentation |
computes the probability of a given discrete measurement vector for all classes under a product of multinomial
Description
computes the probability of an individual's discrete measurement vector for all latent classes under a multinomial distribution product, eventually taking covariates into account. This is an internal function not meant to be called by the user.
Usage
dens.prod.ordi(y.x, param, var.list = NULL)
Arguments
y.x |
a vector |
param |
a list of the parameters alpha (cumulative logistic coefficients), see |
var.list |
a list of integers indicating which covariates (taken from |
Details
If there are K latent classes, d measurements and each measurement has S[j] possible values, alpha is a list of d
elements, each is a K times S[j]+length{var.list[[j]]} matrix. For a class C=k, dens[k]=\displaystyle\prod_{j=1}^d{P(Y_j=y_j|C=k,X_j=x_j)}, where P(Y_j=y_j|C=k,X_j=x_j) is
computed from the cumulative logistic coefficients alpha[[j]][k,] and
covariates x[var.list[[j]]],
Value
The function returns a vector dens of length K, where
dens[k] is the probability of measurement vector y with covariates x,
if the individual belongs to class k.
See Also
See Also init.ordi,
Examples
#data
data(ped.ordi)
status <- ped.ordi[,6]
y <- ped.ordi[status==2,7:ncol(ped.ordi)]
#param
data(param.ordi)
#the function applied for measurement of the first individual in the ped.ordi
dens.prod.ordi(y.x=y[1,],param.ordi)