Skip to contents

Plots the chain across (non-discarded) iterations for a specified observation

Usage

Trace_plot(variable = NULL, chain = NULL)

Arguments

variable

Indicates the index of the variable

chain

MCMC chains generated by a BASSLINE MCMC function

Value

A ggplot2 object

Examples

library(BASSLINE)

# Please note: N=1000 is not enough to reach convergence.
# This is only an illustration. Run longer chains for more accurate
# estimations.

LN <- MCMC_LN(N = 1000, thin = 20, burn = 40, Time = cancer[, 1],
              Cens = cancer[, 2], X = cancer[, 3:11])
#> Sampling initial betas from a Normal(0, 1) distribution
#> Initial beta 1 : -0.45 
#>  Initial beta 2 : 1.03 
#>  Initial beta 3 : -0.36 
#>  Initial beta 4 : -0.48 
#>  Initial beta 5 : -0.64 
#>  Initial beta 6 : -1.15 
#>  Initial beta 7 : 2.2 
#>  Initial beta 8 : 1.31 
#>  Initial beta 9 : -1.92 
#> 
#> Sampling initial sigma^2 from a Gamma(2, 2) distribution
#> Initial sigma^2 : 0.24 
#> 
Trace_plot(1, LN)