plotDesignPoint: Plot elicited data, fitted marginals or model output

Description Usage Arguments Value Examples

View source: R/plotting_functions.R

Description

Plot elicited data, fitted marginals or model output

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
plotDesignPoint(
  Z,
  X = NULL,
  design.pt = NULL,
  elicited.fractiles = TRUE,
  fitted.fractiles = FALSE,
  fitted.curve = FALSE,
  CI.prob = NULL,
  estimated.probs = NULL,
  modelled.fractiles = FALSE,
  modelled.curve = FALSE,
  cumul.prob.bounds = c(0.05, 0.95),
  theta.bounds = NULL,
  ylim.max = NULL,
  xlog = FALSE,
  design.table = TRUE,
  n.pts = 101
)

Arguments

Z

list object that contains matrix theta of elicitations, character link and character target as initialised by designLink and updated by elicitPt

X

design matrix (can be NULL, unless modelled output is requested)

design.pt

single integer that denotes design point of interest

elicited.fractiles

logical, plot vertical lines for elicited fractiles?

fitted.fractiles

logical, plot vertical lines for fitted conditional mean prior fractiles for this design point? Alternatively, a numeric vector of arbitrary fractiles to be plotted from the fitted elicitation distribution. If TRUE then the fractiles corresponding to the median, upper and lower level central CI are plotted

fitted.curve,

logical plot fitted conditional mean prior density for this design point?

CI.prob

numeric scalar, locally specified probability assigned to the elicited central credible interval of the current design point. Defaults to NULL in which case the global value initially assigned by designLink or as updated by elicitPt is used

estimated.probs

numeric vector of values for which estimated probabilities are to be estimated from the fitted elicitation distribution for the target theta. Default is NULL. The result is output to the console.

modelled.fractiles

logical, plot vertical lines for modelled fractiles from the conditional mean prior distribution fit to all design points? This option requires a design matrix X of full column rank.

modelled.curve

logical, plot modelled conditional mean prior density for the entire model? This option requires a design matrix X of full column rank.

cumul.prob.bounds

numeric vector of length two, giving plot bounds by cumulative probability. This argument is ignored if there is not enough data to fit a parametric distribution or if theta.bounds is not NULL

theta.bounds

numeric vector giving support of response for plotting purposes (can be NULL). This will overwrite cumul.prob.bounds, if applicable

ylim.max

numeric maximum value of y-axis (can be NULL)

xlog

logical log x-axis

design.table

logical include design dataframe, elicited fractiles and modelled or fitted fractiles

n.pts

numeric giving number of point to evalate density curve (if plotted)

Value

a plot to the current device. See dev.cur() to check.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# design matrix: two scenarios
X <- matrix(c(1, 1, 0, 1), nrow = 2) 
rownames(X) <- c("scenario1", "scenario2")
colnames(X) <- c("covariate1", "covariate2")

# logit link
# central credible intervals with probability = 1/2
Z <- designLink(design = X, link = "logit", CI.prob = 0.5)

# 1st design point
# no elicited fractiles
indirect::plotDesignPoint(Z, design.pt = 1) 
# elicited median
Z <- indirect::elicitPt(Z, design.pt = 1, 
  lower.CI.bound = NA,
  median = 0.4,
  upper.CI.bound = NA,
  CI.prob = NULL)
indirect::plotDesignPoint(Z, design.pt = 1,   
  elicited.fractiles = TRUE, theta.bounds = c(0, 1))
# lower and upper quartiles and median
Z <- indirect::elicitPt(Z, design.pt = 1, 
  lower.CI.bound = 0.2,
  median = 0.4,
  upper.CI.bound = 0.6,
  comment = "Completed.")
indirect::plotDesignPoint(Z, design.pt = 1,   
  elicited.fractiles = TRUE, theta.bounds = c(0, 1),
  fitted.fractiles = TRUE, fitted.curve = TRUE)
indirect::plotDesignPoint(Z, design.pt = 1,   
  elicited.fractiles = TRUE, theta.bounds = c(0, 1),
  fitted.fractiles = c(1/10, 1/4, 1/2, 3/4, 9/10), 
  fitted.curve = TRUE)   
  
# second design point   
# central credible intervals with probability = 1/3 
# elicit upper and lower tertiles
Z <- elicitPt(Z, design.pt = 2,
  lower.CI.bound = 0.1,
  upper.CI.bound = 0.3,
  CI.prob = 1/3,
  comment = "Switched to tertiles.")
indirect::plotDesignPoint(Z, design.pt = 2,   
  elicited.fractiles = TRUE, theta.bounds = c(0, 1))   
indirect::plotDesignPoint(Z, design.pt = 2,   
  elicited.fractiles = TRUE, theta.bounds = c(0, 1),
  fitted.fractiles = TRUE, fitted.curve = TRUE)
indirect::plotDesignPoint(Z, design.pt = 2,   
  elicited.fractiles = TRUE, theta.bounds = c(0, 1),
  fitted.fractiles = c(1/10, 1/3, 1/2, 2/3, 9/10), 
  fitted.curve = TRUE) 

indirect documentation built on Feb. 9, 2022, 9:07 a.m.