Description Usage Arguments Value Usage Notes Examples
Create the QTL plot
1 2 3 4 5 | createQtlPlot(mcmcData, mcmcVar = Value, groupData,
groupResponse = ObservedResponse, groupSize = N, groupType = NULL,
basicTheme = ggplot2::theme_light, qtls = c(0.1, 0.2, 0.8, 0.9),
postScaleFactor = NULL, mcmcAlpha = 0.2, nDensity = 512,
xAxisRange = NULL)
|
mcmcData |
the tibble containing the posterior MCMC samples of the metric |
mcmcVar |
the column in |
groupData |
the tibble containing the observed group data |
groupResponse |
the column in |
groupSize |
the column in the |
groupType |
The column in |
basicTheme |
one of the themes provided by |
qtls |
a list containing the quantiles that define the QTL thresholds.
If |
postScaleFactor |
scales the posterior density relative to the height of
the |
mcmcAlpha |
the transparency of the fill used to indicate QTL bands |
nDensity |
the number of bins used to estimate the density. Must be a power of two. Normally, this can be left unchanged, but occasionally a different value is needed to correct visual artefacts related to the shading of the plot |
xAxisRange |
the range of the x-axis, as defined by a call to
|
the QTL plot
The plot returned by the function is deliberately crude: the x axis is unlabelled, the legends are unfomatted, and so on. However, it can be easily customised to include more appropriate titles, legends and so forth, as shown in the second example.
The scaled kernel estimate of the density is multiplied by
postScaleFactor
to obtain the curve shown in the plot. The height of
the scaled kernel density at its mode is 1. Therefore, by default,
postScaleFactor
is set to twice the largest group size.
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 | b <- createBerryData() %>%
tibble::add_column(Region=as.factor(c(1,1,1,2,2,2,3,3,3)))
m <- fitBinomialModel(b$Subjects, b$Events) %>% dplyr::filter(Index==10)
createQtlPlot(groupData=b,
groupResponse=ObservedResponse,
groupSize=Subjects,
groupType=Region,
mcmcData=m,
mcmcVar=Value) +
ggplot2::scale_fill_manual(name="QTL",
labels=c("Action low",
"Warn low",
"",
"Warn high",
"Action high"),
values=c("red",
"yellow",
"white",
"yellow",
"red")) +
ggplot2::scale_colour_manual(name="Region",
values=1:3,
labels=c("US",
"EMEA",
"Other")) +
ggplot2::labs(x="Observed response",
title="Example QTL plot")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.