-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add option for generating guest function outputs for residualVsObserv… #176
Changes from 4 commits
7a7f627
c87e651
73b6e46
1496d1c
c8e1f12
ca90de8
ce61053
4c198cb
5d9de55
4f02083
88c2bb6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,10 +24,15 @@ plotDDIRatio <- function(data, | |
|
||
plotObject <- plotObject %||% initializePlot(plotConfiguration) | ||
|
||
lineOrientation <- "diagonal" | ||
if(dataMapping$residualsVsObserved){ | ||
lineOrientation <- "horizontal" | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a shortcut option for users in the function input as well: e.g.
I think such options are quite convenient for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, but with |
||
|
||
# Include horizontal lines | ||
for (lineIndex in seq_along(dataMapping$lines)) { | ||
# position correspond to the number of layer lines already added | ||
eval(parseAddLineLayer("diagonal", dataMapping$lines[[lineIndex]], lineIndex - 1)) | ||
eval(parseAddLineLayer(lineOrientation, dataMapping$lines[[lineIndex]], lineIndex - 1)) | ||
} | ||
if (isOfLength(lineIndex, 0)) { | ||
lineIndex <- 0 | ||
|
@@ -81,22 +86,27 @@ getGuestValuesFromDataMapping <- function(data, | |
xmax <- max(dataMapping$minRange, xData[xData > 0]) | ||
# By default, use 500 points to get enough discretization for the plot | ||
x <- 10^(seq(log10(xmin), log10(xmax), length.out = 5e2)) | ||
return(getGuestValues(x, delta = dataMapping$deltaGuest)) | ||
return(getGuestValues(x, delta = dataMapping$deltaGuest, residualsVsObserved = dataMapping$residualsVsObserved)) | ||
} | ||
|
||
#' @title getGuestValues | ||
#' @description Get a data.frame with Guest et al. ratio limits | ||
#' @param x input values of Guest function | ||
#' @param delta parameter of Guest function | ||
#' @param residualsVsObserved if true, returns a dataframe for a residuals (predicted/observed) vs observed DDI ratio plot | ||
#' @return A data.frame with x, ymin and ymax defining Guest et al. limits | ||
#' @export | ||
getGuestValues <- function(x, delta = 1) { | ||
getGuestValues <- function(x, delta = 1, residualsVsObserved = FALSE) { | ||
xSym <- x | ||
xSym[x < 1] <- 1 / x[x < 1] | ||
limit <- (delta + 2 * (xSym - 1)) / xSym | ||
ymin <- x / limit | ||
ymax <- x * limit | ||
|
||
guestLines <- data.frame(x, ymin, ymax) | ||
if(residualsVsObserved){ | ||
guestLines <- data.frame(x = x, ymin =1/limit, ymax = limit) | ||
return(guestLines) | ||
} | ||
guestLines <- data.frame(x = x, ymin = ymin, ymax = ymax) | ||
return(guestLines) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does default value in
DefaultDataMappingValues
include the log10 ?If so, line 27 may apply twice the log.
This means that either we need
lapply(lines, log10) %||% DefaultDataMappingValues$obsVsPred
withlines = NULL
in input or thatDefaultDataMappingValues
account for scale somehowThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we may want to apply the log10 directly within the
plotXX
functions after checking theplotConfiguration
scale is included inScaling$log
(obs vs pred and res vs pred might be in linear scale).Otherwise, users can get unwanted log transformation of their diagonal/horizontal lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible could you document the scaling in the
@param lines
and maybe in the pk-ratio vignetteThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverting changes to
obs-vs-pred-datamapping.R
andpkratio-datamapping.R
for now.