plot_goodnessOfFit {CGNM} | R Documentation |

## plot_goodnessOfFit

### Description

Make goodness of fit plots to assess the model-fit and bias in residual distribution. The linear model is fit to the residual and plotted using geom_smooth(method=lm) in ggplot.

Explanation of the terminologies in terms of PBPK model fitting to the time-course drug concentration measurements:

"independent variable" is time

"dependent variable" is the concentration.

"Residual" is the difference between the measured concentration and the model simulation with the parameter fond by the CGNM.

"m" is number of observations

### Usage

```
plot_goodnessOfFit(
CGNM_result,
plotType = 1,
plotRank = c(1),
independentVariableVector = NA,
dependentVariableTypeVector = NA,
absResidual = FALSE
)
```

### Arguments

`CGNM_result` |
(required input) |

`plotType` |
(default: 1) |

`plotRank` |
(default: c(1)) |

`independentVariableVector` |
(default: NA) |

`dependentVariableTypeVector` |
(default: NA) |

`absResidual` |
(default: FALSE) |

### Value

*A ggplot object* of the goodness of fit plot.

### Examples

```
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=10^x[1]
V1=10^x[2]
CL_2=10^x[3]
t=observation_time
Cp=ka*F*Dose/(V1*(ka-CL_2/V1))*(exp(-CL_2/V1*t)-exp(-ka*t))
log10(Cp)
}
observation=log10(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,
initial_lowerRange = rep(0.01,3), initial_upperRange = rep(100,3),
lowerBound=rep(0,3), ParameterNames = c("Ka","V1","CL"),
num_iter = 10, num_minimizersToFind = 100, saveLog = FALSE)
plot_goodnessOfFit(CGNM_result)
plot_goodnessOfFit(CGNM_result,
independentVariableVector=c(0.1,0.2,0.4,0.6,1,2,3,6,12))
```

*CGNM*version 0.9.0 Index]