plot.cond.b.joint: Plot posterior distribution of the random effects for a...

plot.cond.b.jointR Documentation

Plot posterior distribution of the random effects for a joint model.

Description

Plot posterior distribution of the random effects for a joint model.

Usage

## S3 method for class 'cond.b.joint'
plot(
  x,
  id = NULL,
  show.cov = TRUE,
  nrow = NULL,
  ncol = NULL,
  title = NULL,
  ...
)

Arguments

x

object of class cond.b.joint fit by cond.ranefs.

id

integer, if specified this shows the plots the posterior density for the chosen id (as they appeared in original joint model fit). By default this takes value NULL, which results in the posterior density for the entire data sample being plotted.

show.cov

logical, should the 'true' (normal) density be overlaid on these plots? If id is not specified, this overlays a normal density with variance taken from the joint fit's value for D. If id is specified, then this overlays a normal density with variance taken from that subject's \hat{\Sigma}_i, along with an open circle showing \hat{b}_i from the model fit.

nrow

integer specifying the number of rows to use in paneled plot.

ncol

integer specifying the number of columns to use in paneled plot. Note that both nrow and ncol must be specified, or neither.

title

optional character string to specify the title. This is placed at the top middle of the graphics device.

...

Additional arguments, these are passed to the plotting of the individual densities.

Examples


# Bivariate Gaussian 
dat <- simData(n = 100)$data
long.formulas <- list(Y.1 ~ time + cont + bin + (1 + time|id), 
                      Y.2 ~ time + cont + bin + (1 + time|id))
surv.formula <- Surv(survtime, status) ~ bin
fit <- joint(long.formulas, surv.formula, dat, list("gaussian","gaussian"))
cond.b <- cond.ranefs(fit, burnin = 500L, N = 4500L)
# Posterior for entire sample with dummy title
plot(cond.b, title = "Example title")
# Posterior for a randomly selected id
dummy.id <- sample(1:100, 1)
# Should show good agreement between true posterior and approximate normal.
plot(cond.b, id = dummy.id, title = paste0("id: ", dummy.id))


gmvjoint documentation built on Oct. 6, 2024, 1:07 a.m.