compute.P: compute.P

Description Usage Arguments Details Examples

View source: R/compute.P.R

Description

This function takes a parameter vector and computes the corresponding distribution over all variables (including the latent variable).

Usage

1
compute.P(theta)

Arguments

theta

A list of length m+1, where m is the number of observed variables. The first m elements are kxr[i] matrices with the corresponding conditional probabilities. The last a element is a vector of the marginal distribution of the latent variable.

Details

If the parameters are given in form of a vector, theta.list(theta,r,n.class) converts them to the desired format.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
theta <- list()
length(theta) <- 5
theta[[1]] <- matrix(c(0.8,1-0.7,1-0.8,0.7),2,2)
theta[[2]] <- matrix(c(0.8,1-0.7,1-0.8,0.7),2,2)
theta[[3]] <- matrix(c(0.8,1-0.7,1-0.8,0.7),2,2)
theta[[4]] <- matrix(c(0.8,1-0.9,1-0.8,0.9),2,2)
theta[[5]] <- c(1-0.7,0.7)
P <- compute.P(theta)
# to get the induced observed distribution
mP <- Reduce("+",P)

pzwiernik/LatentClass documentation built on May 26, 2019, 11:35 a.m.