logPosteriorLGLFM {aibd}R Documentation

Log of the Posterior Density from the Linear Gaussian Latent Feature Model

Description

The log of the unnormalized posterior density of a feature allocation from the linear Gaussian latent feature model (LGLFM) is computed. The standard deviation of the error term (sdX) may be supplied or the associated precision (precisionX) can be provided instead. Likewise, only one of sdA and precisionA should be supplied.

Usage

logPosteriorLGLFM(
  featureAllocation,
  distribution,
  X,
  precisionX,
  precisionA,
  sdX,
  sdA,
  implementation = "scala"
)

Arguments

featureAllocation

An N-by-K binary feature allocation matrix.

distribution

A prior distribution of feature allocations, i.e., a result from ibp or aibd.

X

An N-by-D matrix of observed data.

precisionX

The scalar precision of the data error variance. This must be specified if sdX is missing.

precisionA

The scalar precision of a latent feature. This must be specified if sdA is missing.

sdX

The scalar standard deviation of the data error variance. This must be specified if precisionX is missing.

sdA

The scalar precision of a latent feature. This must be specified if precisionA is missing.

implementation

The default of "scala" should be used. The "R" option is not a supported implementation.

Value

A numeric vector giving the log of the unnormalized posterior density.

Examples

 # Regardless of size, the initial warmup can exceed CRAN's 5 seconds threshold
sigx <- 0.1
siga <- 1.0
dimA <- 1
nItems <- 8  # Should be a multiple of 4
Z <- matrix(c(1,0,1,1,0,1,0,0),byrow=TRUE,nrow=nItems,ncol=2)
A <- matrix(rnorm(ncol(Z)*dimA,sd=siga),nrow=ncol(Z),ncol=dimA)
e <- rnorm(nrow(Z)*ncol(A),0,sd=sigx)
X <- Z %*% A + e
logLikelihoodLGLFM(Z, X, sdX=sigx, sdA=siga)
logPosteriorLGLFM(Z, ibp(1,nItems), X, sdX=sigx, sdA=siga)



[Package aibd version 0.1.9 Index]