
Last chance! 50% off unlimited learning
Sale ends in
Plots kernel density estimates of the target variable, conditional on
each of a set of specified values of the extension variable. The plot
makes use of the function ggridges::geom_density_ridges()
, and so
uses kernel density estimates rather than the exact conditional density
function.
plotConditionalDensities(
y,
fitX,
yCP,
xMed,
medianY,
link = "identity",
dist = "best",
N = 1e+05,
xLimits = NULL,
fs = 12
)
vector of values for the extension variable at which to condition on.
an object of class elicitation
specifying the
c-distribution: the distribution of the target variable, conditional on the
extension variable taking its median value.
vector of conditioning points for the extension variable.
vector of medians of the target variable, corresponding to
each value of the extension variable in yCP
.
the median value of the extension variable.
link in the median function. One of "identity"
,
"log"
or "logit"
choice of parametric distribution for the c-distribution. Options are
"normal"
, "t"
, "gamma"
, "lognormal"
,
"logt"
,"beta"
, "hist"
(for a histogram fit), and
"best"
(for best fitting).
sample size used in the kernel density estimate
x-axis limits
font size
if (FALSE) {
myfitX <- fitdist(vals = c(5.5, 9, 14),
probs = c(0.25, 0.5, 0.75),
lower = 0)
plotConditionalDensities(y = c(2, 6, 10),
fitX = myfitX,
yCP = c(3, 5, 7, 9.5, 13.5),
xMed = c(2, 6.5, 9, 13, 20),
medianY = 7,
link = "log",
dist = "lognormal",
xLimits = c(0, 60))
# Example with the logit link
myfitXlogit <- fitdist(vals = c(0.2, 0.25, 0.3),
probs = c(0.25, 0.5, 0.75),
lower = 0,
upper = 1)
plotConditionalDensities(y = c(2, 6, 10),
fitX = myfitXlogit,
yCP = c(2, 4, 6, 8, 10),
xMed = c(0.1, 0.3, 0.5, 0.7, 0.9),
medianY = 6,
link = "logit",
dist = "beta")
}
Run the code above in your browser using DataLab