Learn R Programming

BayesLCA (version 1.9)

blca.em.sd: Posterior Standard Deviation Estimates for Bayesian Latent Class Analysis via an EM Algorithm

Description

Returns posterior standard deviation estimates for point estimates returned by blca.em. These are obtained via asymptotic estmation of the Observed Information matrix. The Hessian of the log-posterior is also checked to determine whether point estimates occur at at least a local maximum.

Usage

blca.em.sd(fit, x, counts.n = 1)

Arguments

fit

An object of class "blca.em".

x

A binary matrix. An object of class data.blca may also be supplied. In this case the argument counts.n is ignored.

counts.n

A vector which supplies the corresponding number of times each pattern in X occurs in the data.

Value

A list containing:

itemprob

Posterior standard deviation estimates of the item probabilities.

classprob

Posterior standard deviation estimates of the class probabilities.

convergence

An integer value denoting whether point estimates occur at at least a local maximum. 1 denotes acceptable convergence, 2 denotes that it converged at a saddle point, 3 that the algorithm ended before it converged and 4 denotes that at least one parameter value converged at a boundary value.

Details

This function is primarily intended for use in conjunction with blca.em, and may be called directly by that function by setting se=TRUE. However it can in fact be used with any blca object.

See Also

blca.em, blca.boot

Examples

Run this code
# NOT RUN {
type1 <- c(0.8, 0.8, 0.2, 0.2)
type2 <- c(0.2, 0.2, 0.8, 0.8)
x<- rlca(1000, rbind(type1,type2), c(0.6,0.4))
dat<- data.blca(x)

set.seed(1)
fit1 <- blca.em(dat, 2, se=TRUE)
fit1$itemprob.sd
fit1$classprob.sd

set.seed(1)
fit2<- blca.em(dat, 2, se=FALSE)
fit2.sd<- blca.em.sd(fit2, dat)
fit2.sd$itemprob
fit2.sd$classprob
# }

Run the code above in your browser using DataLab