Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

Author(s)

Gabrielle Weinrott

Examples

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

Data Representation: Bayesian Approach That's Sparse

v0.1.5
GPL-3
Authors
Anne Bisson [cre], Gabrielle Weinrott [aut], Brigitte Charnomordic [aut], Benedicte Fontez [aut], Nadine Hilgert [aut], Susan Holmes [aut]
Initial release
2019-11-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.