plothpdi: Plot high posterior density intervals of vbpca objects.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/plothpdi.R

Description

Graphical visualization of the HPDI's of the weight matrix computed during the estimation of vbpca. Note that no intervals will be plotted if hpdi = FALSE is specified in the control argument.

Usage

1
plothpdi(obj, d = 1, vars = NULL)

Arguments

obj

list;
a vbpca object.

d

integer;
component number for which the intervals must be plotted.

vars

array_like;
an array containing the variable numbers (column numbers) for which the intervals must be plotted. If nothing is specified, the method will attempt to plot intervals for all the variables of the data matrix.

Value

the graphical visualization of the high posterior density intervals.

Author(s)

D. Vidotto <d.vidotto@uvt.nl>

See Also

vbpca

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Create a synthetic dataset 
I <- 1e+3 
X1 <- rnorm(I, 0, 50)
X2 <- rnorm(I, 0, 30)
X3 <- rnorm(I, 0, 10)

X <- cbind(X1, X1, X1, X2, X2, X2, X3, X3 )
X <- X + matrix(rnorm(length(X), 0, 1), ncol = ncol(X), nrow = I )
colnames(X) <- paste('X', 1:8, sep='')
# Estimate the Bayesian PCA model, with Inverse Gamma priors for tau
# and SVS with Beta priors for priorInclusion, and compute 90% HPD intervals
ctrl <- vbpca_control( alphatau = 1., betatau = 1e-02, beta1pi = 1., beta2pi = 1.,
                       hpdi = TRUE, probHPDI = 0.9, plot.lowerbound = FALSE  )
mod <- vbpca(X, D = 3, priorvar = 'invgamma', SVS = TRUE, control = ctrl )

# Plot the intervals of variables (1, 2, 3) of the second column of the W matrix: 
plothpdi(mod, d = 2, vars = 1:3)

davidevdt/bayespca documentation built on Dec. 5, 2020, 3:28 a.m.