Last data update: 2014.03.03

R: Bayesian Latent Class Analysis
BayesLCA-packageR Documentation

Bayesian Latent Class Analysis

Description

Bayesian latent class analysis using several different methods.

Details

Package: BayesLCA
Type: Package
Version: 1.4
Date: 2015-04-09
License: GPL (>= 2)
LazyLoad: yes

Author(s)

Arthur White and Brendan Murphy Maintainer: Arthur White <arthur.white@ucdconnect.ie>

References

Arthur White, Thomas Brendan Murphy (2014). BayesLCA: An R Package for Bayesian Latent Class Analysis." Journal of Statistical Software, 61(13), 1-28. URL: http://www.jstatsoft.org/v61/i13/.

Examples

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.4,0.6))
fit.em <- blca.em(x, 2)
plot(fit.em, which=1)
print(fit.em)
summary(fit.em)
data(Alzheimer)
fit.vb <- blca(Alzheimer, 2, method="vb")
par(mfrow=c(3,3))
plot(fit.vb, which=3:4)
summary(fit.vb)
par(mfrow=c(1,1))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BayesLCA)
Loading required package: e1071
Loading required package: coda
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BayesLCA/BayesLCA-package.Rd_%03d_medium.png", width=480, height=480)
> ### Name: BayesLCA-package
> ### Title: Bayesian Latent Class Analysis
> ### Aliases: BayesLCA-package BayesLCA
> ### Keywords: package
> 
> ### ** Examples
> 
> 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.4,0.6))
> fit.em <- blca.em(x, 2)
Restart number 1, logpost = -2451.6... 
New maximum found... Restart number 2, logpost = -2451.6... 
New maximum found... Restart number 3, logpost = -2451.6... 
New maximum found... Restart number 4, logpost = -2451.6... 
New maximum found... Restart number 5, logpost = -2451.6... 
> plot(fit.em, which=1)
> print(fit.em)

MAP Estimates:
 

Item Probabilities:
 
        Col 1 Col 2 Col 3 Col 4
Group 1 0.202 0.179 0.828 0.824
Group 2 0.761 0.771 0.182 0.258

Membership Probabilities:
 
Group 1 Group 2 
  0.598   0.402 
Warning message:
Posterior standard deviations not returned. 
> summary(fit.em)
__________________

Bayes-LCA
Diagnostic Summary
__________________

Hyper-Parameters: 

 Item Probabilities:

 alpha: 
        Col 1 Col 2 Col 3 Col 4
Group 1     1     1     1     1
Group 2     1     1     1     1

 beta: 
        Col 1 Col 2 Col 3 Col 4
Group 1     1     1     1     1
Group 2     1     1     1     1

 Class Probabilities:

 delta: 
Group 1 Group 2 
      1       1 
__________________

Method: EM algorithm  

 Number of iterations: 19 

 Log-Posterior Increase at Convergence: 0.0002305263 

 Log-Posterior: -2451.6 

 AIC: -4921.201 

 BIC: -4965.371 
> data(Alzheimer)
> fit.vb <- blca(Alzheimer, 2, method="vb")
Restart number 1, logpost = -1367.12... 
> par(mfrow=c(3,3))
> plot(fit.vb, which=3:4)
> summary(fit.vb)
__________________

Bayes-LCA
Diagnostic Summary
__________________

Hyper-Parameters: 

 Item Probabilities:

 alpha: 
        Hallucination Activity Aggression Agitation Diurnal Affective
Group 1             1        1          1         1       1         1
Group 2             1        1          1         1       1         1

 beta: 
        Hallucination Activity Aggression Agitation Diurnal Affective
Group 1             1        1          1         1       1         1
Group 2             1        1          1         1       1         1

 Class Probabilities:

 delta: 
Group 1 Group 2 
      1       1 
__________________

Method: Variational Bayes  

 Number of iterations: 65 

 Lower Bound Increase at Convergence: 0.0001695114 

 Lower Bound: -1367.115 
> par(mfrow=c(1,1))
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>