plot_simulationWithCI {CGNM}R Documentation

plot_simulationWithCI

Description

Plot model simulation where the various parameter combinations are provided and conduct simulations and then the confidence interval (or more like a confidence region) is plotted.

Usage

plot_simulationWithCI(
  simulationFunction,
  parameter_matrix,
  independentVariableVector = NA,
  dependentVariableTypeVector = NA,
  confidenceLevels = c(0.25, 0.75),
  observationVector = NA,
  observationIndpendentVariableVector = NA,
  observationDependentVariableTypeVector = NA
)

Arguments

simulationFunction

(required input) A function that maps the parameter vector to the simulation.

parameter_matrix

(required input) A matrix of numbers where each row contains the parameter combination that will be used for the simulations.

independentVariableVector

(default: NA) A vector of numbers that represents the independent variables of each points of the simulation (e.g., observation time) where used for the values of x-axis when plotting. If set at NA then sequence of 1,2,3,... will be used.

dependentVariableTypeVector

(default: NA) A vector of strings specify the kind of variable the simulationFunction simulate out. (i.e., if it simulate both PK and PD then indicate which simulation output is PK and which is PD).

confidenceLevels

(default: c(25,75)) A vector of two numbers between 0 and 1 set the confidence interval that will be used for the plot. Default is inter-quartile range.

observationVector

(default: NA) A vector of numbers used when wishing to overlay the plot of observations to the simulation.

observationIndpendentVariableVector

(default: NA) A vector of numbers used when wishing to overlay the plot of observations to the simulation.

observationDependentVariableTypeVector

(default: NA) A vector of numbers used when wishing to overlay the plot of observations to the simulation.

Value

A ggplot object including the violin plot, interquartile range and median, minimum and maximum.

Examples

## Not run: 
model_analytic_function=function(x){

 observation_time=c(0.1,0.2,0.4,0.6,1,2,3,6,12)
 Dose=1000
 F=1

 ka=x[1]
 V1=x[2]
 CL_2=x[3]
 t=observation_time

 Cp=ka*F*Dose/(V1*(ka-CL_2/V1))*(exp(-CL_2/V1*t)-exp(-ka*t))

 (Cp)
}

observation=(c(4.91, 8.65, 12.4, 18.7, 24.3, 24.5, 18.4, 4.66, 0.238))

CGNM_result=Cluster_Gauss_Newton_method(
nonlinearFunction=model_analytic_function,
targetVector = observation, num_iteration = 10, num_minimizersToFind = 100,
initial_lowerRange = c(0.1,0.1,0.1), initial_upperRange =  c(10,10,10),
lowerBound=rep(0,3), ParameterNames=c("Ka","V1","CL_2"), saveLog = FALSE)

CGNM_bootstrap=Cluster_Gauss_Newton_Bootstrap_method(CGNM_result,
     nonlinearFunction=model_analytic_function, num_bootstrapSample=100)

plot_simulationWithCI(model_analytic_function, as.matrix(CGNM_result$bootstrapTheta),
independentVariableVector=observation_time, observationVector=observation)

## End(Not run)

[Package CGNM version 0.9.0 Index]