View source: R/sensitivity_plot.R
sensitivity_plot | R Documentation |
sensitivity_plot
will read a sensitivity-analysis Excel
file and create a graph of the dependent variable of your choice as long as
it was included in your results. If you ran a sensitivity analysis with
more than 1 independent variable – e.g., you wanted to see how adjusting
both the kp scalar and the fa affected Cmax – the best way we have come up
with so far to show you how both of those variables affect your dependent
variable is to break up the graphs into small multiples or facets (like on
a gemstone). (Side note: We considered a 3D graph, but they're honestly
hard to do well in a programmatic fashion like this.)
Coding notes: This function does not detect units, so please check your graph labels. We plan to add options for axis breaks as well as color schemes. We are in the process of adding more options for labeling the sensitivity parameter in the graphs. This funciton does not do 3D graphs and we have no plans to add option for 3D graphs because A) they're just not easy to interpret and B) there aren't great R packages out there for 3D graphs.
sensitivity_plot(
SA_file,
dependent_variable,
ind_var_label = NA,
target_DV = NA,
color_by_which_indvar = "1st",
linear_or_log = "linear",
y_axis_limits_lin = NA,
y_axis_limits_log = NA,
x_axis_limits_lin = NA,
x_axis_limits_log = NA,
time_range = NA,
rounding = "significant 3",
color_set = "blues",
graph_title = NA,
save_graph = NA,
fig_height = 4,
fig_width = 5,
return_data = FALSE
)
SA_file |
sensitivity analysis Excel file |
dependent_variable |
dependent variable to plot. Options are: "AUC", "AUC over dose", "AUC over dose with interaction", "AUC ratio", "CL", "CLpo", "CLpo with interaction", "Cmax", "Cmax with interaction", "Cmax ratio", "dose over AUC", "dose over AUC with interaction", "fa", "Fg", "Fg with interaction", "Fh", "Fh with interaction", "Vss", "tmax", "tmax with interaction", or "plasma concentration" (just "plasma" will also work). Other than "plasma concentration", which is always included in sensitivity analysis output, that parameter must be one of the ones you requested when you ran the sensitivity analysis. Not case sensitive. |
ind_var_label |
optionally specify what text use for labeling the independent variable (the x axis). If left as NA, R will find the value listed next to "Run Number" on the "ASA Summary" tab, which may be something not terribly pretty like "Fugut Value (Sub) (No Units)", and attempt to prettify it. If we haven't set things up to prettify that value, which is likely as we haven't used this function with very many sensitivity-analysis scenarios yet, the value will be unchanged. (If you have an independent variable you'd like to add to our list, please email Laura Shireman.) |
target_DV |
optionally specify a target value for the dependent variable, which will add a horizontal red dotted line to the graph where the target lies. |
color_by_which_indvar |
If you have more than one independent variable, you can specify which one you want to adjust the colors by. Options are "1", "1st", or "first" (all will work, default) to adjust the colors in the graph based on the first independent variable listed in the Excel SA file or "2", "2nd", or "second" to adjust colors based on the second. If you only have one independent variable, this will be ignored. |
linear_or_log |
make the y axis "linear" (default) or "log" for plasma concentration-time plots. If you're graphing some other dependent variable, you can also opt for "log x" to log-transform the x axis, "log y" to log-transform the y axis (same as a traditional semi-log plot), or "both log", which will log transform both the x and y axes. |
y_axis_limits_lin |
optionally set the Y axis limits for the linear
plot, e.g., |
y_axis_limits_log |
optionally set the Y axis limits for the semi-log
plot, e.g., |
x_axis_limits_lin |
optionally set the X axis limits for the linear
plot, e.g., |
x_axis_limits_log |
optionally set the X axis limits for the log plot,
e.g., |
time_range |
time range to show relative to the start of the simulation for any concentration-time plots. This does not apply when the plot is of some other dependent variable than plasma. Options:
|
rounding |
option for what rounding to perform, if any. Options are:
|
color_set |
the set of colors to use. Options:
|
graph_title |
(optional) a title to include on your graph in quotes |
save_graph |
optionally save the output graph by supplying a file name in quotes here, e.g., "My conc time graph.png" or "My conc time graph.docx". If you leave off ".png" or ".docx" from the file name, it will be saved as a png file, but if you specify a different graphical file extension, it will be saved as that file format. Acceptable graphical file extensions are "eps", "ps", "jpeg", "jpg", "tiff", "png", "bmp", or "svg". Do not include any slashes, dollar signs, or periods in the file name. Leaving this as NA means the file will not be saved to disk. |
fig_height |
figure height in inches; default is 4 |
fig_width |
figure width in inches; default is 5 |
return_data |
TRUE or FALSE (default) on whether to return the data used to make the graph |
a ggplot2 graph
sensitivity_plot(SA_file = "SA example.xlsx",
dependent_variable = "Cmax",
graph_title = "My pretty sensitivity-analysis graph that's not pink",
save_graph = "SA graph")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.