# visW: Plot the estimates for the latent factors In DrBats: Data Representation: Bayesian Approach That's Sparse

## Description

Plot the estimates for the latent factors

## Usage

 `1` ```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

## Author(s)

Gabrielle Weinrott

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```data("toydata") data("stanfit") codafit <- coda.obj(stanfit) ## convert to mcmc.list W.res <- visW(codafit, Y = toydata\$Y.simul\$Y, D = toydata\$wlu\$D, chain = 1, factors = c(1, 2)) ## plot the results data <- data.frame(time = rep(1:9, 2), W.res\$res.W) ggplot2::ggplot() + ggplot2::geom_step(data = data, ggplot2::aes(x = time, y = Estimation, colour = Factor)) + ggplot2::geom_step(data = data, ggplot2::aes(x = time, y = Lower.est, colour = Factor), linetype = "longdash") + ggplot2::geom_step(data = data, ggplot2::aes(x = time, y = Upper.est, colour = Factor), linetype = "longdash") ```

DrBats documentation built on May 29, 2017, 5:56 p.m.