Learn R Programming

DrBats (version 0.1.3)

visW: Plot the estimates for the latent factors

Description

Plot the estimates for the latent factors

Usage

visW(mcmc.output, Y, D, chain = 1, factors = c(1, 2))

Arguments

mcmc.output
an mcmc list as produced by clean.mcmc
Y
the matrix of data
D
the number of latent factors
chain
the chain to plot (default = 1)
factors
a vector indicating the factors to plot (default = c(1, 2))

Value

  • res.W a data frame containing the estimates for the factors, and their lower and upper bounds

    Inertia the percentage of total inertia captured by each of the factors

Examples

Run this code
require(DrBats)
data("toydata")
data("stanfit")
codafit <- coda.obj(stanfit)
Y <- toydata$Y.simul$Y
N = nrow(Y)
D = toydata$wlu$D
P = ncol(Y)
## PCA in the histogram basis
obs <- toydata$X
times <- toydata$t
pca.data <- pca.Deville(obs, times, t.range = c(min(times), max(times)), breaks = 15)
## Post-processing landmark information
rotation <- toydata$wlu$Q # rotation matrix
real.W <- toydata$wlu$W # PCA-determined latent factors
real.B <- t(pca.data$Cp[, 1:(toydata$wlu$D)]) # PCA-determined scores
mcmc.output <- clean.mcmc(N, P, D, codafit, rotation, real.W, real.B)
W.res <- visW(mcmc.output, Y, D, chain = 1, factors = c(1, 2))

Run the code above in your browser using DataLab