diff --git a/docs/404.html b/docs/404.html deleted file mode 100644 index c9fabb48..00000000 --- a/docs/404.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - -Page not found (404) • PopED - - - - - - - - - - - - - - - - - - -
-
- - - - -
-
- - -Content not found. Please use links in the navbar. - -
- - - -
- - - - -
- - - - - - - - diff --git a/docs/LICENSE.html b/docs/LICENSE.html deleted file mode 100644 index a5d41f3e..00000000 --- a/docs/LICENSE.html +++ /dev/null @@ -1,143 +0,0 @@ - -NA • PopED - - -
-
- - - -
-
- - - -

GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007

-

Copyright (C) 2007 Free Software Foundation, Inc. http://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

-

This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.

-
  1. Additional Definitions.
  2. -

As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.

-

“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.

-

An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.

-

A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.

-

The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.

-

The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.

-
  1. Exception to Section 3 of the GNU GPL.
  2. -

You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.

-
  1. Conveying Modified Versions.
  2. -

If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:

-
  1. under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or

  2. -
  3. under the GNU GPL, with none of the additional permissions of this License applicable to that copy.

  4. -
  1. Object Code Incorporating Material from Library Header Files.
  2. -

The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:

-
  1. Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.

  2. -
  3. Accompany the object code with a copy of the GNU GPL and this license document.

  4. -
  1. Combined Works.
  2. -

You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:

-
  1. Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.

  2. -
  3. Accompany the Combined Work with a copy of the GNU GPL and this license document.

  4. -
  5. For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.

  6. -
  7. -

    Do one of the following:

    -
    1. Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.

    2. -
    3. Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user’s computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.

    4. -
  8. -
  9. Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)

  10. -
  1. Combined Libraries.
  2. -

You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:

-
  1. Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.

  2. -
  3. Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.

  4. -
  1. Revised Versions of the GNU Lesser General Public License.
  2. -

The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

-

Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.

-

If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy’s public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.

- - -
- - - -
- - - -
- - - - - - - - diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index f093a435..00000000 --- a/docs/README.md +++ /dev/null @@ -1,62 +0,0 @@ -PopED: Population (and individual) Experimental Design in R -====== - -[![Travis-CI Build Status](https://travis-ci.org/andrewhooker/PopED.svg?branch=master)](https://travis-ci.org/andrewhooker/PopED) -[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/PopED)](https://CRAN.R-project.org/package=PopED) -[![codecov.io](https://codecov.io/github/andrewhooker/PopED/coverage.svg?branch=master)](https://codecov.io/github/andrewhooker/PopED?branch=master) - -PopED computes optimal experimental designs for both population -and individual studies based on nonlinear mixed-effect models. -Often this is based on a computation of the Fisher Information Matrix (FIM). - -## Installation - -You need to have R installed. Download the latest version of R from www.r-project.org. -Install PopED in R using one of the following methods: - -* latest stable release -- From CRAN. Write at the R command line: - -``` -install.packages("PopED") -``` - -* Latest development version -- from Github. Note that the command below installs the "master" -(development) branch; if you want the release branch from Github add `ref="release"` to the -`install_github()` call. The `install_github()` approach requires that you build from source, -i.e. `make` and compilers must be installed on your system -- see the R FAQ for your operating system; -you may also need to install dependencies manually. - -``` -devtools::install_github("andrewhooker/PopED") -``` - -## Getting started - -To get started you need to define - -1. A model. -2. An initial design (and design space if you want to optimize). -3. The tasks to perform. - -There are a number of functions to help you with these tasks. See `?poped` for more information. - -There are several other examples, as r-scripts, in the "examples" folder in the -PopED installation directory located at: - -``` -system.file("examples", package="PopED") -``` - -The same examples are located in the "inst/examples" directory of this repository. - -## Contact - -You are welcome to: - -* submit suggestions and bug-reports at: https://github.com/andrewhooker/PopED/issues -* send a pull request on: https://github.com/andrewhooker/PopED -* compose a friendly e-mail to: andrew.hooker@farmbio.uu.se - - - - diff --git a/docs/apple-touch-icon-120x120.png b/docs/apple-touch-icon-120x120.png deleted file mode 100644 index 4b6b5ba8..00000000 Binary files a/docs/apple-touch-icon-120x120.png and /dev/null differ diff --git a/docs/apple-touch-icon-152x152.png b/docs/apple-touch-icon-152x152.png deleted file mode 100644 index c97c342c..00000000 Binary files a/docs/apple-touch-icon-152x152.png and /dev/null differ diff --git a/docs/apple-touch-icon-180x180.png b/docs/apple-touch-icon-180x180.png deleted file mode 100644 index 132c98ef..00000000 Binary files a/docs/apple-touch-icon-180x180.png and /dev/null differ diff --git a/docs/apple-touch-icon-60x60.png b/docs/apple-touch-icon-60x60.png deleted file mode 100644 index f3d07d1f..00000000 Binary files a/docs/apple-touch-icon-60x60.png and /dev/null differ diff --git a/docs/apple-touch-icon-76x76.png b/docs/apple-touch-icon-76x76.png deleted file mode 100644 index f00250ac..00000000 Binary files a/docs/apple-touch-icon-76x76.png and /dev/null differ diff --git a/docs/apple-touch-icon.png b/docs/apple-touch-icon.png deleted file mode 100644 index 132c98ef..00000000 Binary files a/docs/apple-touch-icon.png and /dev/null differ diff --git a/docs/articles/PopED.html b/docs/articles/PopED.html deleted file mode 100644 index a58fde95..00000000 --- a/docs/articles/PopED.html +++ /dev/null @@ -1,476 +0,0 @@ - - - - - - - -Introduction to PopED • PopED - - - - - - - - - - - - - - - - - -
-
- - - - -
-
- - - - -

PopED computes optimal experimental designs for both population and individual studies based on nonlinear mixed-effect models. Often this is based on a computation of the Fisher Information Matrix (FIM).

-

To get started you need to define

-
    -
  • A model.
  • -
  • An initial design (and design space if you want to optimize)
  • -
  • The tasks to perform.
  • -
-

There are a number of functions to help you with these tasks. See ?poped for more information.

-

Below is an example to introduce the package. The code in the below example, and several other examples, are available as r-scripts in the “examples” folder in the PopED installation directory located at:

-
system.file("examples", package="PopED")
-

You can view a list of the example files using the commands:

-
ex_dir <- system.file("examples", package="PopED")
-list.files(ex_dir)
-

You can then open one of the examples (for example, ex.1.a.PK.1.comp.oral.md.intro.R, the code found in this vignette) using the following code

-
file_name <- "ex.1.a.PK.1.comp.oral.md.intro.R"
-ex_file <- system.file("examples",file_name,package="PopED")
-file.copy(ex_file,tempdir(),overwrite = T)
-file.edit(file.path(tempdir(),file_name))
-

In addition, there is another vignette called “Examples” that explores the new features in each example.

-
-

-Define a model

-

Here we define a one-compartment pharmacokinetic model with linear absorption using an analytical solution. In this case the solution is applicable for both multiple and single dosing. Note that this function is also predefined in PopED as ff.PK.1.comp.oral.md.CL.

- -
ff <- function(model_switch,xt,parameters,poped.db){
-  with(as.list(parameters),{
-    N = floor(xt/TAU)+1
-    y=(DOSE*Favail/V)*(KA/(KA - CL/V)) * 
-      (exp(-CL/V * (xt - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - exp(-CL/V * TAU)) - 
-         exp(-KA * (xt - (N - 1) * TAU)) * (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU)))  
-    return(list( y=y,poped.db=poped.db))
-  })
-}
-

Next we define the parameters of this function, in this case log-normal distributions around the parameters (except for Favail). DOSE and TAU are defined as covariates (in vector a) so that we can optimize their values later.

- -

Now we define the residual unexplained variability (RUV) function, in this case the RUV has both an additive and proportional component.

- -

We have now defined all aspects of the model.

-
-
-

-Define an initial design and design space

-

Now we define the model parameter values, the initial design and design space for optimization.

-

In this example, the parameter values are defined for the fixed effects (bpop), the between-subject variability variances (d) and the residual variability variances (sigma). We also fix the parameter Favail using notfixed_bpop, since we have only oral dosing and the parameter is not identifiable.

-

Fixing a parameter means that we assume the parameter will not be estimated (and is know without uncertainty). In addition, we fix the small additive RUV term, as this term is reflecting the higher error expected at low concentration measurements (limit of quantification measurements) and would typically be calculated from analytical assay methods (for example, the standard deviation of the parameter might be 20% of the limit of quantification).

-

For the initial design, we define two groups (m=2) of 20 individuals (groupsize=20), with doses of 20 mg or 40 mg every 24 hours (a). The initial design has 5 sample times per individual (xt).

-

For the design space, which can be searched during optimization, we define a potential dose range of between 0 and 200 mg (mina and maxa), and a range of potential sample times between 0 and 10 hours for the first three samples and between 240 and 248 hours for the last two samples (minxt and maxxt).

-

Finally, we fix the two groups of subjects to have the same sample times (bUseGrouped_xt=TRUE).

-
poped.db <- create.poped.database(ff_fun=ff,
-                                  fg_fun=sfg,
-                                  fError_fun=feps,
-                                  bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9), 
-                                  notfixed_bpop=c(1,1,1,0),
-                                  d=c(V=0.09,KA=0.09,CL=0.25^2), 
-                                  sigma=c(0.04,5e-6),
-                                  notfixed_sigma=c(1,0),
-                                  m=2,
-                                  groupsize=20,
-                                  a=list(c(DOSE=20,TAU=24),c(DOSE=40, TAU=24)),
-                                  maxa=c(DOSE=200,TAU=24),
-                                  mina=c(DOSE=0,TAU=24),
-                                  xt=c( 1,2,8,240,245),
-                                  minxt=c(0,0,0,240,240),
-                                  maxxt=c(10,10,10,248,248),
-                                  bUseGrouped_xt=TRUE)
-
-
-

-The tasks to perform.

-
-

-Simulation

-

First it may make sense to check your model and design to make sure you get what you expect when simulating data. Here we plot the model typical values:

-
plot_model_prediction(poped.db, model_num_points = 500)
-

-

Next, we plot the model typical values prediction intervals taking into account the between-subject variability (you can even investigate the effects of the residual, unexplained, variability with the DV=TRUE argument) but without sampling times:

-
plot_model_prediction(poped.db, model_num_points=500, IPRED=TRUE, sample.times = FALSE)
-

-

We can get these predictions numerically as well:

- -
-
-

-Design evaluation

-

Next, we evaluate the initial design

- -

We see that the fixed-effect and residual variability parameters are relatively well estimated with this design, but the between-subject variability parameters are less well estimated.

- -
-

-Comparison of designs

-

The precision on CL (bpop[3]) is similar with the alternative design but the other parameters are less well estimated with the alternative design.

-

It is possible to compare the objective function value (ofv) and see that for this dummy example the alternative design (less samples per subject) the ofv is smaller (=worse). This value can also be used to optimize sampling times, doses, and other design features.

-
-
-
-

-Design optimization

-

Now we can optimize the sample times of the design1.

-
output <- poped_optim(poped.db, opt_xt=TRUE)
- -

-

We see that there are four distinct sample times for this design. This means that for this model, with these exact parameter values, that the most information from the study to inform the parameter estimation is with these sample times.

-
-

-Examine efficiency of sampling windows

-

Of course, this means that there are multiple samples at some of these time points. We can explore a more practical design by looking at the loss of efficiency if we spread out sample times in a uniform distribution around these optimal points (\(\pm 30\) minutes).

-
plot_efficiency_of_windows(output$poped.db,xt_windows=0.5)
-

-

Here we see the efficiency (\((|FIM_{optimized}|/|FIM_{initial}|)^{1/npar}\)) drops below 80% in some cases, which is mostly caused by an increase in the D[2,2] parameter uncertainty (BSV on absorption). Smaller windows or different windowing on different samples might be needed. To investigate see ?plot_efficiency_of_windows.

-
-
-

-Optimize over a discrete design space

-

In the previous example we optimized over a continuous design space (sample times could be optimized to be any value between a lower and an upper limit). We could also limit the search to only “allowed” values, for example, only samples taken on the hour are allowed.

-
poped.db.discrete <- create.poped.database(poped.db,discrete_xt = list(c(0:10,240:248)))
-                                          
-output_discrete <- poped_optim(poped.db.discrete, opt_xt=TRUE)
- -

-

Here we see that the optimization ran somewhat quicker, but gave a less efficient design.

-
-
-

-Optimize ‘Other’ design variables

-

One could also optimize over dose, to see if a different dose could help in parameter estimation .

-
output_dose_opt <- poped_optim(output$poped.db, opt_xt=TRUE, opt_a=TRUE)
-

In this case the results are predictable … higher doses give observations with somewhat lower absolute residual variability leading to both groups at the highest allowed dose levels (200 mg in this case).

-
-
-

-Cost function to optimize dose

-

Optimizing the dose of a study just to have better model parameter estimates may be somewhat implausible. Instead, let’s use a cost function to optimize dose based on some sort of target concentration … perhaps typical population trough concentrations of 0.2 and 0.35 for the two groups of patients at 240 hours.

-

First we define the criteria we use to optimize the doses, here a least squares minimization.

-
crit_fcn <- function(poped.db,...){
-  pred_df <- model_prediction(poped.db)
-  sum((pred_df[pred_df["Time"]==240,"PRED"] - c(0.2,0.35))^2)
-}
-crit_fcn(output$poped.db)
-#> [1] 0.01469712
-

Now we minimize the cost function

-
output_cost <- poped_optim(poped.db, opt_a = TRUE, opt_xt = FALSE,
-                     ofv_fun=crit_fcn, 
-                     maximize = FALSE)
- -

-
-
-
-
-
-
    -
  1. Tip: to make the optimization run faster use the option parallel = TRUE in the poped_optim command.

  2. -
-
-
- - - -
- - - - -
- - - - - - diff --git a/docs/articles/PopED_files/figure-html/simulate_cost_optmization-1.png b/docs/articles/PopED_files/figure-html/simulate_cost_optmization-1.png deleted file mode 100644 index 4a7584ff..00000000 Binary files a/docs/articles/PopED_files/figure-html/simulate_cost_optmization-1.png and /dev/null differ diff --git a/docs/articles/PopED_files/figure-html/simulate_discrete_optimization-1.png b/docs/articles/PopED_files/figure-html/simulate_discrete_optimization-1.png deleted file mode 100644 index 67e627a5..00000000 Binary files a/docs/articles/PopED_files/figure-html/simulate_discrete_optimization-1.png and /dev/null differ diff --git a/docs/articles/PopED_files/figure-html/simulate_efficiency_windows-1.png b/docs/articles/PopED_files/figure-html/simulate_efficiency_windows-1.png deleted file mode 100644 index 497738f7..00000000 Binary files a/docs/articles/PopED_files/figure-html/simulate_efficiency_windows-1.png and /dev/null differ diff --git a/docs/articles/PopED_files/figure-html/simulate_optimal_design-1.png b/docs/articles/PopED_files/figure-html/simulate_optimal_design-1.png deleted file mode 100644 index eefdbbbc..00000000 Binary files a/docs/articles/PopED_files/figure-html/simulate_optimal_design-1.png and /dev/null differ diff --git a/docs/articles/PopED_files/figure-html/simulate_with_BSV-1.png b/docs/articles/PopED_files/figure-html/simulate_with_BSV-1.png deleted file mode 100644 index 489aee79..00000000 Binary files a/docs/articles/PopED_files/figure-html/simulate_with_BSV-1.png and /dev/null differ diff --git a/docs/articles/PopED_files/figure-html/simulate_without_BSV-1.png b/docs/articles/PopED_files/figure-html/simulate_without_BSV-1.png deleted file mode 100644 index 316549f2..00000000 Binary files a/docs/articles/PopED_files/figure-html/simulate_without_BSV-1.png and /dev/null differ diff --git a/docs/articles/examples.html b/docs/articles/examples.html deleted file mode 100644 index b51eddc0..00000000 --- a/docs/articles/examples.html +++ /dev/null @@ -1,2146 +0,0 @@ - - - - - - - -Examples • PopED - - - - - - - - - - - - - - - - - - - -
-
- - - - -
-
- - - - -
-

Introduction -

-

In this vignette, we try to highlight PopED features that may be -useful. Only code related to specific features we would like to -highlight is described here in this vignette. These features (and more) -are presented as r-scripts in the “examples” folder in the PopED -installation directory. You can view a list of these example files using -the commands:

-
-ex_dir <- system.file("examples", package="PopED")
-list.files(ex_dir)
-#>  [1] "ex.1.a.PK.1.comp.oral.md.intro.R"          
-#>  [2] "ex.1.b.PK.1.comp.oral.md.re-parameterize.R"
-#>  [3] "ex.1.c.PK.1.comp.oral.md.ODE.compiled.R"   
-#>  [4] "ex.10.PKPD.HCV.compiled.R"                 
-#>  [5] "ex.11.PK.prior.R"                          
-#>  [6] "ex.12.covariate.distributions.R"           
-#>  [7] "ex.13.shrinkage.R"                         
-#>  [8] "ex.14.PK.IOV.R"                            
-#>  [9] "ex.15.full.covariance.matrix.R"            
-#> [10] "ex.2.a.warfarin.evaluate.R"                
-#> [11] "ex.2.b.warfarin.optimize.R"                
-#> [12] "ex.2.c.warfarin.ODE.compiled.R"            
-#> [13] "ex.2.d.warfarin.ED.R"                      
-#> [14] "ex.2.e.warfarin.Ds.R"                      
-#> [15] "ex.3.a.PKPD.1.comp.oral.md.imax.D-opt.R"   
-#> [16] "ex.3.b.PKPD.1.comp.oral.md.imax.ED-opt.R"  
-#> [17] "ex.4.PKPD.1.comp.emax.R"                   
-#> [18] "ex.5.PD.emax.hill.R"                       
-#> [19] "ex.6.PK.1.comp.oral.sd.R"                  
-#> [20] "ex.7.PK.1.comp.maturation.R"               
-#> [21] "ex.8.tmdd_qss_one_target_compiled.R"       
-#> [22] "ex.9.PK.2.comp.oral.md.ode.compiled.R"     
-#> [23] "HCV_ode.c"                                 
-#> [24] "HCV_ode.o"                                 
-#> [25] "HCV_ode.so"                                
-#> [26] "one_comp_oral_CL.c"                        
-#> [27] "one_comp_oral_CL.o"                        
-#> [28] "one_comp_oral_CL.so"                       
-#> [29] "tmdd_qss_one_target.c"                     
-#> [30] "tmdd_qss_one_target.o"                     
-#> [31] "tmdd_qss_one_target.so"                    
-#> [32] "two_comp_oral_CL.c"                        
-#> [33] "two_comp_oral_CL.o"                        
-#> [34] "two_comp_oral_CL.so"
-

You can then open one of the examples (for example, -ex.1.a.PK.1.comp.oral.md.intro.R) using the following -code

-
-file_name <- "ex.1.a.PK.1.comp.oral.md.intro.R"
-
-ex_file <- system.file("examples",file_name,package="PopED")
-file.copy(ex_file,tempdir(),overwrite = T)
-file.edit(file.path(tempdir(),file_name))
-

The table below provides a check list of features for each of the 15 -available examples.

- ------------------ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeaturesEx1Ex2Ex3Ex4Ex5Ex6Ex7Ex8Ex9Ex10Ex11Ex12Ex13Ex14Ex15
Analytic modelXXXXXXX---XXXXX
ODE modelXX---X-XXX-----
Irregular dosing---------------
Full cov matrix W--------------X
Inter-occ variability-------------X-
Discrete covariates------X---X----
Continuous covariatesXXXX-XXXXXXXXXX
Multiple armsX-XX--XX--XX-X-
Multi response models--XX---X-X-----
Designs differ
across responses
---X---X-------
Calculate precision
of derived parameters
---------------
Power calculation----------X----
Include previous FIM----------X----
Shrinkage/Bayesian FIMXXXX--X--X--X--
Discrete optimizationXXX--X-X-----X-
Optimization
of multi-group designs
(same response)
X-XX--XX-----X-
Different optimal
sampling times
between groups
---------------
Optimization with constraining
sampling times
X-X----------X-
Optimization of subjects
per group
---------------
-

Note: All features are available in PopED but some are not -demonstrated in the supplied examples.

-
-
-

Analytic solution of PKPD model, multiple study arms -

-

The full code for this example is available in -ex.4.PKPD.1.comp.emax.R.

-

Here we define a PKPD mode using analytical equations. The PK is a -one compartment model with intravenous bolus administration and linear -elimination. The PD is an ordinary Emax model driven by the PK -concentrations. The expected output of each measurement (PK or PD) is -given in the vector model_switch (see below for -details).

-
-library(PopED)
-f_pkpdmodel <- function(model_switch,xt,parameters,poped.db){
-  with(as.list(parameters),{
-    y=xt
-    MS <- model_switch
-    
-    # PK model
-    CONC = DOSE/V*exp(-CL/V*xt) 
-    
-    # PD model
-    EFF = E0 + CONC*EMAX/(EC50 + CONC)
-    
-    y[MS==1] = CONC[MS==1]
-    y[MS==2] = EFF[MS==2]
-    
-    return(list( y= y,poped.db=poped.db))
-  })
-}
-

The error model also has to accommodate both response models.

-
-## -- Residual Error function
-## -- Proportional PK + additive PD
-f_Err <- function(model_switch,xt,parameters,epsi,poped.db){
-  returnArgs <- do.call(poped.db$model$ff_pointer,list(model_switch,xt,parameters,poped.db)) 
-  y <- returnArgs[[1]]
-  poped.db <- returnArgs[[2]]
-  
-  MS <- model_switch
-  
-  prop.err <- y*(1+epsi[,1])
-  add.err <- y+epsi[,2]
-  
-  y[MS==1] = prop.err[MS==1]
-  y[MS==2] = add.err[MS==2]
-  
-  return(list( y= y,poped.db =poped.db )) 
-}
-

In the poped.db object the vector we specify -model_switch in order to assign the sampling times defined -in the vector xt to the PK (=1) or PD (=2) model.

-
-poped.db <- create.poped.database(
-  
-  # Model
-  ff_fun=f_pkpdmodel,
-  fError_fun=f_Err,
-  fg_fun=f_etaToParam,
-  sigma=diag(c(0.15,0.015)),
-  bpop=c(CL=0.5,V=0.2,E0=1,EMAX=1,EC50=1),  
-  d=c(CL=0.09,V=0.09,E0=0.04,EC50=0.09), 
-  
-  # Design
-  groupsize=20,
-  m=3,
-  xt = c(0.33,0.66,0.9,5,0.1,1,2,5),
-  model_switch=c(1,1,1,1,2,2,2,2),
-  a=list(c(DOSE=0),c(DOSE=1),c(DOSE=2)),
-
-  # Design space
-  minxt=0,
-  maxxt=5,
-  bUseGrouped_xt=1,
-  maxa=c(DOSE=10),
-  mina=c(DOSE=0))
-

The model predictions below show typical PK and PD profiles for three -dose groups and the expected 95% prediction interval of the data. The -initial design, as shown in the poped.db object, consists -of 3 arms with doses of 0, 1, and 2 mg; PK sampling times are 0.33, -0.66, 0.9, and 5 hours/days; PD sampling times are 0.1, 1, 2, and 5 -hours/days. With model.names=c("PK","PD") one can name the -outputs in the graph.

-
-plot_model_prediction(
-  poped.db,PI=TRUE,
-  facet_scales="free",
-  separate.groups=TRUE,
-  model.names=c("PK","PD")) 
-

-
-
-

ODE solution of PK model, multiple dosing -

-

The full code for this example is available in -ex.9.PK.2.comp.oral.md.ode.compiled.R.

-

In this example, the deSolve library needs to be -installed for computing solutions to a system of differential equations. -For faster solutions one can use pre-compiled code using the -Rcpp library (see below).

- -

Here we define the two compartment model in R using deSolve -notation

-
-PK.2.comp.oral.ode <- function(Time, State, Pars){
-  with(as.list(c(State, Pars)), {    
-    dA1 <- -KA*A1 
-    dA2 <- KA*A1 + A3* Q/V2 -A2*(CL/V1+Q/V1)
-    dA3 <- A2* Q/V1-A3* Q/V2
-    return(list(c(dA1, dA2, dA3)))
-  })
-}
-

Now we define the initial conditions of the ODE system -A_ini with a named vector, in this case all compartments -are initialized to zero c(A1=0,A2=0,A3=0). The dosing input -is defined as a data.frame dose_dat referring to the named -compartment var = c("A1"), the specified -dose_times and value=c(DOSE*Favail) dose -amounts. Note that the covariates DOSE and the regimen -TAU can differ by arm and be optimized (as shown in -ex.1.a.PK.1.comp.oral.md.intro.R). For more information see -the help pages for ?deSolve::ode and -?deSolve::events.

-
-ff.PK.2.comp.oral.md.ode <- function(model_switch, xt, parameters, poped.db){
-  with(as.list(parameters),{
-    
-    # initial conditions of ODE system
-    A_ini <- c(A1=0, A2=0, A3=0)
-
-    #Set up time points to get ODE solutions
-    times_xt <- drop(xt) # sample times
-    times_start <- c(0) # add extra time for start of study
-    times_dose = seq(from=0,to=max(times_xt),by=TAU) # dose times
-    times <- unique(sort(c(times_start,times_xt,times_dose))) # combine it all
-    
-    # Dosing
-    dose_dat <- data.frame(
-      var = c("A1"), 
-      time = times_dose,
-      value = c(DOSE*Favail), 
-      method = c("add")
-    )
-    
-    out <- ode(A_ini, times, PK.2.comp.oral.ode, parameters,
-               events = list(data = dose_dat))#atol=1e-13,rtol=1e-13)
-    y = out[, "A2"]/V1
-    y=y[match(times_xt,out[,"time"])]
-    y=cbind(y)
-    return(list(y=y,poped.db=poped.db))
-  })
-}
-

When creating a PopED database. ff_fun should point to -the function providing the solution to the ODE. Further, the names in -the parameter definition (fg) function should match the -parameters used in the above two functions.

-
-poped.db <- create.poped.database(
-  
-  # Model
-  ff_fun="ff.PK.2.comp.oral.md.ode",
-  fError_fun="feps.add.prop",
-  fg_fun="fg",
-  sigma=c(prop=0.1^2,add=0.05^2),
-  bpop=c(CL=10,V1=100,KA=1,Q= 3.0, V2= 40.0, Favail=1),
-  d=c(CL=0.15^2,KA=0.25^2),
-  notfixed_bpop=c(1,1,1,1,1,0),
-  
-  # Design
-  groupsize=20,
-  m=1,      #number of groups
-  xt=c( 48,50,55,65,70,85,90,120),
-  
-  # Design space 
-  minxt=0,
-  maxxt=144,
-  discrete_xt = list(0:144),
-  a=c(DOSE=100,TAU=24),
-  discrete_a = list(DOSE=seq(0,1000,by=100),TAU=8:24))
-

We plot the population prediction of the model for the initial -design

-
-plot_model_prediction(poped.db,model_num_points = 500)
-

-

Faster computations with Rcpp: We could also define -the system using Rcpp, which will produce compiled code that should run -faster (further examples in -ex.2.c.warfarin.ODE.compiled.R). First we redefine the ODE -system using Rcpp.

-
-library(Rcpp)
-cppFunction(
-  'List two_comp_oral_ode_Rcpp(double Time, NumericVector A, NumericVector Pars) {
-     int n = A.size();
-     NumericVector dA(n);
-            
-     double CL = Pars[0];
-     double V1 = Pars[1];
-     double KA = Pars[2];
-     double Q  = Pars[3];
-     double V2 = Pars[4];
-            
-     dA[0] = -KA*A[0];
-     dA[1] = KA*A[0] - (CL/V1)*A[1] - Q/V1*A[1] + Q/V2*A[2];
-     dA[2] = Q/V1*A[1] - Q/V2*A[2];
-     return List::create(dA);
-  }')
-

Next we add the compiled function -(two_comp_oral_ode_Rcpp) in the ODE solver.

-
-ff.PK.2.comp.oral.md.ode.Rcpp <- function(model_switch, xt, parameters, poped.db){
-  with(as.list(parameters),{
-    
-    # initial conditions of ODE system
-    A_ini <- c(A1=0, A2=0, A3=0)
-
-    #Set up time points to get ODE solutions
-    times_xt <- drop(xt) # sample times
-    times_start <- c(0) # add extra time for start of study
-    times_dose = seq(from=0,to=max(times_xt),by=TAU) # dose times
-    times <- unique(sort(c(times_start,times_xt,times_dose))) # combine it all
-    
-    # Dosing
-    dose_dat <- data.frame(
-      var = c("A1"), 
-      time = times_dose,
-      value = c(DOSE*Favail), 
-      method = c("add")
-    )
-    
-    # Here "two_comp_oral_ode_Rcpp" is equivalent 
-    # to the non-compiled version "PK.2.comp.oral.ode".
-    out <- ode(A_ini, times, two_comp_oral_ode_Rcpp, parameters,
-               events = list(data = dose_dat))#atol=1e-13,rtol=1e-13)
-    y = out[, "A2"]/V1
-    y=y[match(times_xt,out[,"time"])]
-    y=cbind(y)
-    return(list(y=y,poped.db=poped.db))
-  })
-}
-

Finally we create a poped database to use these functions by updating -the previously created database.

-
-poped.db.Rcpp <- create.poped.database(
-  poped.db,
-  ff_fun="ff.PK.2.comp.oral.md.ode.Rcpp")
-

We can compare the time for design evaluation with these two methods -of describing the same model.

-
-tic(); eval <- evaluate_design(poped.db); toc()
-#> Elapsed time: 1.593 seconds.
-tic(); eval <- evaluate_design(poped.db.Rcpp); toc()
-#> Elapsed time: 0.816 seconds.
-

The difference is noticeable and gets larger for more complex ODE -models.

-
-
-

ODE solution of TMDD model with 2 outputs, Multiple arms, different -dose routes, different number of sample times per arm -

-

The full code for this example is available in -ex.8.tmdd_qss_one_target_compiled.R.

-

In the function that defines the dosing and derives the ODE solution, -the discrete covariate SC_FLAG is used to give the dose -either into A1 or A2, the sub-cutaneous or the -IV compartment.

-
-tmdd_qss_one_target_model_compiled <- function(model_switch,xt,parameters,poped.db){
-  with(as.list(parameters),{
-    y=xt
-    
-    #The initialization vector for the compartment
-    A_ini <- c(A1=DOSE*SC_FLAG,
-               A2=DOSE*(1-SC_FLAG),
-               A3=0,
-               A4=R0)
-    
-    #Set up time points for the ODE
-    times_xt <- drop(xt)
-    times <- sort(times_xt)
-    times <- c(0,times) ## add extra time for start of integration
-    
-    # solve the ODE
-    out <- ode(A_ini, times, tmdd_qss_one_target_model_ode, parameters)#,atol=1e-13,rtol=1e-13)
-    
-    
-    # extract the time points of the observations
-    out = out[match(times_xt,out[,"time"]),]
-    
-    # Match ODE output to measurements
-    RTOT = out[,"A4"]
-    CTOT = out[,"A2"]/V1
-    CFREE = 0.5*((CTOT-RTOT-KSSS)+sqrt((CTOT-RTOT-KSSS)^2+4*KSSS*CTOT))
-    COMPLEX=((RTOT*CFREE)/(KSSS+CFREE))
-    RFREE= RTOT-COMPLEX
-    
-    y[model_switch==1]= RTOT[model_switch==1]
-    y[model_switch==2] =CFREE[model_switch==2]
-    #y[model_switch==3]=RFREE[model_switch==3]
-    
-    return(list( y=y,poped.db=poped.db))
-  })
-}
- -

Two different sub-studies are defined, with different sampling times -per arm - in terms of total number of samples and the actual times1. Due to -this difference in numbers and the relatively complicated study design -we define the sample times (xt), what each sample time will -measure (model_switch) and which samples should be taken at -the same study time (G_xt) as matrices. Here three -variables xt, model_switch, and -G_xt are matrices with each row representing one arm, and -the number of columns is the maximum number of samples (for all -endpoints) in any of the arms (i.e., max(ni)). To be clear -about which elements in the matrices should be considered we specify the -number of samples per arm by defining the vector ni in the -create.poped.database function.

-
-xt <- zeros(6,30)
-study_1_xt <- matrix(rep(c(0.0417,0.25,0.5,1,3,7,14,21,28,35,42,49,56),8),nrow=4,byrow=TRUE)
-study_2_xt <- matrix(rep(c(0.0417,1,1,7,14,21,28,56,63,70,77,84,91,98,105),4),nrow=2,byrow=TRUE)
-xt[1:4,1:26] <- study_1_xt
-xt[5:6,] <- study_2_xt
-
-model_switch <- zeros(6,30)
-model_switch[1:4,1:13] <- 1
-model_switch[1:4,14:26] <- 2
-model_switch[5:6,1:15] <- 1
-model_switch[5:6,16:30] <- 2
-
-G_xt <- zeros(6,30)
-study_1_G_xt <- matrix(rep(c(1:13),8),nrow=4,byrow=TRUE)
-study_2_G_xt <- matrix(rep(c(14:28),4),nrow=2,byrow=TRUE)
-G_xt[1:4,1:26] <- study_1_G_xt
-G_xt[5:6,] <- study_2_G_xt
-

These can then be plugged into the normal poped.db -setup.

-
-poped.db.2 <- create.poped.database(
-  
-  # Model
-  ff_fun=tmdd_qss_one_target_model_compiled,
-  fError_fun=tmdd_qss_one_target_model_ruv,
-  fg_fun=sfg,
-  sigma=c(rtot_add=0.04,cfree_add=0.0225),
-  bpop=c(CL=0.3,V1=3,Q=0.2,V2=3,FAVAIL=0.7,KA=0.5,VMAX=0,
-         KMSS=0,R0=0.1,KSSS=0.015,KDEG=10,KINT=0.05),
-  d=c(CL=0.09,V1=0.09,Q=0.04,V2=0.04,FAVAIL=0.04,
-      KA=0.16,VMAX=0,KMSS=0,R0=0.09,KSSS=0.09,KDEG=0.04,
-      KINT=0.04),
-  notfixed_bpop=c( 1,1,1,1,1,1,0,0,1,1,1,1),
-  notfixed_d=c( 1,1,1,1,1,1,0,0,1,1,1,1),
-  
-  # Design
-  groupsize=rbind(6,6,6,6,100,100),
-  m=6,      #number of groups
-  xt=xt,
-  model_switch=model_switch,
-  ni=rbind(26,26,26,26,30,30),
-  a=list(c(DOSE=100, SC_FLAG=0),
-         c(DOSE=300, SC_FLAG=0),
-         c(DOSE=600, SC_FLAG=0),
-         c(DOSE=1000, SC_FLAG=1),
-         c(DOSE=600, SC_FLAG=0),
-         c(DOSE=1000, SC_FLAG=1)),
-  
-  # Design space
-  bUseGrouped_xt=1,
-  G_xt=G_xt,
-  discrete_a = list(DOSE=seq(100,1000,by=100),
-                    SC_FLAG=c(0,1)))
-

Now we can plot population predictions for each group and evaluate -the design.

-
-plot_model_prediction(poped.db.2,facet_scales="free")
-

-
-eval_2 <- evaluate_design(poped.db.2)
-round(eval_2$rse) # in percent
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RSE in %
CL2
V12
Q2
V23
FAVAIL3
KA5
R03
KSSS3
KDEG3
KINT2
d_CL11
d_V112
d_Q22
d_V220
d_FAVAIL24
d_KA19
d_R012
d_KSSS13
d_KDEG20
d_KINT18
sig_rtot_add3
sig_cfree_add3
-
-
-

Model with continuous covariates -

-

The R code for this example is available in -ex.12.covariate_distributions.R.

-

Let’s assume that we have a model with a covariate included in the -model description. Here we define a one-compartment PK model that uses -allometric scaling with a weight effect on both clearance and volume of -distribution.

-
-mod_1 <- function(model_switch,xt,parameters,poped.db){
-  with(as.list(parameters),{
-    y=xt
-    
-    CL=CL*(WT/70)^(WT_CL)
-    V=V*(WT/70)^(WT_V)
-    DOSE=1000*(WT/70)
-    y = DOSE/V*exp(-CL/V*xt) 
-    
-    return(list( y= y,poped.db=poped.db))
-  })
-}
-
-par_1 <- function(x,a,bpop,b,bocc){
-  parameters=c( CL=bpop[1]*exp(b[1]),
-                V=bpop[2]*exp(b[2]),
-                WT_CL=bpop[3],
-                WT_V=bpop[4],
-                WT=a[1])
-  return( parameters ) 
-}
-

Now we define a design. In this case one group of individuals, where -we define the individuals’ typical weight as 70 kg -(a=c(WT=70)).

-
-poped_db <- 
-  create.poped.database(
-    ff_fun=mod_1,
-    fg_fun=par_1,
-    fError_fun=feps.add.prop,
-    groupsize=50,
-    m=1,
-    sigma=c(prop=0.015,add=0.0015),
-    notfixed_sigma = c(1,0),
-    bpop=c(CL=3.8,V=20,WT_CL=0.75,WT_V=1), 
-    d=c(CL=0.05,V=0.05), 
-    xt=c( 1,2,4,6,8,24),
-    minxt=0,
-    maxxt=24,
-    bUseGrouped_xt=1,
-    a=c(WT=70)
-  )
-

We can create a plot of the model prediction for the typical -individual

- -

-

And evaluate the initial design

-
-evaluate_design(poped_db)
-#> Problems inverting the matrix. Results could be misleading.
-#> Warning:   The following parameters are not estimable:
-#>   WT_CL, WT_V
-#>   Is the design adequate to estimate all parameters?
-#> $ofv
-#> [1] -Inf
-#> 
-#> $fim
-#>                  CL          V WT_CL WT_V       d_CL        d_V   sig_prop
-#> CL       65.8889583 -0.7145374     0    0    0.00000    0.00000      0.000
-#> V        -0.7145374  2.2798156     0    0    0.00000    0.00000      0.000
-#> WT_CL     0.0000000  0.0000000     0    0    0.00000    0.00000      0.000
-#> WT_V      0.0000000  0.0000000     0    0    0.00000    0.00000      0.000
-#> d_CL      0.0000000  0.0000000     0    0 9052.31524   29.49016   1424.255
-#> d_V       0.0000000  0.0000000     0    0   29.49016 8316.09464   2483.900
-#> sig_prop  0.0000000  0.0000000     0    0 1424.25450 2483.90024 440009.144
-#> 
-#> $rse
-#>        CL         V     WT_CL      WT_V      d_CL       d_V  sig_prop 
-#>  3.247502  3.317107        NA        NA 21.026264 21.950179 10.061292
-

From the output produced we see that the covariate parameters can not -be estimated according to this design calculation (RSE of WT_CL and WT_V -are NA). Why is that? Well, the calculation being done is -assuming that every individual in the group has the same covariate (to -speed up the calculation). This is clearly a poor assumption in this -case!

-

Distribution of covariates: We can improve the -computation by assuming a distribution of the covariate (WT) in the -individuals in the study. We set groupsize=1, the number of -groups to be 50 (m=50) and assume that WT is sampled from a -normal distribution with mean=70 and sd=10 -(a=as.list(rnorm(50, mean = 70, sd = 10)).

-
-poped_db_2 <- 
-  create.poped.database(
-    ff_fun=mod_1,
-    fg_fun=par_1,
-    fError_fun=feps.add.prop,
-    groupsize=1,
-    m=50,
-    sigma=c(prop=0.015,add=0.0015),
-    notfixed_sigma = c(prop=1,add=0),
-    bpop=c(CL=3.8,V=20,WT_CL=0.75,WT_V=1), 
-    d=c(CL=0.05,V=0.05), 
-    xt=c(1,2,4,6,8,24),
-    minxt=0,
-    maxxt=24,
-    bUseGrouped_xt=1,
-    a=as.list(rnorm(50, mean = 70, sd = 10))
-  )
-
-ev <- evaluate_design(poped_db_2) 
-round(ev$ofv,1)
-#> [1] 42.4
-
-round(ev$rse)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RSE in %
CL3
V3
WT_CL28
WT_V21
d_CL21
d_V22
sig_prop10
-

Here we see that, given this distribution of weights, the covariate -effect parameters (WT_CL and WT_V) would be -well estimated.

-

However, we are only looking at one sample of 50 individuals. Maybe a -better approach is to look at the distribution of RSEs over a number of -experiments given the expected weight distribution.

-
-nsim <- 30
-rse_list <- c()
-for(i in 1:nsim){
-  poped_db_tmp <- 
-    create.poped.database(
-      ff_fun=mod_1,
-      fg_fun=par_1,
-      fError_fun=feps.add.prop,
-      groupsize=1,
-      m=50,
-      sigma=c(prop=0.015,add=0.0015),
-      notfixed_sigma = c(1,0),
-      bpop=c(CL=3.8,V=20,WT_CL=0.75,WT_V=1), 
-      d=c(CL=0.05,V=0.05), 
-      xt=c( 1,2,4,6,8,24),
-      minxt=0,
-      maxxt=24,
-      bUseGrouped_xt=1,
-      a=as.list(rnorm(50,mean = 70,sd=10)))
-  rse_tmp <- evaluate_design(poped_db_tmp)$rse
-  rse_list <- rbind(rse_list,rse_tmp)
-}
-(rse_quant <- apply(rse_list,2,quantile))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CLVWT_CLWT_Vd_CLd_Vsig_prop
0%3.253.3223.7418.1921.0321.9510.06
25%3.253.3227.1120.7921.0321.9510.07
50%3.263.3329.9622.9621.0321.9610.07
75%3.293.3632.9225.2321.0321.9610.07
100%3.423.4936.9528.3121.0321.9610.08
-

Note, that the variance of the RSE of the covariate effect is in this -case strongly correlated with the variance of the weight distribution -(not shown).

-
-
-

Model with discrete covariates -

-

See ex.11.PK.prior.R. This has the covariate -isPediatric to distinguish between adults and pediatrics. -Alternatively, DOSE and TAU in the first -example can be considered as discrete covariates.

-
-
-

Model with Inter-Occasion Variability (IOV) -

-

The full code for this example is available in -ex.14.PK.IOV.R.

-

The IOV is introduced with bocc[x,y] in the parameter -definition function as a matrix with the first argument x -indicating the index for the IOV variances, and the second argument -y denoting the occasion. This is used in the example to -derive to different clearance values, i.e., CL_OCC_1 and -CL_OCC_2.

-
-sfg <- function(x,a,bpop,b,bocc){
-  parameters=c( CL_OCC_1=bpop[1]*exp(b[1]+bocc[1,1]),
-                CL_OCC_2=bpop[1]*exp(b[1]+bocc[1,2]),
-                V=bpop[2]*exp(b[2]),
-                KA=bpop[3]*exp(b[3]),
-                DOSE=a[1],
-                TAU=a[2])
-  return( parameters ) 
-}
-

These parameters can now be used in the model function to define the -change in parameters between the occasions (here the change occurs with -the 7th dose in a one-compartment model with first order -absorption).

-
-cppFunction(
-  'List one_comp_oral_ode(double Time, NumericVector A, NumericVector Pars) {
-   int n = A.size();
-   NumericVector dA(n);
-            
-   double CL_OCC_1 = Pars[0];
-   double CL_OCC_2 = Pars[1];
-   double V = Pars[2];
-   double KA = Pars[3];
-   double TAU = Pars[4];
-   double N,CL;
-            
-   N = floor(Time/TAU)+1;
-   CL = CL_OCC_1;
-   if(N>6) CL = CL_OCC_2;
-   
-   dA[0] = -KA*A[0];
-   dA[1] = KA*A[0] - (CL/V)*A[1];
-   return List::create(dA);
-   }'
-)
-
-ff.ode.rcpp <- function(model_switch, xt, parameters, poped.db){
-  with(as.list(parameters),{
-    A_ini <- c(A1=0, A2=0)
-    times_xt <- drop(xt) #xt[,,drop=T] 
-    dose_times = seq(from=0,to=max(times_xt),by=TAU)
-    eventdat <- data.frame(var = c("A1"), 
-                           time = dose_times,
-                           value = c(DOSE), method = c("add"))
-    times <- sort(c(times_xt,dose_times))
-    out <- ode(A_ini, times, one_comp_oral_ode, c(CL_OCC_1,CL_OCC_2,V,KA,TAU), 
-               events = list(data = eventdat))#atol=1e-13,rtol=1e-13)
-    y = out[, "A2"]/(V)
-    y=y[match(times_xt,out[,"time"])]
-    y=cbind(y)
-    return(list(y=y,poped.db=poped.db))
-  })
-}
-

The within-subject variability variances (docc) are -defined in the poped database as a 3-column matrix with one row per -IOV-parameter, and the middle column giving the variance values.

-
-poped.db <- 
-  create.poped.database(
-    ff_fun=ff.ode.rcpp,
-    fError_fun=feps.add.prop,
-    fg_fun=sfg,
-    bpop=c(CL=3.75,V=72.8,KA=0.25), 
-    d=c(CL=0.25^2,V=0.09,KA=0.09), 
-    sigma=c(prop=0.04,add=5e-6),
-    notfixed_sigma=c(0,0),
-    docc = matrix(c(0,0.09,0),nrow = 1),
-    m=2,
-    groupsize=20,
-    xt=c( 1,2,8,240,245),
-    minxt=c(0,0,0,240,240),
-    maxxt=c(10,10,10,248,248),
-    bUseGrouped_xt=1,
-    a=list(c(DOSE=20,TAU=24),c(DOSE=40, TAU=24)),
-    maxa=c(DOSE=200,TAU=24),
-    mina=c(DOSE=0,TAU=24)
-  )
-

We can visualize the IOV by looking at an example individual. We see -the PK profile changes at the 7th dose (red line) due to the change in -clearance.

-
-library(ggplot2)
-set.seed(123)
-plot_model_prediction(
-  poped.db, 
-  PRED=F,IPRED=F, 
-  separate.groups=T, 
-  model_num_points = 300, 
-  groupsize_sim = 1,
-  IPRED.lines = T, 
-  alpha.IPRED.lines=0.6,
-  sample.times = F
-) + geom_vline(xintercept = 24*6,color="red")
-

-

We can also see that the design is relatively poor for estimating the -IOV parameter:

-
-ev <- evaluate_design(poped.db)
-round(ev$rse)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RSE in %
CL6
V9
KA11
d_CL106
d_V43
d_KA63
D.occ[1,1]79
-
-
-

Full omega matrix -

-

The full code for this example is available in -ex.15.full.covariance.matrix.R.

-

The covd object is used for defining the covariances of -the between subject variances (off-diagonal elements of the full -variance-covariance matrix for the between subject variability).

-
-poped.db_with <- 
-  create.poped.database(
-    ff_file="ff",
-    fg_file="sfg",
-    fError_file="feps",
-    bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
-    notfixed_bpop=c(1,1,1,0),
-    d=c(CL=0.07, V=0.02, KA=0.6), 
-    covd = c(.03,.1,.09),
-    sigma=c(prop=0.01),
-    groupsize=32,
-    xt=c( 0.5,1,2,6,24,36,72,120),
-    minxt=0,
-    maxxt=120,
-    a=70
-  )
-

What do the covariances mean?

-
-(IIV <- poped.db_with$parameters$param.pt.val$d)
-#>      [,1] [,2] [,3]
-#> [1,] 0.07 0.03 0.10
-#> [2,] 0.03 0.02 0.09
-#> [3,] 0.10 0.09 0.60
-cov2cor(IIV)
-#>           [,1]      [,2]      [,3]
-#> [1,] 1.0000000 0.8017837 0.4879500
-#> [2,] 0.8017837 1.0000000 0.8215838
-#> [3,] 0.4879500 0.8215838 1.0000000
-

They indicate a correlation of the inter-individual variabilities, -here of ca. 0.8 between clearance and volume, as well as between volume -and absorption rate.

-

We can clearly see a difference in the variance of the model -predictions.

-
-library(ggplot2)
-p1 <- plot_model_prediction(poped.db, PI=TRUE)+ylim(-0.5,12) 
-p2 <- plot_model_prediction(poped.db_with,PI=TRUE) +ylim(-0.5,12)
-gridExtra::grid.arrange(p1+ ggtitle("No covariance in BSV"), p2+ ggtitle("Covariance in BSV"), nrow = 1)
-

-

Evaluating the designs with and without the covariances:

-
-ev1 <- evaluate_design(poped.db)
-ev2 <- evaluate_design(poped.db_with)
-
-round(ev1$rse)
-round(ev2$rse)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Diagonal BSVCovariance in BSV
CL55
V33
KA1414
d_CL2626
d_V3030
d_KA2626
sig_prop1111
D[2,1]NA31
D[3,1]NA41
D[3,2]NA31
-

Note, that the precision of all other parameters is barely affected -by including the full covariance matrix. This is likely to be different -in practice with more ill-conditioned numerical problems.

-

Evaluate the same designs with full FIM (instead of -reduced)

-
-ev1 <- evaluate_design(poped.db, fim.calc.type=0)
-ev2 <-evaluate_design(poped.db_with, fim.calc.type=0)
-
-round(ev1$rse,1)
-round(ev2$rse,1)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Diagonal BSVCovariance in BSV
CL44
V32
KA55
d_CL2627
d_V3131
d_KA2726
sig_prop1212
D[2,1]NA31
D[3,1]NA42
D[3,2]NA31
-
-
-

Include a prior FIM, compute power to identify a parameter -

-

In this example we incorporate prior knowledge into a current study -design calculation. First the expected FIM obtained from an experiment -in adults is computed. Then this FIM is added to the current experiment -in children. One could also use the observed FIM when using estimation -software to fit one realization of a design (from the $COVARIANCE step -in NONMEM for example). The full code for this example is available in -ex.11.PK.prior.R.

-

Note that we define the parameters for a one-compartment first-order -absorption model using a covariate called isPediatric to -switch between adult and pediatric models, and -bpop[5]=pedCL is the factor to multiply the adult clearance -bpop[3] to obtain the pediatric one.

-
-sfg <- function(x,a,bpop,b,bocc){
-  parameters=c( 
-    V=bpop[1]*exp(b[1]),
-    KA=bpop[2]*exp(b[2]),
-    CL=bpop[3]*exp(b[3])*bpop[5]^a[3], # add covariate for pediatrics
-    Favail=bpop[4],
-    isPediatric = a[3],
-    DOSE=a[1],
-    TAU=a[2])
-  return( parameters ) 
-}
-

The design and design space for adults is defined below (Two arms, 5 -sample time points per arm, doses of 20 and 40 mg, -isPediatric = 0). As we want to pool the results (i.e. add -the FIMs together), we also have to provide the pedCL -parameter so that both the adult and children FIMs have the same -dimensions.

-
-poped.db <- 
-  create.poped.database(
-    ff_fun=ff.PK.1.comp.oral.md.CL,
-    fg_fun=sfg,
-    fError_fun=feps.add.prop,
-    bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9,pedCL=0.8), 
-    notfixed_bpop=c(1,1,1,0,1),
-    d=c(V=0.09,KA=0.09,CL=0.25^2), 
-    sigma=c(0.04,5e-6),
-    notfixed_sigma=c(0,0),
-    m=2,
-    groupsize=20,
-    xt=c( 1,8,10,240,245),
-    bUseGrouped_xt=1,
-    a=list(c(DOSE=20,TAU=24,isPediatric = 0),
-           c(DOSE=40, TAU=24,isPediatric = 0))
-  )
-

Create plot of model without variability

-
-plot_model_prediction(poped.db, model_num_points = 300)
-

-

To store the FIM from the adult design we evaluate this design

-
-(outAdult = evaluate_design(poped.db))
-#> Problems inverting the matrix. Results could be misleading.
-#> Warning:   The following parameters are not estimable:
-#>   pedCL
-#>   Is the design adequate to estimate all parameters?
-#> $ofv
-#> [1] -Inf
-#> 
-#> $fim
-#>                 V          KA          CL pedCL          d_V         d_KA
-#> V      0.05854391   -6.815269 -0.01531146     0    0.0000000   0.00000000
-#> KA    -6.81526942 2963.426688 -1.32113719     0    0.0000000   0.00000000
-#> CL    -0.01531146   -1.321137 37.50597895     0    0.0000000   0.00000000
-#> pedCL  0.00000000    0.000000  0.00000000     0    0.0000000   0.00000000
-#> d_V    0.00000000    0.000000  0.00000000     0 1203.3695137 192.31775149
-#> d_KA   0.00000000    0.000000  0.00000000     0  192.3177515 428.81459138
-#> d_CL   0.00000000    0.000000  0.00000000     0    0.2184104   0.01919009
-#>               d_CL
-#> V     0.000000e+00
-#> KA    0.000000e+00
-#> CL    0.000000e+00
-#> pedCL 0.000000e+00
-#> d_V   2.184104e-01
-#> d_KA  1.919009e-02
-#> d_CL  3.477252e+03
-#> 
-#> $rse
-#>         V        KA        CL     pedCL       d_V      d_KA      d_CL 
-#>  6.634931  8.587203  4.354792        NA 33.243601 55.689432 27.133255
-

It is obvious that we cannot estimate the pediatric covariate from -adult data only; hence the warning message. You can also note the zeros -in the 4th column and 4th row of the FIM indicating that -pedCL cannot be estimated from the adult data.

-

We can evaluate the adult design without warning, by setting the -pedCL parameter to be fixed (i.e., not estimated):

-
-evaluate_design(create.poped.database(poped.db, notfixed_bpop=c(1,1,1,0,0)))
-#> $ofv
-#> [1] 29.70233
-#> 
-#> $fim
-#>                V          KA          CL          d_V         d_KA         d_CL
-#> V     0.05854391   -6.815269 -0.01531146    0.0000000   0.00000000 0.000000e+00
-#> KA   -6.81526942 2963.426688 -1.32113719    0.0000000   0.00000000 0.000000e+00
-#> CL   -0.01531146   -1.321137 37.50597895    0.0000000   0.00000000 0.000000e+00
-#> d_V   0.00000000    0.000000  0.00000000 1203.3695137 192.31775149 2.184104e-01
-#> d_KA  0.00000000    0.000000  0.00000000  192.3177515 428.81459138 1.919009e-02
-#> d_CL  0.00000000    0.000000  0.00000000    0.2184104   0.01919009 3.477252e+03
-#> 
-#> $rse
-#>         V        KA        CL       d_V      d_KA      d_CL 
-#>  6.634931  8.587203  4.354792 33.243601 55.689432 27.133255
-

One obtains good estimates for all parameters for adults (<60% RSE -for all).

-

For pediatrics the covariate isPediatric = 1. We define -one arm, 4 sample-time points.

-
-poped.db.ped <- 
-  create.poped.database(
-    ff_fun=ff.PK.1.comp.oral.md.CL,
-    fg_fun=sfg,
-    fError_fun=feps.add.prop,
-    bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9,pedCL=0.8), 
-    notfixed_bpop=c(1,1,1,0,1),
-    d=c(V=0.09,KA=0.09,CL=0.25^2), 
-    sigma=c(0.04,5e-6),
-    notfixed_sigma=c(0,0),
-    m=1,
-    groupsize=6,
-    xt=c( 1,2,6,240),
-    bUseGrouped_xt=1,
-    a=list(c(DOSE=40,TAU=24,isPediatric = 1))
-  )
-

We can create a plot of the pediatric model without variability

-
-plot_model_prediction(poped.db.ped, model_num_points = 300)
-

-

Evaluate the design of the pediatrics study alone.

-
-evaluate_design(poped.db.ped)
-#> Problems inverting the matrix. Results could be misleading.
-#> $ofv
-#> [1] -Inf
-#> 
-#> $fim
-#>                  V         KA          CL        pedCL         d_V       d_KA
-#> V      0.007766643  -1.395981 -0.01126202  -0.05279073   0.0000000  0.0000000
-#> KA    -1.395980934 422.458209 -2.14666933 -10.06251250   0.0000000  0.0000000
-#> CL    -0.011262023  -2.146669  5.09936874  23.90329099   0.0000000  0.0000000
-#> pedCL -0.052790734 -10.062512 23.90329099 112.04667652   0.0000000  0.0000000
-#> d_V    0.000000000   0.000000  0.00000000   0.00000000 141.1922923 53.7923483
-#> d_KA   0.000000000   0.000000  0.00000000   0.00000000  53.7923483 58.0960085
-#> d_CL   0.000000000   0.000000  0.00000000   0.00000000   0.7877291  0.3375139
-#>              d_CL
-#> V       0.0000000
-#> KA      0.0000000
-#> CL      0.0000000
-#> pedCL   0.0000000
-#> d_V     0.7877291
-#> d_KA    0.3375139
-#> d_CL  428.5254900
-#> 
-#> $rse
-#>           V          KA          CL       pedCL         d_V        d_KA 
-#>  24.7208804  30.8495322   0.5200823  11.4275854 116.2309452 181.1977846 
-#>        d_CL 
-#>  77.2918849
-

Clearly the design has problems on its own.

-

We can add the prior information from the adult study and evaluate -that design (i.e., pooling adult and pediatric data).

-
-poped.db.all <- create.poped.database(
-  poped.db.ped,
-  prior_fim = outAdult$fim
-)
-
-(out.all <- evaluate_design(poped.db.all))
-#> $ofv
-#> [1] 34.96368
-#> 
-#> $fim
-#>                  V         KA          CL        pedCL         d_V       d_KA
-#> V      0.007766643  -1.395981 -0.01126202  -0.05279073   0.0000000  0.0000000
-#> KA    -1.395980934 422.458209 -2.14666933 -10.06251250   0.0000000  0.0000000
-#> CL    -0.011262023  -2.146669  5.09936874  23.90329099   0.0000000  0.0000000
-#> pedCL -0.052790734 -10.062512 23.90329099 112.04667652   0.0000000  0.0000000
-#> d_V    0.000000000   0.000000  0.00000000   0.00000000 141.1922923 53.7923483
-#> d_KA   0.000000000   0.000000  0.00000000   0.00000000  53.7923483 58.0960085
-#> d_CL   0.000000000   0.000000  0.00000000   0.00000000   0.7877291  0.3375139
-#>              d_CL
-#> V       0.0000000
-#> KA      0.0000000
-#> CL      0.0000000
-#> pedCL   0.0000000
-#> d_V     0.7877291
-#> d_KA    0.3375139
-#> d_CL  428.5254900
-#> 
-#> $rse
-#>         V        KA        CL     pedCL       d_V      d_KA      d_CL 
-#>  6.381388  8.222819  4.354761 12.591940 31.808871 52.858399 25.601551
-

The pooled data leads to much higher precision in parameter estimates -compared to either study separately.

-

One can also obtain the power for estimating the pediatric difference -in clearance (power in estimating bpop[5] as different from 1).

-
-evaluate_power(poped.db.all, bpop_idx=5, h0=1, out=out.all)
-#> $ofv
-#> [1] 34.96368
-#> 
-#> $fim
-#>                  V         KA          CL        pedCL         d_V       d_KA
-#> V      0.007766643  -1.395981 -0.01126202  -0.05279073   0.0000000  0.0000000
-#> KA    -1.395980934 422.458209 -2.14666933 -10.06251250   0.0000000  0.0000000
-#> CL    -0.011262023  -2.146669  5.09936874  23.90329099   0.0000000  0.0000000
-#> pedCL -0.052790734 -10.062512 23.90329099 112.04667652   0.0000000  0.0000000
-#> d_V    0.000000000   0.000000  0.00000000   0.00000000 141.1922923 53.7923483
-#> d_KA   0.000000000   0.000000  0.00000000   0.00000000  53.7923483 58.0960085
-#> d_CL   0.000000000   0.000000  0.00000000   0.00000000   0.7877291  0.3375139
-#>              d_CL
-#> V       0.0000000
-#> KA      0.0000000
-#> CL      0.0000000
-#> pedCL   0.0000000
-#> d_V     0.7877291
-#> d_KA    0.3375139
-#> d_CL  428.5254900
-#> 
-#> $rse
-#>         V        KA        CL     pedCL       d_V      d_KA      d_CL 
-#>  6.381388  8.222819  4.354761 12.591940 31.808871 52.858399 25.601551 
-#> 
-#> $power
-#>       Value      RSE power_pred power_want need_rse min_N_tot
-#> pedCL   0.8 12.59194   51.01851         80 8.923519        14
-

We see that to clearly distinguish this parameter one would need 14 -children in the pediatric study (for 80% power at \(\alpha=0.05\)).

-
-
-

Design evaluation including uncertainty in the model parameters -(robust design) -

-

In this example the aim is to evaluate a design incorporating -uncertainty around parameter values in the model. The full code for this -example is available in ex.2.d.warfarin.ED.R. This -illustration is one of the Warfarin examples from software comparison -in: Nyberg et al.2.

-

We define the fixed effects in the model and add a 10% uncertainty to -all but Favail. To do this we use a
-Matrix defining the fixed effects, per row (row number = -parameter_number) we should have:

-
    -
  • column 1 the type of the distribution for E-family designs (0 = -Fixed, 1 = Normal, 2 = Uniform, 3 = User Defined Distribution, 4 = -lognormal and 5 = truncated normal)
  • -
  • column 2 defines the mean.
  • -
  • column 3 defines the variance of the distribution (or length of -uniform distribution).
  • -
-

Here we define a log-normal distribution

-
-bpop_vals <- c(CL=0.15, V=8, KA=1.0, Favail=1)
-bpop_vals_ed <- 
-  cbind(ones(length(bpop_vals),1)*4, # log-normal distribution
-        bpop_vals,
-        ones(length(bpop_vals),1)*(bpop_vals*0.1)^2) # 10% of bpop value
-bpop_vals_ed["Favail",] <- c(0,1,0)
-bpop_vals_ed
-#>          bpop_vals         
-#> CL     4      0.15 0.000225
-#> V      4      8.00 0.640000
-#> KA     4      1.00 0.010000
-#> Favail 0      1.00 0.000000
-

With this model and parameter set we define the initial design and -design space. Specifically note the bpop=bpop_vals_ed and -the ED_samp_size=20 arguments. ED_samp_size=20 -indicates the number of samples used in evaluating the E-family -objective functions.

-
-poped.db <- 
-  create.poped.database(
-    ff_fun=ff,
-    fg_fun=sfg,
-    fError_fun=feps.add.prop,
-    bpop=bpop_vals_ed, 
-    notfixed_bpop=c(1,1,1,0),
-    d=c(CL=0.07, V=0.02, KA=0.6), 
-    sigma=c(0.01,0.25),
-    groupsize=32,
-    xt=c( 0.5,1,2,6,24,36,72,120),
-    minxt=0,
-    maxxt=120,
-    a=70,
-    mina=0,
-    maxa=100,
-    ED_samp_size=20)
-

You can also provide ED_samp_size argument to the design -evaluation or optimization arguments:

-
-tic();evaluate_design(poped.db,d_switch=FALSE,ED_samp_size=20); toc()
-#> $ofv
-#> [1] 55.41311
-#> 
-#> $fim
-#>                     CL         V        KA         d_CL         d_V        d_KA
-#> CL         17590.84071 21.130793 10.320177 0.000000e+00     0.00000  0.00000000
-#> V             21.13079 17.817120 -3.529007 0.000000e+00     0.00000  0.00000000
-#> KA            10.32018 -3.529007 51.622520 0.000000e+00     0.00000  0.00000000
-#> d_CL           0.00000  0.000000  0.000000 2.319890e+03    10.62595  0.03827253
-#> d_V            0.00000  0.000000  0.000000 1.062595e+01 19005.72029 11.80346662
-#> d_KA           0.00000  0.000000  0.000000 3.827253e-02    11.80347 38.83793850
-#> SIGMA[1,1]     0.00000  0.000000  0.000000 7.336186e+02  9690.93156 64.79341332
-#> SIGMA[2,2]     0.00000  0.000000  0.000000 9.057819e+01   265.70389  2.95284399
-#>              SIGMA[1,1]  SIGMA[2,2]
-#> CL              0.00000    0.000000
-#> V               0.00000    0.000000
-#> KA              0.00000    0.000000
-#> d_CL          733.61860   90.578191
-#> d_V          9690.93156  265.703890
-#> d_KA           64.79341    2.952844
-#> SIGMA[1,1] 193719.81023 6622.636801
-#> SIGMA[2,2]   6622.63680  477.649386
-#> 
-#> $rse
-#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
-#>   5.030673   2.983917  14.014958  29.787587  36.758952  26.753311  31.645011 
-#> SIGMA[2,2] 
-#>  25.341368
-#> Elapsed time: 0.101 seconds.
-

We can see that the result, based on MC sampling, is somewhat -variable with so few samples.

-
-tic();evaluate_design(poped.db,d_switch=FALSE,ED_samp_size=20); toc()
-#> $ofv
-#> [1] 55.42045
-#> 
-#> $fim
-#>                     CL         V        KA         d_CL         d_V        d_KA
-#> CL         17652.97859 20.900077 10.206898 0.000000e+00     0.00000  0.00000000
-#> V             20.90008 17.846603 -3.482767 0.000000e+00     0.00000  0.00000000
-#> KA            10.20690 -3.482767 51.214965 0.000000e+00     0.00000  0.00000000
-#> d_CL           0.00000  0.000000  0.000000 2.323385e+03    10.26722  0.03682497
-#> d_V            0.00000  0.000000  0.000000 1.026722e+01 19067.54099 11.76757081
-#> d_KA           0.00000  0.000000  0.000000 3.682497e-02    11.76757 38.83554961
-#> SIGMA[1,1]     0.00000  0.000000  0.000000 7.287665e+02  9671.83881 65.02022679
-#> SIGMA[2,2]     0.00000  0.000000  0.000000 9.042351e+01   265.46887  2.94967457
-#>              SIGMA[1,1]  SIGMA[2,2]
-#> CL              0.00000    0.000000
-#> V               0.00000    0.000000
-#> KA              0.00000    0.000000
-#> d_CL          728.76653   90.423509
-#> d_V          9671.83881  265.468868
-#> d_KA           65.02023    2.949675
-#> SIGMA[1,1] 194823.12196 6613.513007
-#> SIGMA[2,2]   6613.51301  476.316709
-#> 
-#> $rse
-#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
-#>   5.021700   2.980981  14.068646  29.765030  36.691675  26.754137  31.469425 
-#> SIGMA[2,2] 
-#>  25.311870
-#> Elapsed time: 0.104 seconds.
-
-
-

Design evaluation for a subset of model parameters of interest (Ds -optimality) -

-

Ds-optimality is a criterion that can be used if one is interested in -estimating a subset “s” of the model parameters as precisely as -possible. The full code for this example is available in -ex.2.e.warfarin.Ds.R. First we define initial design and -design space:

-

For Ds optimality we add the ds_index option to the -create.poped.database function to indicate whether a -parameter is interesting (=0) or not (=1). Moreover, we set the -ofv_calc_type=6 for computing the Ds optimality criterion -(it is set to 4 by default, for computing the log of the determinant of -the FIM). More details are available by running the command -?create.poped.database.

-
-poped.db <- 
-  create.poped.database(
-    ff_fun=ff,
-    fg_fun=sfg,
-    fError_fun=feps.add.prop,
-    bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
-    notfixed_bpop=c(1,1,1,0),
-    d=c(CL=0.07, V=0.02, KA=0.6), 
-    sigma=c(0.01,0.25),
-    groupsize=32,
-    xt=c( 0.5,1,2,6,24,36,72,120),
-    minxt=0,
-    maxxt=120,
-    a=70,
-    mina=0,
-    maxa=100,
-    ds_index=c(0,0,0,1,1,1,1,1), # size is number_of_non_fixed_parameters
-    ofv_calc_type=6) # Ds OFV calculation
-

Design evaluation:

-
-evaluate_design(poped.db)
-#> $ofv
-#> [1] 16.49204
-#> 
-#> $fim
-#>                     CL         V        KA         d_CL          d_V
-#> CL         17141.83891 20.838375 10.011000 0.000000e+00     0.000000
-#> V             20.83837 17.268051 -3.423641 0.000000e+00     0.000000
-#> KA            10.01100 -3.423641 49.864697 0.000000e+00     0.000000
-#> d_CL           0.00000  0.000000  0.000000 2.324341e+03     9.770352
-#> d_V            0.00000  0.000000  0.000000 9.770352e+00 19083.877564
-#> d_KA           0.00000  0.000000  0.000000 3.523364e-02    11.721317
-#> SIGMA[1,1]     0.00000  0.000000  0.000000 7.268410e+02  9656.158553
-#> SIGMA[2,2]     0.00000  0.000000  0.000000 9.062739e+01   266.487127
-#>                   d_KA   SIGMA[1,1]  SIGMA[2,2]
-#> CL          0.00000000      0.00000    0.000000
-#> V           0.00000000      0.00000    0.000000
-#> KA          0.00000000      0.00000    0.000000
-#> d_CL        0.03523364    726.84097   90.627386
-#> d_V        11.72131703   9656.15855  266.487127
-#> d_KA       38.85137516     64.78096    2.947285
-#> SIGMA[1,1] 64.78095548 192840.20092 6659.569867
-#> SIGMA[2,2]  2.94728469   6659.56987  475.500111
-#> 
-#> $rse
-#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
-#>   5.096246   3.031164  14.260384  29.761226  36.681388  26.748640  32.011719 
-#> SIGMA[2,2] 
-#>  25.637971
-
-
-

Shrinkage -

-

The full code for this example is available in -“ex.13.shrinkage.R”.

-

-

To evaluate the estimation quality of the individual random effects -in the model (the b’s) we use the function shrinkage().

-
-shrinkage(poped.db)
-#> # A tibble: 3 × 5
-#>    d_KA   d_V `D[3,3]` type       group
-#>   <dbl> <dbl>    <dbl> <chr>      <chr>
-#> 1 0.504 0.367    0.424 shrink_var grp_1
-#> 2 0.295 0.205    0.241 shrink_sd  grp_1
-#> 3 0.710 0.303    0.206 se         grp_1
-

The output shows us the expected shrinkage on the variance scale -(\(shrink_{var}=1-var(b_j)/D(j,j)\)) -and on the standard deviation scale (\(shrink_{sd}=1-sd(b_j)/sqrt(D(j,j))\)), as -well as the standard errors of the \(b_j\) estimates.

-
-
-

Further examples -

-

Available in PopED, but not shown in examples:

-
    -
  • Espresso design
  • -
  • Handling BLQ data
    -
  • -
  • Irregular dosing more complex: e.g. switching between s.c. and i.v. -within one arm.
  • -
  • Constraining the optimization to different allowed sampling times -for each group
    -
  • -
  • Constraining the optimization to different allowed sampling times -for each response
  • -
  • Keep some sampling time fixed (they will be automatically part of -the optimal design protocol)
    -
  • -
  • Handling derived outputs
  • -
-

To be implemented:

-
    -
  • Symbolic differentiation
  • -
-
-
-
-
    -
  1. Study 1 and 2 from table 2 in: Gibiansky, L., Gibiansky, -E., & Bauer, R. (2012). Comparison of Nonmem 7.2 estimation methods -and parallel processing efficiency on a target-mediated drug disposition -model. Journal of Pharmacokinetics and Pharmacodynamics, 39(1), 17–35. -https://doi.org/10.1007/s10928-011-9228-y↩︎

  2. -
  3. Nyberg, J., Bazzoli, C., Ogungbenro, K., Aliev, A., -Leonov, S., Duffull, S., Hooker, A.C. and Mentré, F. (2014). Methods and -software tools for design evaluation for population -pharmacokinetics-pharmacodynamics studies. British Journal of Clinical -Pharmacology, 79(1), 1–32. https://doi.org/10.1111/bcp.12352↩︎

  4. -
-
-
- - - -
- - - - -
- - - - - - - - diff --git a/docs/articles/examples_files/figure-html/simulate_IOV_with_IIV-1.png b/docs/articles/examples_files/figure-html/simulate_IOV_with_IIV-1.png deleted file mode 100644 index e2610f0c..00000000 Binary files a/docs/articles/examples_files/figure-html/simulate_IOV_with_IIV-1.png and /dev/null differ diff --git a/docs/articles/examples_files/figure-html/simulate_IOV_without_IIV-1.png b/docs/articles/examples_files/figure-html/simulate_IOV_without_IIV-1.png deleted file mode 100644 index 6c128a91..00000000 Binary files a/docs/articles/examples_files/figure-html/simulate_IOV_without_IIV-1.png and /dev/null differ diff --git a/docs/articles/examples_files/figure-html/simulate_ODE_model-1.png b/docs/articles/examples_files/figure-html/simulate_ODE_model-1.png deleted file mode 100644 index 27e3fb00..00000000 Binary files a/docs/articles/examples_files/figure-html/simulate_ODE_model-1.png and /dev/null differ diff --git a/docs/articles/examples_files/figure-html/simulate_adult-1.png b/docs/articles/examples_files/figure-html/simulate_adult-1.png deleted file mode 100644 index bb9e44be..00000000 Binary files a/docs/articles/examples_files/figure-html/simulate_adult-1.png and /dev/null differ diff --git a/docs/articles/examples_files/figure-html/simulate_different_dose_regimen-1.png b/docs/articles/examples_files/figure-html/simulate_different_dose_regimen-1.png deleted file mode 100644 index 6f89bfd9..00000000 Binary files a/docs/articles/examples_files/figure-html/simulate_different_dose_regimen-1.png and /dev/null differ diff --git a/docs/articles/examples_files/figure-html/simulate_multi-response_model-1.png b/docs/articles/examples_files/figure-html/simulate_multi-response_model-1.png deleted file mode 100644 index ed55be5a..00000000 Binary files a/docs/articles/examples_files/figure-html/simulate_multi-response_model-1.png and /dev/null differ diff --git a/docs/articles/examples_files/figure-html/simulate_pediatrics-1.png b/docs/articles/examples_files/figure-html/simulate_pediatrics-1.png deleted file mode 100644 index 2922876b..00000000 Binary files a/docs/articles/examples_files/figure-html/simulate_pediatrics-1.png and /dev/null differ diff --git a/docs/articles/examples_files/figure-html/simulate_with_cov_matrix-1.png b/docs/articles/examples_files/figure-html/simulate_with_cov_matrix-1.png deleted file mode 100644 index cc911103..00000000 Binary files a/docs/articles/examples_files/figure-html/simulate_with_cov_matrix-1.png and /dev/null differ diff --git a/docs/articles/examples_files/figure-html/unnamed-chunk-23-1.png b/docs/articles/examples_files/figure-html/unnamed-chunk-23-1.png deleted file mode 100644 index be6dddcf..00000000 Binary files a/docs/articles/examples_files/figure-html/unnamed-chunk-23-1.png and /dev/null differ diff --git a/docs/articles/examples_files/figure-html/unnamed-chunk-24-1.png b/docs/articles/examples_files/figure-html/unnamed-chunk-24-1.png deleted file mode 100644 index 472b39de..00000000 Binary files a/docs/articles/examples_files/figure-html/unnamed-chunk-24-1.png and /dev/null differ diff --git a/docs/articles/examples_files/figure-html/unnamed-chunk-56-1.png b/docs/articles/examples_files/figure-html/unnamed-chunk-56-1.png deleted file mode 100644 index a4da0d22..00000000 Binary files a/docs/articles/examples_files/figure-html/unnamed-chunk-56-1.png and /dev/null differ diff --git a/docs/articles/examples_files/figure-html/unnamed-chunk-57-1.png b/docs/articles/examples_files/figure-html/unnamed-chunk-57-1.png deleted file mode 100644 index a17ac32d..00000000 Binary files a/docs/articles/examples_files/figure-html/unnamed-chunk-57-1.png and /dev/null differ diff --git a/docs/articles/examples_files/figure-html/unnamed-chunk-61-1.png b/docs/articles/examples_files/figure-html/unnamed-chunk-61-1.png deleted file mode 100644 index be38fd25..00000000 Binary files a/docs/articles/examples_files/figure-html/unnamed-chunk-61-1.png and /dev/null differ diff --git a/docs/articles/examples_files/header-attrs-2.1/header-attrs.js b/docs/articles/examples_files/header-attrs-2.1/header-attrs.js deleted file mode 100644 index dd57d92e..00000000 --- a/docs/articles/examples_files/header-attrs-2.1/header-attrs.js +++ /dev/null @@ -1,12 +0,0 @@ -// Pandoc 2.9 adds attributes on both header and div. We remove the former (to -// be compatible with the behavior of Pandoc < 2.8). -document.addEventListener('DOMContentLoaded', function(e) { - var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); - var i, h, a; - for (i = 0; i < hs.length; i++) { - h = hs[i]; - if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 - a = h.attributes; - while (a.length > 0) h.removeAttribute(a[0].name); - } -}); diff --git a/docs/articles/examples_files/header-attrs-2.2/header-attrs.js b/docs/articles/examples_files/header-attrs-2.2/header-attrs.js deleted file mode 100644 index dd57d92e..00000000 --- a/docs/articles/examples_files/header-attrs-2.2/header-attrs.js +++ /dev/null @@ -1,12 +0,0 @@ -// Pandoc 2.9 adds attributes on both header and div. We remove the former (to -// be compatible with the behavior of Pandoc < 2.8). -document.addEventListener('DOMContentLoaded', function(e) { - var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); - var i, h, a; - for (i = 0; i < hs.length; i++) { - h = hs[i]; - if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 - a = h.attributes; - while (a.length > 0) h.removeAttribute(a[0].name); - } -}); diff --git a/docs/articles/examples_files/header-attrs-2.8/header-attrs.js b/docs/articles/examples_files/header-attrs-2.8/header-attrs.js deleted file mode 100644 index dd57d92e..00000000 --- a/docs/articles/examples_files/header-attrs-2.8/header-attrs.js +++ /dev/null @@ -1,12 +0,0 @@ -// Pandoc 2.9 adds attributes on both header and div. We remove the former (to -// be compatible with the behavior of Pandoc < 2.8). -document.addEventListener('DOMContentLoaded', function(e) { - var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); - var i, h, a; - for (i = 0; i < hs.length; i++) { - h = hs[i]; - if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 - a = h.attributes; - while (a.length > 0) h.removeAttribute(a[0].name); - } -}); diff --git a/docs/articles/handling_LOQ.html b/docs/articles/handling_LOQ.html deleted file mode 100644 index de413d8c..00000000 --- a/docs/articles/handling_LOQ.html +++ /dev/null @@ -1,972 +0,0 @@ - - - - - - - -Optimal design with LOQ data in PopED • PopED - - - - - - - - - - - - - - - - - - - -
-
- - - - -
-
-
- - - - -
-library(PopED)
-packageVersion("PopED")
-#> [1] '0.6.0.9002'
-
-

Define a model -

-

Here we define, as an example, a one-compartment pharmacokinetic -model with linear absorption (analytic solution) in PopED (Nyberg et al. -2012).

-
-ff <- function(model_switch,xt,parameters,poped.db){
-  with(as.list(parameters),{
-    y=xt
-    y=(DOSE*KA/(V*(KA-CL/V)))*(exp(-CL/V*xt)-exp(-KA*xt))
-    return(list(y=y,poped.db=poped.db))
-  })}
-

Next we define the parameters of this function. DOSEis -defined as a covariate (in vector a) so that we can -optimize the value later.

-
-sfg <- function(x,a,bpop,b,bocc){
-  parameters=c( CL=bpop[1]*exp(b[1]),
-                V=bpop[2]*exp(b[2]),
-                KA=bpop[3]*exp(b[3]),
-                DOSE=a[1])
-}
-

We will use an additive and proportional residual unexplained -variability (RUV) model, predefined in PopED as the function -feps.add.prop.

-
-
-

Define an initial design and design space -

-

Now we define the model parameter values, the initial design and -design space for optimization.

-

We define model parameters similar to the Warfarin example from the -software comparison in Nyberg et al. (2015) and an arbitrary design of two -groups of 20 individuals.

-
-poped_db <- 
-  create.poped.database(
-    ff_fun=ff,
-    fg_fun=sfg,
-    fError_fun=feps.add.prop,
-    bpop=c(CL=0.15, V=8, KA=1.0), 
-    d=c(CL=0.07, V=0.02, KA=0.6), 
-    sigma=c(prop=0.01,add=0.25),
-    groupsize=32,
-    xt=c( 0.5,3,50,120),
-    discrete_xt = list(c(0.5,1:120)),
-    minxt=0,
-    maxxt=120,
-    a=70,
-    mina=0,
-    maxa=100)
-                                
-
-
-

Simulation -

-

First it may make sense to check your model and design to make sure -you get what you expect when simulating data. Here we plot the model -typical values for the two groups:

-
-plot_model_prediction(poped_db, model_num_points = 500,facet_scales = "free",PI=T)
-

-
-
-

Design evaluation -

-

Next, we evaluate the initial design. We see that the relative -standard error of the parameters (in percent) are relatively well -estimated with this design except for the proportional RUV.

-
-eval_full <- evaluate_design(poped_db)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Expected parameter RSE (in %) for the initial design. -
- -RSE -
-CL - -5 -
-V - -4 -
-KA - -15 -
-d_CL - -34 -
-d_V - -70 -
-d_KA - -28 -
-sig_prop - -89 -
-sig_add - -36 -
-
-
-

LOQ handling -

-

We assume that the LOQ level is at 2 concentration units.

-
-library(ggplot2)
-plot_model_prediction(poped_db, model_num_points = 500,facet_scales = "free",PI=T) + 
-  geom_hline(yintercept = 2,color="red",linetype="dotted")
-

-

We use optimization criteria based on the D6 -(loq_method=1 which is the default) and D2 -(loq_method=2) methods from Vong et -al. (2012). For the D6 method, which -has been shown to be a better method in comparison to SSE studies, we -have updated the method to only investigate points where the 95% PI -overlaps LOQ, otherwise we set the design point to either no information -or full information. Further we filter out situations with very low -probabilities (loq_prob_limit = 0.001). Both the CI% and -the low probability limit can be specified in the calculation (default -values are loq_PI_conf_level = 0.95 and -loq_prob_limit = 0.001). In this way we can get the D6 -method to compute in reasonable time-frames even for larger number of -design samples.

-

Here we can evaluate the design with both methods and test the speed -of computation. We see that D6 is significantly slower than D2 (but D6 -should be a more accurate representation of the RSE expected using M3 -estimation methods).

-
-set.seed(1234)
-e_time_D6 <- system.time(
-  eval_D6 <- evaluate_design(poped_db,loq=2)
-)
-
-e_time_D2 <- system.time(
-  eval_D2 <- evaluate_design(poped_db,loq=2, loq_method=2)
-)
-
-cat("D6 evaluation time: ",e_time_D6[1],"\n" )
-cat("D2 evaluation time: ",e_time_D2[1],"\n" )
-#> D6 evaluation time:  0.174 
-#> D2 evaluation time:  0.06
-

The D2 nmethod is the same as removing the last data point

-
-poped_db_2 <- create.poped.database(
-    ff_fun=ff,
-    fg_fun=sfg,
-    fError_fun=feps.add.prop,
-    bpop=c(CL=0.15, V=8, KA=1.0), 
-    d=c(CL=0.07, V=0.02, KA=0.6), 
-    sigma=c(prop=0.01,add=0.25),
-    groupsize=32,
-    xt=c( 0.5,3,50),
-    discrete_xt = list(c(0.5,1:120)),
-    minxt=0,
-    maxxt=120,
-    a=70,
-    mina=0,
-    maxa=100)
-eval_red <- evaluate_design(poped_db_2)
-testthat::expect_equal(eval_red$ofv,eval_D2$ofv)
-testthat::expect_equal(eval_red$rse,eval_D2$rse)
-

Predicted parameter uncertainty for the three methods is shown below. -We see that the uncertainty is generally higher with the LOQ evaluations -(as expected). We also see that because the D2 method ignores data that -is below LOQ (the last observation in the design), then the predictions -of uncertainty are significantly larger.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-RSE (in %) for the initial design using different methods of handling -LOQ. -
-Parameter - -No LOQ - -D6 - -D2 -
-CL - -5 - -6 - -6 -
-V - -4 - -4 - -4 -
-KA - -15 - -17 - -15 -
-d_CL - -34 - -50 - -498 -
-d_V - -70 - -109 - -428 -
-d_KA - -28 - -33 - -113 -
-sig_prop - -89 - -161 - -1444 -
-sig_add - -36 - -118 - -2127 -
-
-

ULOQ handling -

-

If needed we can also handle upper limits of quantification. Lets -assume we have an ULOQ at 7 units in addition to the LLOQ of 2 -units:

-
-library(ggplot2)
-plot_model_prediction(poped_db, model_num_points = 500,facet_scales = "free",
-                      PI=T, PI_alpha = 0.1) + 
-  geom_hline(yintercept = 2,color="red",linetype="dotted") + 
-  geom_hline(yintercept = 7,color="blue",linetype="dotted")
-

-
-eval_ul_D6 <-evaluate_design(poped_db,
-                loq=2,
-                uloq=7)
-
-eval_ul_D2 <- evaluate_design(poped_db,
-                                loq=2,
-                                loq_method=2,
-                                uloq=7,
-                                uloq_method=2)
-#> Problems inverting the matrix. Results could be misleading.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-RSE (in %) for the initial design using different methods of handling -LOQ and ULOQ. -
-Parameter - -No LOQ - -D6 (only LLOQ) - -D2 (only LLOQ) - -D6 (ULOQ and LLOQ) - -D2 (ULOQ and LLOQ) -
-CL - -5 - -6 - -6 - -6 - -6 -
-V - -4 - -4 - -4 - -8 - -0 -
-KA - -15 - -17 - -15 - -21 - -14 -
-d_CL - -34 - -50 - -498 - -59 - -276 -
-d_V - -70 - -109 - -428 - -203 - -1743 -
-d_KA - -28 - -33 - -113 - -35 - -55 -
-sig_prop - -89 - -161 - -1444 - -297 - -1645 -
-sig_add - -36 - -118 - -2127 - -122 - -6 -
-
-
-
-

Design optimization -

-

We can then optimize the design using the different methods of -computing the FIM. Here we optimize only using lower LOQ.

-
-optim_D6 <- poped_optim(poped_db, opt_xt = TRUE,
-                        parallel=T,
-                        loq=2)
-
-optim_D2 <- poped_optim(poped_db, opt_xt = TRUE,
-                        parallel=T,
-                        loq=2,
-                        loq_method=2)
-
-optim_full <- poped_optim(poped_db, opt_xt = TRUE,
-                        parallel=T)
-All designs together in one plot show how the different handling of BLQ -data results in different optimal designs. -
-Design points for the apraoch ignoring LOQ, using the D2 method, and using the D6 method

-Design points for the apraoch ignoring LOQ, using the D2 method, and -using the D6 method -

-
-

Predictions using the D6 method from each of the optimizations shows -the expected %RSE of the parameters if each design is used and the LOQ -is at 2 concentration units. We see that D2 may be a reasonable strategy -to optimize designs that are “good enough” if the D6 method is too slow -for optimization.

-
-optim_full_D6<- with(optim_full, 
-  evaluate_design(poped.db,
-                  loq=2))
-
-optim_D2_D6<- with(optim_D2, 
-  evaluate_design(poped.db,
-                  loq=2))
-
-optim_D6_D6<- with(optim_D6, 
-  evaluate_design(poped.db,
-                  loq=2))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-RSE (in %) for the optimized designs evaluated using the D6 method. -
-Parameter - -No LOQ - -D6 - -D2 -
-CL - -7 - -5 - -6 -
-V - -4 - -3 - -3 -
-KA - -16 - -17 - -16 -
-d_CL - -67 - -34 - -43 -
-d_V - -58 - -54 - -52 -
-d_KA - -30 - -39 - -30 -
-sig_prop - -114 - -96 - -93 -
-sig_add - -152 - -60 - -92 -
-
-
-

Version information -

-
-sessionInfo()
-#> R version 4.3.2 (2023-10-31)
-#> Platform: aarch64-apple-darwin20 (64-bit)
-#> Running under: macOS Ventura 13.6.1
-#> 
-#> Matrix products: default
-#> BLAS:   /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib 
-#> LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0
-#> 
-#> locale:
-#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
-#> 
-#> time zone: Europe/Stockholm
-#> tzcode source: internal
-#> 
-#> attached base packages:
-#> [1] stats     graphics  grDevices utils     datasets  methods   base     
-#> 
-#> other attached packages:
-#> [1] kableExtra_1.3.4 knitr_1.45       ggplot2_3.4.4    PopED_0.6.0.9002
-#> [5] testthat_3.2.0  
-#> 
-#> loaded via a namespace (and not attached):
-#>  [1] gtable_0.3.4      xfun_0.41         bslib_0.5.1       htmlwidgets_1.6.2
-#>  [5] devtools_2.4.5    remotes_2.4.2.1   processx_3.8.2    callr_3.7.3      
-#>  [9] vctrs_0.6.4       tools_4.3.2       ps_1.7.5          generics_0.1.3   
-#> [13] tibble_3.2.1      fansi_1.0.5       highr_0.10        pkgconfig_2.0.3  
-#> [17] desc_1.4.2        webshot_0.5.5     lifecycle_1.0.3   farver_2.1.1     
-#> [21] compiler_4.3.2    stringr_1.5.0     brio_1.1.3        textshaping_0.3.7
-#> [25] munsell_0.5.0     codetools_0.2-19  httpuv_1.6.12     htmltools_0.5.7  
-#> [29] usethis_2.2.2     sass_0.4.7        yaml_2.3.7        later_1.3.1      
-#> [33] pkgdown_2.0.7     pillar_1.9.0      crayon_1.5.2      jquerylib_0.1.4  
-#> [37] urlchecker_1.0.1  MASS_7.3-60       ellipsis_0.3.2    cachem_1.0.8     
-#> [41] sessioninfo_1.2.2 boot_1.3-28.1     mime_0.12         gtools_3.9.4     
-#> [45] rvest_1.0.3       tidyselect_1.2.0  digest_0.6.33     mvtnorm_1.2-3    
-#> [49] stringi_1.7.12    dplyr_1.1.3       purrr_1.0.2       bookdown_0.36    
-#> [53] labeling_0.4.3    rprojroot_2.0.3   fastmap_1.1.1     grid_4.3.2       
-#> [57] colorspace_2.1-0  cli_3.6.1         magrittr_2.0.3    pkgbuild_1.4.2   
-#> [61] utf8_1.2.4        withr_2.5.2       prettyunits_1.2.0 scales_1.2.1     
-#> [65] promises_1.2.1    httr_1.4.7        rmarkdown_2.25    ragg_1.2.6       
-#> [69] memoise_2.0.1     shiny_1.7.5.1     evaluate_0.23     viridisLite_0.4.2
-#> [73] miniUI_0.1.1.1    profvis_0.3.8     rlang_1.1.1       Rcpp_1.0.11      
-#> [77] xtable_1.8-4      glue_1.6.2        xml2_1.3.5        pkgload_1.3.3    
-#> [81] svglite_2.1.2     rstudioapi_0.15.0 jsonlite_1.8.7    R6_2.5.1         
-#> [85] systemfonts_1.0.5 fs_1.6.3
-
-
-

References -

-
-
-Nyberg, Joakim, Caroline Bazzoli, Kay Ogungbenro, Alexander Aliev, -Sergei Leonov, Stephen Duffull, Andrew C Hooker, and France Mentré. -2015. Methods and software tools for design -evaluation in population pharmacokinetics-pharmacodynamics -studies.” British Journal of Clinical -Pharmacology 79 (1): 6–17. https://doi.org/10.1111/bcp.12352. -
-
-Nyberg, Joakim, Sebastian Ueckert, Eric A. Strömberg, Stefanie Hennig, -Mats O. Karlsson, and Andrew C. Hooker. 2012. PopED: An extended, parallelized, nonlinear mixed effects -models optimal design tool.” Computer Methods and -Programs in Biomedicine 108 (2): 789–805. https://doi.org/10.1016/j.cmpb.2012.05.005. -
-
-Vong, Camille, Sebastian Ueckert, Joakim Nyberg, and Andrew C. Hooker. -2012. “Handling Below Limit of Quantification Data in Optimal -Trial Design.” PAGE, Abstracts of the Annual Meeting of the -Population Approach Group in Europe. https://www.page-meeting.org/?abstract=2578. -
-
-
-
- - - -
- - - - -
- - - - - - - - diff --git a/docs/articles/handling_LOQ_files/figure-html/simulate_without_BSV-1.png b/docs/articles/handling_LOQ_files/figure-html/simulate_without_BSV-1.png deleted file mode 100644 index 436b7495..00000000 Binary files a/docs/articles/handling_LOQ_files/figure-html/simulate_without_BSV-1.png and /dev/null differ diff --git a/docs/articles/handling_LOQ_files/figure-html/unnamed-chunk-10-1.png b/docs/articles/handling_LOQ_files/figure-html/unnamed-chunk-10-1.png deleted file mode 100644 index 842e1600..00000000 Binary files a/docs/articles/handling_LOQ_files/figure-html/unnamed-chunk-10-1.png and /dev/null differ diff --git a/docs/articles/handling_LOQ_files/figure-html/unnamed-chunk-16-1.png b/docs/articles/handling_LOQ_files/figure-html/unnamed-chunk-16-1.png deleted file mode 100644 index 3f89bc58..00000000 Binary files a/docs/articles/handling_LOQ_files/figure-html/unnamed-chunk-16-1.png and /dev/null differ diff --git a/docs/articles/handling_LOQ_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/handling_LOQ_files/figure-html/unnamed-chunk-6-1.png deleted file mode 100644 index 0fd0689d..00000000 Binary files a/docs/articles/handling_LOQ_files/figure-html/unnamed-chunk-6-1.png and /dev/null differ diff --git a/docs/articles/handling_LOQ_files/header-attrs-2.2/header-attrs.js b/docs/articles/handling_LOQ_files/header-attrs-2.2/header-attrs.js deleted file mode 100644 index dd57d92e..00000000 --- a/docs/articles/handling_LOQ_files/header-attrs-2.2/header-attrs.js +++ /dev/null @@ -1,12 +0,0 @@ -// Pandoc 2.9 adds attributes on both header and div. We remove the former (to -// be compatible with the behavior of Pandoc < 2.8). -document.addEventListener('DOMContentLoaded', function(e) { - var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); - var i, h, a; - for (i = 0; i < hs.length; i++) { - h = hs[i]; - if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 - a = h.attributes; - while (a.length > 0) h.removeAttribute(a[0].name); - } -}); diff --git a/docs/articles/handling_LOQ_files/header-attrs-2.8/header-attrs.js b/docs/articles/handling_LOQ_files/header-attrs-2.8/header-attrs.js deleted file mode 100644 index dd57d92e..00000000 --- a/docs/articles/handling_LOQ_files/header-attrs-2.8/header-attrs.js +++ /dev/null @@ -1,12 +0,0 @@ -// Pandoc 2.9 adds attributes on both header and div. We remove the former (to -// be compatible with the behavior of Pandoc < 2.8). -document.addEventListener('DOMContentLoaded', function(e) { - var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); - var i, h, a; - for (i = 0; i < hs.length; i++) { - h = hs[i]; - if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 - a = h.attributes; - while (a.length > 0) h.removeAttribute(a[0].name); - } -}); diff --git a/docs/articles/handling_LOQ_files/kePrint-0.0.1/kePrint.js b/docs/articles/handling_LOQ_files/kePrint-0.0.1/kePrint.js deleted file mode 100644 index e6fbbfc4..00000000 --- a/docs/articles/handling_LOQ_files/kePrint-0.0.1/kePrint.js +++ /dev/null @@ -1,8 +0,0 @@ -$(document).ready(function(){ - if (typeof $('[data-toggle="tooltip"]').tooltip === 'function') { - $('[data-toggle="tooltip"]').tooltip(); - } - if ($('[data-toggle="popover"]').popover === 'function') { - $('[data-toggle="popover"]').popover(); - } -}); diff --git a/docs/articles/handling_LOQ_files/lightable-0.0.1/lightable.css b/docs/articles/handling_LOQ_files/lightable-0.0.1/lightable.css deleted file mode 100644 index 3be3be90..00000000 --- a/docs/articles/handling_LOQ_files/lightable-0.0.1/lightable.css +++ /dev/null @@ -1,272 +0,0 @@ -/*! - * lightable v0.0.1 - * Copyright 2020 Hao Zhu - * Licensed under MIT (https://github.com/haozhu233/kableExtra/blob/master/LICENSE) - */ - -.lightable-minimal { - border-collapse: separate; - border-spacing: 16px 1px; - width: 100%; - margin-bottom: 10px; -} - -.lightable-minimal td { - margin-left: 5px; - margin-right: 5px; -} - -.lightable-minimal th { - margin-left: 5px; - margin-right: 5px; -} - -.lightable-minimal thead tr:last-child th { - border-bottom: 2px solid #00000050; - empty-cells: hide; - -} - -.lightable-minimal tbody tr:first-child td { - padding-top: 0.5em; -} - -.lightable-minimal.lightable-hover tbody tr:hover { - background-color: #f5f5f5; -} - -.lightable-minimal.lightable-striped tbody tr:nth-child(even) { - background-color: #f5f5f5; -} - -.lightable-classic { - border-top: 0.16em solid #111111; - border-bottom: 0.16em solid #111111; - width: 100%; - margin-bottom: 10px; - margin: 10px 5px; -} - -.lightable-classic tfoot tr td { - border: 0; -} - -.lightable-classic tfoot tr:first-child td { - border-top: 0.14em solid #111111; -} - -.lightable-classic caption { - color: #222222; -} - -.lightable-classic td { - padding-left: 5px; - padding-right: 5px; - color: #222222; -} - -.lightable-classic th { - padding-left: 5px; - padding-right: 5px; - font-weight: normal; - color: #222222; -} - -.lightable-classic thead tr:last-child th { - border-bottom: 0.10em solid #111111; -} - -.lightable-classic.lightable-hover tbody tr:hover { - background-color: #F9EEC1; -} - -.lightable-classic.lightable-striped tbody tr:nth-child(even) { - background-color: #f5f5f5; -} - -.lightable-classic-2 { - border-top: 3px double #111111; - border-bottom: 3px double #111111; - width: 100%; - margin-bottom: 10px; -} - -.lightable-classic-2 tfoot tr td { - border: 0; -} - -.lightable-classic-2 tfoot tr:first-child td { - border-top: 3px double #111111; -} - -.lightable-classic-2 caption { - color: #222222; -} - -.lightable-classic-2 td { - padding-left: 5px; - padding-right: 5px; - color: #222222; -} - -.lightable-classic-2 th { - padding-left: 5px; - padding-right: 5px; - font-weight: normal; - color: #222222; -} - -.lightable-classic-2 tbody tr:last-child td { - border-bottom: 3px double #111111; -} - -.lightable-classic-2 thead tr:last-child th { - border-bottom: 1px solid #111111; -} - -.lightable-classic-2.lightable-hover tbody tr:hover { - background-color: #F9EEC1; -} - -.lightable-classic-2.lightable-striped tbody tr:nth-child(even) { - background-color: #f5f5f5; -} - -.lightable-material { - min-width: 100%; - white-space: nowrap; - table-layout: fixed; - font-family: Roboto, sans-serif; - border: 1px solid #EEE; - border-collapse: collapse; - margin-bottom: 10px; -} - -.lightable-material tfoot tr td { - border: 0; -} - -.lightable-material tfoot tr:first-child td { - border-top: 1px solid #EEE; -} - -.lightable-material th { - height: 56px; - padding-left: 16px; - padding-right: 16px; -} - -.lightable-material td { - height: 52px; - padding-left: 16px; - padding-right: 16px; - border-top: 1px solid #eeeeee; -} - -.lightable-material.lightable-hover tbody tr:hover { - background-color: #f5f5f5; -} - -.lightable-material.lightable-striped tbody tr:nth-child(even) { - background-color: #f5f5f5; -} - -.lightable-material.lightable-striped tbody td { - border: 0; -} - -.lightable-material.lightable-striped thead tr:last-child th { - border-bottom: 1px solid #ddd; -} - -.lightable-material-dark { - min-width: 100%; - white-space: nowrap; - table-layout: fixed; - font-family: Roboto, sans-serif; - border: 1px solid #FFFFFF12; - border-collapse: collapse; - margin-bottom: 10px; - background-color: #363640; -} - -.lightable-material-dark tfoot tr td { - border: 0; -} - -.lightable-material-dark tfoot tr:first-child td { - border-top: 1px solid #FFFFFF12; -} - -.lightable-material-dark th { - height: 56px; - padding-left: 16px; - padding-right: 16px; - color: #FFFFFF60; -} - -.lightable-material-dark td { - height: 52px; - padding-left: 16px; - padding-right: 16px; - color: #FFFFFF; - border-top: 1px solid #FFFFFF12; -} - -.lightable-material-dark.lightable-hover tbody tr:hover { - background-color: #FFFFFF12; -} - -.lightable-material-dark.lightable-striped tbody tr:nth-child(even) { - background-color: #FFFFFF12; -} - -.lightable-material-dark.lightable-striped tbody td { - border: 0; -} - -.lightable-material-dark.lightable-striped thead tr:last-child th { - border-bottom: 1px solid #FFFFFF12; -} - -.lightable-paper { - width: 100%; - margin-bottom: 10px; - color: #444; -} - -.lightable-paper tfoot tr td { - border: 0; -} - -.lightable-paper tfoot tr:first-child td { - border-top: 1px solid #00000020; -} - -.lightable-paper thead tr:last-child th { - color: #666; - vertical-align: bottom; - border-bottom: 1px solid #00000020; - line-height: 1.15em; - padding: 10px 5px; -} - -.lightable-paper td { - vertical-align: middle; - border-bottom: 1px solid #00000010; - line-height: 1.15em; - padding: 7px 5px; -} - -.lightable-paper.lightable-hover tbody tr:hover { - background-color: #F9EEC1; -} - -.lightable-paper.lightable-striped tbody tr:nth-child(even) { - background-color: #00000008; -} - -.lightable-paper.lightable-striped tbody td { - border: 0; -} - diff --git a/docs/articles/index.html b/docs/articles/index.html deleted file mode 100644 index 1ed85106..00000000 --- a/docs/articles/index.html +++ /dev/null @@ -1,108 +0,0 @@ - -Articles • PopED - - -
-
- - - -
- -
- - -
- - - - - - - - diff --git a/docs/articles/intro-poped.R b/docs/articles/intro-poped.R deleted file mode 100644 index 097e4f5e..00000000 --- a/docs/articles/intro-poped.R +++ /dev/null @@ -1,111 +0,0 @@ -## ----eval=TRUE----------------------------------------------------------- -library(PopED) - -## ----include = FALSE----------------------------------------------------- -set.seed(1234) -knitr::opts_chunk$set(cache = FALSE) - -## ----struct_model-------------------------------------------------------- -ff <- function(model_switch,xt,parameters,poped.db){ - with(as.list(parameters),{ - N = floor(xt/TAU)+1 - y=(DOSE*Favail/V)*(KA/(KA - CL/V)) * - (exp(-CL/V * (xt - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - exp(-CL/V * TAU)) - - exp(-KA * (xt - (N - 1) * TAU)) * (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU))) - return(list( y=y,poped.db=poped.db)) - }) -} - -## ------------------------------------------------------------------------ -sfg <- function(x,a,bpop,b,bocc){ - parameters=c( V=bpop[1]*exp(b[1]), - KA=bpop[2]*exp(b[2]), - CL=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1], - TAU=a[2]) -} - -## ------------------------------------------------------------------------ -feps <- function(model_switch,xt,parameters,epsi,poped.db){ - returnArgs <- ff(model_switch,xt,parameters,poped.db) - y <- returnArgs[[1]] - poped.db <- returnArgs[[2]] - - y = y*(1+epsi[,1])+epsi[,2] - - return(list(y=y,poped.db=poped.db)) -} - -## ------------------------------------------------------------------------ -poped.db <- create.poped.database(ff_fun=ff, - fg_fun=sfg, - fError_fun=feps, - bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9), - notfixed_bpop=c(1,1,1,0), - d=c(V=0.09,KA=0.09,CL=0.25^2), - sigma=c(0.04,5e-6), - notfixed_sigma=c(1,0), - m=2, - groupsize=20, - a=list(c(DOSE=20,TAU=24),c(DOSE=40, TAU=24)), - maxa=c(DOSE=200,TAU=24), - mina=c(DOSE=0,TAU=24), - xt=c( 1,2,8,240,245), - minxt=c(0,0,0,240,240), - maxxt=c(10,10,10,248,248), - bUseGrouped_xt=TRUE) - -## ---- fig.width=6-------------------------------------------------------- -plot_model_prediction(poped.db, model_num_points = 500) - -## ----simulate_with_BSV, fig.width=6-------------------------------------- -plot_model_prediction(poped.db, model_num_points=500, IPRED=T) - -## ------------------------------------------------------------------------ -dat <- model_prediction(poped.db,DV=T) -head(dat,n=5);tail(dat,n=5) - -## ------------------------------------------------------------------------ -evaluate_design(poped.db) - -## ----optimize,message = FALSE,results='hide',cache=TRUE------------------ -output <- poped_optim(poped.db, opt_xt=T) - -## ---- fig.width=6-------------------------------------------------------- -summary(output) -plot_model_prediction(output$poped.db) - -## ----fig.width=6,fig.height=6,cache=TRUE--------------------------------- -plot_efficiency_of_windows(output$poped.db,xt_windows=0.5) - -## ---- message = FALSE,results='hide'------------------------------------- -poped.db.discrete <- create.poped.database(poped.db,discrete_xt = list(0:248)) - -output_discrete <- poped_optim(poped.db.discrete, opt_xt=T) - - -## ----fig.width=6--------------------------------------------------------- -summary(output_discrete) -plot_model_prediction(output_discrete$poped.db) - -## ----optimize_dose,message = FALSE,results='hide', eval=FALSE,cache=TRUE---- -# output_dose_opt <- poped_optim(output$poped.db, opt_xt=T, opt_a=T) - -## ------------------------------------------------------------------------ -crit_fcn <- function(poped.db,...){ - pred_df <- model_prediction(poped.db) - sum((pred_df[pred_df["Time"]==240,"PRED"] - c(0.2,0.35))^2) -} -crit_fcn(output$poped.db) - -## ----cost_optimization, message = FALSE,results='hide',cache=TRUE-------- -output_cost <- poped_optim(poped.db, opt_a =T, opt_xt = F, - ofv_fun=crit_fcn, - maximize = F) - -## ---- fig.width=6-------------------------------------------------------- -summary(output_cost) -get_rse(output_cost$FIM, output_cost$poped.db) -plot_model_prediction(output_cost$poped.db) - diff --git a/docs/articles/intro-poped.html b/docs/articles/intro-poped.html deleted file mode 100644 index def7670e..00000000 --- a/docs/articles/intro-poped.html +++ /dev/null @@ -1,647 +0,0 @@ - - - - - - - -Introduction to PopED • PopED - - - - - - - - - - - - - - - - - - - -
-
- - - - -
-
- - - - -

PopED computes optimal experimental designs for both population and -individual studies based on nonlinear mixed-effect models. Often this is -based on a computation of the Fisher Information Matrix (FIM).

-

To get started you need to define

-
    -
  • A model.
  • -
  • An initial design (and design space if you want to optimize)
  • -
  • The tasks to perform.
  • -
-

There are a number of functions to help you with these tasks. See -?poped for more information.

-

Below is an example to introduce the package. Several other examples -are available as r-scripts in the “examples” folder in the PopED -installation directory located at:

-
-system.file("examples", package="PopED")
-

You can view a list of the example files using the commands:

-
-ex_dir <- system.file("examples", package="PopED")
-list.files(ex_dir)
-

You can then open one of the examples (for example, -ex.1.a.PK.1.comp.oral.md.intro.R, is very similar to the -code found in this vignette) using the following code

-
-file_name <- "ex.1.a.PK.1.comp.oral.md.intro.R"
-ex_file <- system.file("examples",file_name,package="PopED")
-file.copy(ex_file,tempdir(),overwrite = T)
-file.edit(file.path(tempdir(),file_name))
-

In addition, there is another vignette called “Examples” that -explores the new features in each example.

-
-

Define a model -

-

Here we define a one-compartment pharmacokinetic model with linear -absorption using an analytical solution. In this case the solution is -applicable for both multiple and single dosing. Note that this function -is also predefined in PopED as ff.PK.1.comp.oral.md.CL (see -?ff.PK.1.comp.oral.md.CL for more information).

-
-library(PopED)
-packageVersion("PopED")
-#> [1] '0.6.0.9002'
-
-ff <- function(model_switch,xt,parameters,poped.db){
-  with(as.list(parameters),{
-    N = floor(xt/TAU)+1
-    y=(DOSE*Favail/V)*(KA/(KA - CL/V)) * 
-      (exp(-CL/V * (xt - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - exp(-CL/V * TAU)) - 
-         exp(-KA * (xt - (N - 1) * TAU)) * (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU)))  
-    return(list( y=y,poped.db=poped.db))
-  })
-}
-

Next we define the parameters of this function, in this case the -between-subject variability (BSV) for each parameter is log-normally -distributed (parameter Favail is assumed not to have BSV). -DOSE and TAU are defined as covariates (in -vector a) so that we can optimize their values later.

-
-sfg <- function(x,a,bpop,b,bocc){
-  parameters=c( V=bpop[1]*exp(b[1]),
-                KA=bpop[2]*exp(b[2]),
-                CL=bpop[3]*exp(b[3]),
-                Favail=bpop[4],
-                DOSE=a[1],
-                TAU=a[2])
-}
-

Now we define the residual unexplained variability (RUV) function, in -this case the RUV has both an additive and proportional component.

-
-feps <- function(model_switch,xt,parameters,epsi,poped.db){
-  returnArgs <- ff(model_switch,xt,parameters,poped.db) 
-  y <- returnArgs[[1]]
-  poped.db <- returnArgs[[2]]
- 
-  y = y*(1+epsi[,1])+epsi[,2]
-  
-  return(list(y=y,poped.db=poped.db)) 
-}
-
-
-

Create a PopED database -

-

We create a poped database to link the model defined above with a set -of model parameters, the initial design and design space for -optimization.

-

In this example, the parameter values are defined for the fixed -effects (bpop), the between-subject variability variances -(d) and the residual variability variances -(sigma). We also fix the parameter Favail -using notfixed_bpop, since we have only oral dosing and the -parameter is not identifiable. Fixing a parameter means that we assume -the parameter will not be estimated (and is know without uncertainty). -In addition, we fix the small additive RUV term, as this term is -reflecting the higher error expected at low concentration measurements -(limit of quantification measurements) and would typically be calculated -from analytical assay methods (for example, the standard deviation of -the parameter might be 20% of the limit of quantification).

-

For the initial design, we define two groups (m=2) of 20 -individuals (groupsize=20), with doses of 20 mg or 40 mg -every 24 hours (a). The initial design has 5 sample times -per individual (xt).

-

For the design space, which can be searched during optimization, we -define a potential dose range of between 0 and 200 mg (mina -and maxa), and a range of potential sample times between 0 -and 10 hours for the first three samples and between 240 and 248 hours -for the last two samples (minxt and maxxt). -Finally, we fix the two groups of subjects to have the same sample times -(bUseGrouped_xt=TRUE).

-
-poped.db <- create.poped.database(
-  # Model
-  ff_fun=ff,
-  fg_fun=sfg,
-  fError_fun=feps,
-  bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9), 
-  notfixed_bpop=c(1,1,1,0),
-  d=c(V=0.09,KA=0.09,CL=0.25^2), 
-  sigma=c(prop=0.04,add=5e-6),
-  notfixed_sigma=c(1,0),
-  
-  # Design
-  m=2,
-  groupsize=20,
-  a=list(c(DOSE=20,TAU=24),c(DOSE=40, TAU=24)),
-  maxa=c(DOSE=200,TAU=24),
-  mina=c(DOSE=0,TAU=24),
-  xt=c( 1,2,8,240,245),
-  
-  # Design space
-  minxt=c(0,0,0,240,240),
-  maxxt=c(10,10,10,248,248),
-  bUseGrouped_xt=TRUE)
-
-
-

Design simulation -

-

First it may make sense to check your model and design to make sure -you get what you expect when simulating data. Here we plot the model -typical values:

-
-plot_model_prediction(poped.db, model_num_points = 300)
-

-

Next, we plot the expected prediction interval (by default a 95% PI) -of the data taking into account the BSV and RUV using the option -PI=TRUE. This option makes predictions based on first-order -approximations to the model variance and a normality assumption of that -variance. Better (and slower) computations are possible with the -DV=T, IPRED=T and -groupsize_sim = some large number options.

-
-plot_model_prediction(poped.db, 
-                      PI=TRUE, 
-                      separate.groups=T, 
-                      model_num_points = 300, 
-                      sample.times = FALSE)
-

-

We can get these predictions numerically as well:

-
-dat <- model_prediction(poped.db,DV=TRUE)
-head(dat,n=5);tail(dat,n=5)
-#>   ID Time         DV      IPRED       PRED Group Model DOSE TAU
-#> 1  1    1 0.09659927 0.08034839 0.05325024     1     1   20  24
-#> 2  1    2 0.13172074 0.13415072 0.09204804     1     1   20  24
-#> 3  1    8 0.19502544 0.19134279 0.16409609     1     1   20  24
-#> 4  1  240 0.04847782 0.05881203 0.12671376     1     1   20  24
-#> 5  1  245 0.29770447 0.23457544 0.24980320     1     1   20  24
-#>     ID Time         DV     IPRED      PRED Group Model DOSE TAU
-#> 196 40    1 0.04411438 0.0583122 0.1065005     2     1   40  24
-#> 197 40    2 0.10599655 0.1039377 0.1840961     2     1   40  24
-#> 198 40    8 0.20262746 0.2206604 0.3281922     2     1   40  24
-#> 199 40  240 0.17506051 0.3788561 0.2534275     2     1   40  24
-#> 200 40  245 0.56558539 0.5183551 0.4996064     2     1   40  24
-
-
-

Design evaluation -

-

Next, we evaluate the initial design

-
-(ds1 <- evaluate_design(poped.db))
-#> $ofv
-#> [1] 39.309
-#> 
-#> $fim
-#>                    V          KA           CL        d_V       d_KA        d_CL
-#> V         0.05336692   -8.683963  -0.05863412   0.000000   0.000000    0.000000
-#> KA       -8.68396266 2999.851007 -14.43058560   0.000000   0.000000    0.000000
-#> CL       -0.05863412  -14.430586  37.15243290   0.000000   0.000000    0.000000
-#> d_V       0.00000000    0.000000   0.00000000 999.953587 312.240246    3.202847
-#> d_KA      0.00000000    0.000000   0.00000000 312.240246 439.412556    2.287838
-#> d_CL      0.00000000    0.000000   0.00000000   3.202847   2.287838 3412.005199
-#> sig_prop  0.00000000    0.000000   0.00000000 575.347261 638.581909 1182.325475
-#>            sig_prop
-#> V            0.0000
-#> KA           0.0000
-#> CL           0.0000
-#> d_V        575.3473
-#> d_KA       638.5819
-#> d_CL      1182.3255
-#> sig_prop 33864.3226
-#> 
-#> $rse
-#>         V        KA        CL       d_V      d_KA      d_CL  sig_prop 
-#>  8.215338 10.090955  4.400304 39.844763 60.655110 27.562541 13.865357
-

We see that the fixed-effect and residual variability parameters are -relatively well estimated with this design, but the between-subject -variability parameters are less well estimated.

-
-

Evaluate alternative design -

-

What about an alternative design with sparse sampling? For example, -what if each individual only has 3 time points at 1, 2 and 245 -hours:

-
-poped.db.new <- create.poped.database(
-  # Model
-  ff_fun=ff,
-  fg_fun=sfg,
-  fError_fun=feps,
-  bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9), 
-  notfixed_bpop=c(1,1,1,0),
-  d=c(V=0.09,KA=0.09,CL=0.25^2), 
-  sigma=c(prop=0.04,add=5e-6),
-  notfixed_sigma=c(1,0),
-  
-  # Design
-  m=2,
-  groupsize=20,
-  a=list(c(DOSE=20,TAU=24),c(DOSE=40, TAU=24)),
-  maxa=c(DOSE=200,TAU=24),
-  mina=c(DOSE=0,TAU=24),
-  xt=c( 1,2,245),
-                                      
-  # Design space
-  minxt=c(0,0,240),
-  maxxt=c(10,10,248),
-  bUseGrouped_xt=TRUE)
-
-(ds2 <- evaluate_design(poped.db.new))
-#> $ofv
-#> [1] 29.66484
-#> 
-#> $fim
-#>                     V         KA           CL        d_V       d_KA        d_CL
-#> V          0.04243232  -10.51432   0.05782431   0.000000   0.000000    0.000000
-#> KA       -10.51432135 2666.25466 -14.66678102   0.000000   0.000000    0.000000
-#> CL         0.05782431  -14.66678  21.59743298   0.000000   0.000000    0.000000
-#> d_V        0.00000000    0.00000   0.00000000 632.163776 457.737062    3.115099
-#> d_KA       0.00000000    0.00000   0.00000000 457.737062 347.115999    2.363458
-#> d_CL       0.00000000    0.00000   0.00000000   3.115099   2.363458 1153.026981
-#> sig_prop   0.00000000    0.00000   0.00000000 348.477101 262.369792 1979.231386
-#>            sig_prop
-#> V            0.0000
-#> KA           0.0000
-#> CL           0.0000
-#> d_V        348.4771
-#> d_KA       262.3698
-#> d_CL      1979.2314
-#> sig_prop 15617.8185
-#> 
-#> $rse
-#>          V         KA         CL        d_V       d_KA       d_CL   sig_prop 
-#>  44.120338  51.256239   5.748842 207.941540 280.689945  53.350716  22.795275
-
-
-

Comparison of designs -

-

The precision on CL is similar with the alternative design but the -other parameters are less well estimated.

-
-(design_eval <- round(data.frame("Design 1"=ds1$rse,"Design 2"=ds2$rse)))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Design.1Design.2
V844
KA1051
CL46
d_V40208
d_KA61281
d_CL2853
sig_prop1423
-

Comparing the objective function value (OFV), we see that the -alternative design (less samples per subject) has a smaller OFV -(=worse). We can compare the two OFVs using efficiency, which tells us -the proportion extra individuals that are needed in the alternative -design to have the same information content as the original design -(around 4 times more individuals than are currently in the design).

-
-efficiency(ds2$ofv,ds1$ofv,poped.db)
-#> [1] 3.965919
-#> attr(,"description")
-#> [1] "(exp(ofv_final) / exp(ofv_init))^(1/n_parameters)"
-
-
-
-

Design optimization -

-

Now we can optimize the sample times of the original design by -maximizing the OFV1.

-
-output <- poped_optim(poped.db, opt_xt=TRUE)
-
-summary(output)
-#> ===============================================================================
-#> FINAL RESULTS
-#> Optimized Sampling Schedule
-#> Group 1: 0.4574     10     10    240  240.9
-#> Group 2: 0.4574     10     10    240  240.9
-#> 
-#> OFV = 40.5277
-#> 
-#> Efficiency: 
-#>   ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.1902
-#> 
-#> Expected relative standard error
-#> (%RSE, rounded to nearest integer):
-#>    Parameter   Values   RSE_0   RSE
-#>            V     72.8       8     6
-#>           KA     0.25      10     8
-#>           CL     3.75       4     4
-#>          d_V     0.09      40    33
-#>         d_KA     0.09      61    50
-#>         d_CL   0.0625      28    26
-#>     sig_prop     0.04      14    15
-#> 
-#> Total running time: 11.41 seconds
-plot_model_prediction(output$poped.db)
-

-

We see that there are four distinct sample times for this design. -This means that for this model, with these exact parameter values, that -the most information from the study to inform the parameter estimation -is with these sample times.

-
-

Examine efficiency of sampling windows -

-

Of course, this means that there are multiple samples at some of -these time points. We can explore a more practical design by looking at -the loss of efficiency if we spread out sample times in a uniform -distribution around these optimal points (\(\pm 30\) minutes).

-
-plot_efficiency_of_windows(output$poped.db,xt_windows=0.5)
-

-

Here we see the efficiency (\((|FIM_{optimized}|/|FIM_{initial}|)^{1/npar}\)) -drops below 80% in some cases, which is mostly caused by an increase in -the parameter uncertainty of the BSV parameter on absorption (om_KA). -Smaller windows or different windowing on different samples might be -needed. To investigate see ?plot_efficiency_of_windows.

-
-
-

Optimize over a discrete design space -

-

In the previous example we optimized over a continuous design space -(sample times could be optimized to be any value between a lower and an -upper limit). We could also limit the search to only “allowed” values, -for example, only samples taken on the hour are allowed.

-
-poped.db.discrete <- create.poped.database(poped.db,discrete_xt = list(c(0:10,240:248)))
-                                          
-output_discrete <- poped_optim(poped.db.discrete, opt_xt=TRUE)
-
-summary(output_discrete)
-#> ===============================================================================
-#> FINAL RESULTS
-#> Optimized Sampling Schedule
-#> Group 1:      1     10     10    240    241
-#> Group 2:      1     10     10    240    241
-#> 
-#> OFV = 40.3782
-#> 
-#> Efficiency: 
-#>   ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.165
-#> 
-#> Expected relative standard error
-#> (%RSE, rounded to nearest integer):
-#>    Parameter   Values   RSE_0   RSE
-#>            V     72.8       8     6
-#>           KA     0.25      10     8
-#>           CL     3.75       4     4
-#>          d_V     0.09      40    32
-#>         d_KA     0.09      61    53
-#>         d_CL   0.0625      28    27
-#>     sig_prop     0.04      14    15
-#> 
-#> Total running time: 5.389 seconds
-plot_model_prediction(output_discrete$poped.db, model_num_points = 300)
-

-

Here we see that the optimization ran somewhat quicker, but gave a -less efficient design.

-
-
-

Optimize ‘Other’ design variables -

-

One could also optimize over dose, to see if a different dose could -help in parameter estimation .

-
-output_dose_opt <- poped_optim(output$poped.db, opt_xt=TRUE, opt_a=TRUE)
-

In this case the results are predictable … higher doses give -observations with somewhat lower absolute residual variability leading -to both groups at the highest allowed dose levels (200 mg in this -case).

-
-
-

Cost function to optimize dose -

-

Optimizing the dose of a study just to have better model parameter -estimates may be somewhat implausible. Instead, let’s use a cost -function to optimize dose based on some sort of target concentration … -perhaps typical population trough concentrations of 0.2 and 0.35 for the -two groups of patients at 240 hours.

-

First we define the criteria we use to optimize the doses, here a -least squares minimization.

-
-crit_fcn <- function(poped.db,...){
-  pred_df <- model_prediction(poped.db)
-  sum((pred_df[pred_df["Time"]==240,"PRED"] - c(0.2,0.35))^2)
-}
-crit_fcn(output$poped.db)
-#> [1] 0.01469712
-

Now we minimize the cost function

-
-output_cost <- poped_optim(poped.db, opt_a = TRUE, opt_xt = FALSE,
-                     ofv_fun=crit_fcn, 
-                     maximize = FALSE)
-
-summary(output_cost)
-#> ===============================================================================
-#> FINAL RESULTS
-#> 
-#> Optimized Covariates:
-#> Group 1: 31.5672 : 24
-#> Group 2: 55.2426 : 24
-#> 
-#> OFV = 6.09293e-15
-#> 
-#> Efficiency: 
-#>   (ofv_final / ofv_init) = 4.1457e-13
-#> 
-#> Expected relative standard error
-#> (%RSE, rounded to nearest integer):
-#>    Parameter   Values   RSE_0   RSE
-#>            V     72.8       8     8
-#>           KA     0.25      10    10
-#>           CL     3.75       4     4
-#>          d_V     0.09      40    40
-#>         d_KA     0.09      61    60
-#>         d_CL   0.0625      28    28
-#>     sig_prop     0.04      14    14
-#> 
-#> Total running time: 1.702 seconds
-

We see that the optimal doses are 31.6 and 55.2 for the two groups. -This leads to population trough concentrations of 0.2 and 0.35 for the -two groups of patients at 240 hours:

-
-library(ggplot2)
-plot_model_prediction(output_cost$poped.db, model_num_points = 300)+
-  coord_cartesian(xlim=c(230,250))
-

-
-
-
-
-
    -
  1. Tip: to make the optimization run faster use the option -parallel = TRUE in the poped_optim command.↩︎

  2. -
-
-
- - - -
- - - - -
- - - - - - - - diff --git a/docs/articles/intro-poped_files/figure-html/simulate_cost_optmization-1.png b/docs/articles/intro-poped_files/figure-html/simulate_cost_optmization-1.png deleted file mode 100644 index cb8625ec..00000000 Binary files a/docs/articles/intro-poped_files/figure-html/simulate_cost_optmization-1.png and /dev/null differ diff --git a/docs/articles/intro-poped_files/figure-html/simulate_discrete_optimization-1.png b/docs/articles/intro-poped_files/figure-html/simulate_discrete_optimization-1.png deleted file mode 100644 index 50cb5a72..00000000 Binary files a/docs/articles/intro-poped_files/figure-html/simulate_discrete_optimization-1.png and /dev/null differ diff --git a/docs/articles/intro-poped_files/figure-html/simulate_efficiency_windows-1.png b/docs/articles/intro-poped_files/figure-html/simulate_efficiency_windows-1.png deleted file mode 100644 index 3401bdbc..00000000 Binary files a/docs/articles/intro-poped_files/figure-html/simulate_efficiency_windows-1.png and /dev/null differ diff --git a/docs/articles/intro-poped_files/figure-html/simulate_optimal_design-1.png b/docs/articles/intro-poped_files/figure-html/simulate_optimal_design-1.png deleted file mode 100644 index 0b229834..00000000 Binary files a/docs/articles/intro-poped_files/figure-html/simulate_optimal_design-1.png and /dev/null differ diff --git a/docs/articles/intro-poped_files/figure-html/simulate_with_BSV-1.png b/docs/articles/intro-poped_files/figure-html/simulate_with_BSV-1.png deleted file mode 100644 index 7eb85411..00000000 Binary files a/docs/articles/intro-poped_files/figure-html/simulate_with_BSV-1.png and /dev/null differ diff --git a/docs/articles/intro-poped_files/figure-html/simulate_without_BSV-1.png b/docs/articles/intro-poped_files/figure-html/simulate_without_BSV-1.png deleted file mode 100644 index d70e92c9..00000000 Binary files a/docs/articles/intro-poped_files/figure-html/simulate_without_BSV-1.png and /dev/null differ diff --git a/docs/articles/intro-poped_files/figure-html/unnamed-chunk-16-1.png b/docs/articles/intro-poped_files/figure-html/unnamed-chunk-16-1.png deleted file mode 100644 index ac7e4f30..00000000 Binary files a/docs/articles/intro-poped_files/figure-html/unnamed-chunk-16-1.png and /dev/null differ diff --git a/docs/articles/intro-poped_files/header-attrs-2.1/header-attrs.js b/docs/articles/intro-poped_files/header-attrs-2.1/header-attrs.js deleted file mode 100644 index dd57d92e..00000000 --- a/docs/articles/intro-poped_files/header-attrs-2.1/header-attrs.js +++ /dev/null @@ -1,12 +0,0 @@ -// Pandoc 2.9 adds attributes on both header and div. We remove the former (to -// be compatible with the behavior of Pandoc < 2.8). -document.addEventListener('DOMContentLoaded', function(e) { - var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); - var i, h, a; - for (i = 0; i < hs.length; i++) { - h = hs[i]; - if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 - a = h.attributes; - while (a.length > 0) h.removeAttribute(a[0].name); - } -}); diff --git a/docs/articles/intro-poped_files/header-attrs-2.2/header-attrs.js b/docs/articles/intro-poped_files/header-attrs-2.2/header-attrs.js deleted file mode 100644 index dd57d92e..00000000 --- a/docs/articles/intro-poped_files/header-attrs-2.2/header-attrs.js +++ /dev/null @@ -1,12 +0,0 @@ -// Pandoc 2.9 adds attributes on both header and div. We remove the former (to -// be compatible with the behavior of Pandoc < 2.8). -document.addEventListener('DOMContentLoaded', function(e) { - var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); - var i, h, a; - for (i = 0; i < hs.length; i++) { - h = hs[i]; - if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 - a = h.attributes; - while (a.length > 0) h.removeAttribute(a[0].name); - } -}); diff --git a/docs/articles/intro-poped_files/header-attrs-2.8/header-attrs.js b/docs/articles/intro-poped_files/header-attrs-2.8/header-attrs.js deleted file mode 100644 index dd57d92e..00000000 --- a/docs/articles/intro-poped_files/header-attrs-2.8/header-attrs.js +++ /dev/null @@ -1,12 +0,0 @@ -// Pandoc 2.9 adds attributes on both header and div. We remove the former (to -// be compatible with the behavior of Pandoc < 2.8). -document.addEventListener('DOMContentLoaded', function(e) { - var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); - var i, h, a; - for (i = 0; i < hs.length; i++) { - h = hs[i]; - if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 - a = h.attributes; - while (a.length > 0) h.removeAttribute(a[0].name); - } -}); diff --git a/docs/articles/model_def_other_pkgs.html b/docs/articles/model_def_other_pkgs.html deleted file mode 100644 index 8102843f..00000000 --- a/docs/articles/model_def_other_pkgs.html +++ /dev/null @@ -1,947 +0,0 @@ - - - - - - - -Defining models for PopED using R based PKPD simulators • PopED - - - - - - - - - - - - - - - - - - - -
-
- - - - -
-
-
- - - - -
-

Introduction -

-

This is a simple example on how to couple PopED with external R based -PKPD simulation tools. Typically, these tools might be R packages that -can simulate from ordinary differential equation (ODE) based models. In -this document you will see how to couple PopED to models, defined with -ODEs, implemented using:

-
    -
  • deSolve (with native R ODE models)
  • -
  • deSolve (with compiled C ODE models)
  • -
  • deSolve (with compiled C++ ODE models using Rcpp)
  • -
  • PKPDsim
  • -
  • mrgsolve
  • -
  • rxode2
  • -
- - - - -
-
-

The model -

-

We will use a one-compartment with linear absorption population -pharmacokinetic (PK) model as an example (see below).

- - - - -

-

This model can be described with the following set of ODEs:

-

\[ - \begin{split} - \frac{dA_{0}}{dt} &= - k_{a} \cdot A_{0}\\ - \frac{dA_{1}}{dt} &=-(CL/V_1)\cdot A_1 + k_{a} \cdot A_{0} \\ - f(t) &= A_1/V_1 - \end{split} -\]

-

All compartment amounts are assumed to be zero at time zero (\(\boldsymbol{A}[t=0]=0\)). Inputs to the -system come in tablet form and are added to the amount in \(A_{0}\) according to

-

\[ - \text{Input}(t,D,t_D) = - \begin{cases} - D, &\text{if} \quad t = t_D \\ - 0, &\text{otherwise} - \end{cases} -\]

-

Parameter values are defined as:

-

\[ - \begin{split} - k_a &= \theta_{k_a} \cdot e^{\eta_{k_a}} \\ - CL &= \theta_{CL} \cdot e^{\eta_{CL}} \\ - V_1 &= \theta_{V_1} \cdot e^{\eta_{V_1}} \\ - \end{split} -\] where elements of the between subject variability (BSV), \(\eta_{j}\), vary across individuals and -come from normal distributions with means of zero and variances of \(\omega^2_{j}\).

-

The residual unexplained variability (RUV) model has a proportional -and additive component

-

\[ - y = f(t) \cdot (1+\varepsilon_{prop}) + \varepsilon_{add} -\]

-

elements of \(\boldsymbol{\varepsilon}_{j}\) vary accross -observations and come from normal distributions with means of zero and -variances of \(\sigma^2_{j}\).

-Parameter values are assumed to be the following: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Model parameter values. -
-Parameter - -Value -
-\(k_a\) - -0.2500 -
-CL - -3.7500 -
-\(V_1\) - -72.8000 -
-\(\omega^2_{k_a}\) - -0.0900 -
-\(\omega^2_{CL}\) - -0.0625 -
-\(\omega^2_{V_1}\) - -0.0900 -
-\(\sigma^2_{prop}\) - -0.0400 -
-\(\sigma^2_{add}\) - -0.0025 -
-
-
-

Model implementation -

-

Below we implement this model using a number of different methods. -For the ODE solvers, if possible, we set the tuning parameters to be the -same values (atol, rtol, etc.).

-
-

Analytic solution -

-

First we implement an analytic solution to the model in a function -that could be used in PopED. Here we assume a single dose -or multiple dosing with a dose interval of TAU time units. -The named vector parameters defines the values of -KA, CL, V, DOSE and -TAU used to compute the value of f (\(f(t)\) in at each time point in the vector -xt.

-
-ff_analytic <- function(model_switch,xt,parameters,poped.db){
-  with(as.list(parameters),{
-    y=xt
-    N = floor(xt/TAU)+1
-    f=(DOSE/V)*(KA/(KA - CL/V)) * 
-      (exp(-CL/V * (xt - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - exp(-CL/V * TAU)) - 
-         exp(-KA * (xt - (N - 1) * TAU)) * (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU)))  
-    return(list( f=f,poped.db=poped.db))
-  })
-}
-
-
-

ODE solution using deSolve -

-

The same model can be implemented using ODEs. Here the ODEs are -defined in deSolve:

-
-PK_1_comp_oral_ode <- function(Time, State, Pars){
-  with(as.list(c(State, Pars)), {    
-    dA1 <- -KA*A1
-    dA2 <- KA*A1 - (CL/V)*A2
-    return(list(c(dA1, dA2)))
-  })
-}
-

Then, just as in the analytic solution, the named vector -parameters defines the values of KA, -CL, V, DOSE and TAU -used to compute the value of \(f(t)\) -at each time point in the vector xt. The inputs to the -system dosing times need to be added as an input to the ODE system -(called events).

-
-ff_ode_desolve <- function(model_switch, xt, parameters, poped.db){
-  with(as.list(parameters),{
-    A_ini <- c(A1=0, A2=0)
-    
-    #Set up time points for the ODE
-    times_xt <- drop(xt)
-    times <- c(0,times_xt) ## add extra time for start of the experiment
-    dose_times = seq(from=0,to=max(times_xt),by=TAU)
-    times <- c(times,dose_times)
-    times <- sort(times) 
-    times <- unique(times) # remove duplicates
-    
-    eventdat <- data.frame(var = c("A1"), 
-                           time = dose_times,
-                           value = c(DOSE), method = c("add"))
-    
-    out <- ode(A_ini, times, PK_1_comp_oral_ode, parameters, 
-               events = list(data = eventdat),
-               atol=1e-8, rtol=1e-8,maxsteps=5000)
-    
-    # grab timepoint values
-    out = out[match(times_xt,out[,"time"]),]
-    
-    f = out[,"A2"]/V
-    
-    f=cbind(f) # must be a column matrix 
-    return(list(f=f,poped.db=poped.db))
-  })
-}
-
-
-

ODE solution using deSolve and compiled C code -

-

We can use compiled C code with deSolve to speed up computing -solutions to the ODEs. The C code is that need to be compiled looks like -this:

-
/* file one_comp_oral_CL.c */
-#include <R.h>
-static double parms[3];
-#define CL parms[0]
-#define V parms[1]
-#define KA parms[2]
-
-/* initializer  */
-void initmod(void (* odeparms)(int *, double *))
-{
-  int N=3;
-  odeparms(&N, parms);
-}
-
-/* Derivatives and 1 output variable */
-void derivs (int *neq, double *t, double *y, double *ydot,
-         double *yout, int *ip)
-{
-    
-  if (ip[0] <1) error("nout should be at least 1");
-    
-  ydot[0] = -KA*y[0];
-  ydot[1] = KA*y[0] - CL/V*y[1];
-  yout[0] = y[0]+y[1];
-}
-
-/* END file one_comp_oral_CL.c */
-

This code is available as a file in the PopED distribution, and is -compiled with the following commands:

-
-file.copy(system.file("examples/one_comp_oral_CL.c", package="PopED"),"./one_comp_oral_CL.c")
-#> [1] FALSE
-system('R CMD SHLIB one_comp_oral_CL.c')
-dyn.load(paste("one_comp_oral_CL", .Platform$dynlib.ext, sep = ""))
-

Again, just as in the analytic solution, the named vector -parameters defines the values of KA, -CL, V, DOSE and TAU -used to compute the value of \(f(t)\) -at each time point in the vector xt.

-
-ff_ode_desolve_c <- function(model_switch, xt, parameters, poped.db){
-  with(as.list(parameters),{
-    A_ini <- c(A1=0, A2=0)
-    
-    #Set up time points for the ODE
-    times_xt <- drop(xt)
-    times <- c(0,times_xt) ## add extra time for the start of the experiment
-    dose_times = seq(from=0,to=max(times_xt),by=TAU)
-    times <- c(times,dose_times)
-    times <- sort(times) 
-    times <- unique(times) # remove duplicates
-    
-    eventdat <- data.frame(var = c("A1"), 
-                           time = dose_times,
-                           value = c(DOSE), method = c("add"))
-    
-    out <- ode(A_ini, times, func = "derivs", 
-               parms = c(CL,V,KA), 
-               dllname = "one_comp_oral_CL",
-               initfunc = "initmod", nout = 1, 
-               outnames = "Sum",
-               events = list(data = eventdat),
-               atol=1e-8, rtol=1e-8,maxsteps=5000)
-
-    # grab timepoint values
-    out = out[match(times_xt,out[,"time"]),]
-    
-    y = out[, "A2"]/V
-    
-    y=cbind(y) # must be a column matrix 
-    return(list(y=y,poped.db=poped.db))
-  })
-}
-
-
-

ODE solution using deSolve and compiled C++ code (via Rcpp) -

-

Here we define the ODE system using inline C++ code via Rcpp

-
-cppFunction('List one_comp_oral_rcpp(double Time, NumericVector A, NumericVector Pars) {
-int n = A.size();
-NumericVector dA(n);
-
-double CL = Pars[0];
-double V = Pars[1];
-double KA = Pars[2];
-
-dA[0] = -KA*A[0];
-dA[1] = KA*A[0] - (CL/V)*A[1];
-return List::create(dA);
-}')
-
-ff_ode_desolve_rcpp <- function(model_switch, xt, p, poped.db){
-    A_ini <- c(A1=0, A2=0)
-    
-    #Set up time points for the ODE
-    times_xt <- drop(xt)
-    times <- c(0,times_xt) ## add extra time for start of integration
-    dose_times = seq(from=0,to=max(times_xt),by=p[["TAU"]])
-    times <- c(times,dose_times)
-    times <- sort(times) 
-    times <- unique(times) # remove duplicates
-    
-    eventdat <- data.frame(var = c("A1"), 
-                           time = dose_times,
-                           value = c(p[["DOSE"]]), method = c("add"))
-    
-    out <- ode(A_ini, times, 
-               one_comp_oral_rcpp, 
-               c(CL=p[["CL"]],V=p[["V"]], KA=p[["KA"]]), 
-               events = list(data = eventdat),
-               atol=1e-8, rtol=1e-8,maxsteps=5000)
-    
-    
-    # grab timepoint values for central comp
-    y = out[match(times_xt,out[,"time"]),"A2",drop=F]/p[["V"]]
-    
-    return(list(y=y,poped.db=poped.db))
-}
-
-
-

ODE solution using PKPDsim -

-

The same model written as a set of ODEs using PKPDsim:

-
-pk1cmtoral <- PKPDsim::new_ode_model("pk_1cmt_oral") # take from library
-ff_ode_pkpdsim <- function(model_switch, xt, p, poped.db){
-    #Set up time points for the ODE
-    times_xt <- drop(xt)  
-    dose_times <- seq(from=0,to=max(times_xt),by=p[["TAU"]])
-    times <- sort(unique(c(0,times_xt,dose_times)))
-
-    N = length(dose_times)
-    regimen = PKPDsim::new_regimen(amt=p[["DOSE"]],n=N,interval=p[["TAU"]])
-    design <- PKPDsim::sim(
-      ode = pk1cmtoral, 
-      parameters = c(CL=p[["CL"]],V=p[["V"]],KA=p[["KA"]]), 
-      regimen = regimen,
-      only_obs = TRUE,
-      t_obs = times,
-      checks = FALSE,
-      return_design = TRUE)
-    tmp <- PKPDsim::sim_core(sim_object = design, ode = pk1cmtoral)
-    y <- tmp$y
-    m_tmp <- match(round(times_xt,digits = 6),tmp[,"t"])
-    if(any(is.na(m_tmp))){
-      stop("can't find time points in solution\n", 
-           "try changing the digits argument in the match function")
-    } 
-    
-    y <- y[m_tmp]
-    return(list(y = y, poped.db = poped.db))
-}
-
-
-

ODE solution using mrgsolve -

-

The same model written as a set of ODEs using mrgsolve:

-
-code <- '
-$PARAM CL=3.75, V=72.8, KA=0.25
-$CMT DEPOT CENT
-$ODE
-dxdt_DEPOT = -KA*DEPOT;
-dxdt_CENT = KA*DEPOT - (CL/V)*CENT;
-$TABLE double CP  = CENT/V;
-$CAPTURE CP
-'
-

Compile and load the model with mcode

-
-moda <- mcode("optim", code, atol=1e-8, rtol=1e-8,maxsteps=5000)
-#> Building optim ... done.
-
-ff_ode_mrg <- function(model_switch, xt, p, poped.db){
-  times_xt <- drop(xt)  
-  dose_times <- seq(from=0,to=max(times_xt),by=p[["TAU"]])
-  time <- sort(unique(c(0,times_xt,dose_times)))
-  is.dose <- time %in% dose_times
-  
-  data <- 
-    tibble::tibble(ID = 1,
-                      time = time,
-                      amt = ifelse(is.dose,p[["DOSE"]], 0), 
-                      cmt = ifelse(is.dose, 1, 0), 
-                      evid = cmt,
-                      CL = p[["CL"]], V = p[["V"]], KA = p[["KA"]])
-  
-  out <- mrgsim_q(moda, data=data)
-  
-  y <-  out$CP
-  
-  y <- y[match(times_xt,out$time)]
-  
-  return(list(y=matrix(y,ncol=1),poped.db=poped.db))
-  
-}
-
-
-

ODE solution using RxODE -

-

The model written for RxODE:

-
-modrx <- rxode2({
-  d/dt(DEPOT) = -KA*DEPOT;
-  d/dt(CENT) = KA*DEPOT - (CL/V)*CENT;
-  CP=CENT/V;
-})
-
-ff_ode_rx <- function(model_switch, xt, p, poped.db){
-  times_xt <- drop(xt)
-  et(0,amt=p[["DOSE"]], ii=p[["TAU"]], until=max(times_xt)) %>%
-    et(times_xt) -> data
-  
-  out <- rxSolve(modrx, p, data, atol=1e-8, rtol=1e-8,maxsteps=5000,
-                 returnType="data.frame")
-  
-  y <-  out$CP[match(times_xt,out$time)]
-  
-  return(list(y=matrix(y,ncol=1),poped.db=poped.db))
-  
-}
-
-
-

Common model elements -

-

Other functions are used to define BSV and RUV.

-
-
-sfg <- function(x,a,bpop,b,bocc){
-  parameters=c( 
-    KA=bpop[1]*exp(b[1]),
-    CL=bpop[2]*exp(b[2]),
-    V=bpop[3]*exp(b[3]),
-    DOSE=a[1],
-    TAU=a[2])
-  return( parameters ) 
-}
-
-feps <- function(model_switch,xt,parameters,epsi,poped.db){
-  f <- do.call(poped.db$model$ff_pointer,list(model_switch,xt,parameters,poped.db))[[1]]
-  y = f*(1+epsi[,1])+epsi[,2]
-  return(list(y=y,poped.db=poped.db)) 
-}
-
-
-
-

Create PopED databases -

-

Next we define the model to use, the parameters of those models, the -intial design design and design space for any design calculation. Here -we create a number of databases that correspond to different model -implementations.

-

The initial design is a 2 group design, with doses of 20 mg or 40 mg -every 24 hours. Each group has the same sampling schedule, with 3 -samples in the first day of the study and 2 on the 10th day of the -study.

-
-poped_db_analytic <- create.poped.database(ff_fun =ff_analytic,
-                                  fg_fun =sfg,
-                                  fError_fun=feps,
-                                  bpop=c(KA=0.25,CL=3.75,V=72.8), 
-                                  d=c(KA=0.09,CL=0.25^2,V=0.09), 
-                                  sigma=c(prop=0.04,add=0.0025),
-                                  m=2,
-                                  groupsize=20,
-                                  xt=c( 1,2,8,240,245),
-                                  minxt=c(0,0,0,240,240),
-                                  maxxt=c(10,10,10,248,248),
-                                  bUseGrouped_xt=1,
-                                  a=cbind(DOSE=c(20,40),TAU=c(24,24)),
-                                  maxa=c(DOSE=200,TAU=24),
-                                  mina=c(DOSE=0,TAU=24))
-
-
-poped_db_ode_desolve <- create.poped.database(poped_db_analytic,ff_fun = ff_ode_desolve)
-poped_db_ode_desolve_c <- create.poped.database(poped_db_analytic,ff_fun = ff_ode_desolve_c)
-poped_db_ode_desolve_rcpp <- create.poped.database(poped_db_analytic,ff_fun = ff_ode_desolve_rcpp)
-poped_db_ode_pkpdsim <- create.poped.database(poped_db_analytic,ff_fun = ff_ode_pkpdsim)
-poped_db_ode_mrg <- create.poped.database(poped_db_analytic,ff_fun = ff_ode_mrg)
-poped_db_ode_rx <- create.poped.database(poped_db_analytic,ff_fun = ff_ode_rx)
-
-
-

Model predictions -

-

So are there difference in the model predictions between the -different implementations?

-

Here is a visual representation of the model predictions for this -study design, based on the analytic solution:

-
-plot_model_prediction(poped_db_analytic,model_num_points = 500,PI=T,separate.groups = T) 
-

-

We can compare the different predictions in this plot accross model -implementations. Here we see that the accuracy of the different methods -are within machine precision (or very small).

-
-pred_std <- model_prediction(poped_db_analytic,model_num_points = 500,include_sample_times = TRUE,PI = TRUE)
-
-pred_ode_desolve <- model_prediction(poped_db_ode_desolve,
-                                     model_num_points = 500,
-                                     include_sample_times = TRUE,
-                                     PI = TRUE)
-all.equal(pred_std,pred_ode_desolve)
-#> [1] TRUE
-
-pred_ode_desolve_c <- model_prediction(poped_db_ode_desolve_c,
-                                       model_num_points = 500,
-                                       include_sample_times = TRUE,
-                                       PI = TRUE)
-all.equal(pred_std,pred_ode_desolve_c)
-#> [1] TRUE
-
-pred_ode_desolve_rcpp <- model_prediction(poped_db_ode_desolve_rcpp,
-                                          model_num_points = 500,
-                                          include_sample_times = TRUE,
-                                          PI = TRUE)
-all.equal(pred_std,pred_ode_desolve_rcpp)
-#> [1] TRUE
-
-pred_ode_pkpdsim <- model_prediction(poped_db_ode_pkpdsim,
-                                     model_num_points = 500,
-                                     include_sample_times = TRUE,
-                                     PI = TRUE)
-all.equal(pred_std,pred_ode_pkpdsim)
-#> [1] "Component \"PI_l\": Mean relative difference: 1.998475e-08"
-
-pred_ode_mrg <- model_prediction(poped_db_ode_mrg,
-                                 model_num_points = 500,
-                                 include_sample_times = TRUE,
-                                 PI = TRUE)
-all.equal(pred_std,pred_ode_mrg)
-#> [1] TRUE
-
-pred_ode_rx <- model_prediction(poped_db_ode_rx,
-                                 model_num_points = 500,
-                                 include_sample_times = TRUE,
-                                 PI = TRUE)
-all.equal(pred_std,pred_ode_rx)
-#> [1] TRUE
-
-
-

Evaluate the design -

-

Here we compare the computation of the Fisher Information Matrix -(FIM). By comparing the \(ln(det(FIM))\) (the lnD-objective function -value, or ofv).

-
-(eval_std <- evaluate_design(poped_db_analytic))
-#> $ofv
-#> [1] 48.98804
-#> 
-#> $fim
-#>                   KA           CL           V       d_KA        d_CL        d_V
-#> KA       1695.742314 -11.73537527 -6.75450789    0.00000     0.00000    0.00000
-#> CL        -11.735375  29.99735715 -0.03288331    0.00000     0.00000    0.00000
-#> V          -6.754508  -0.03288331  0.04213359    0.00000     0.00000    0.00000
-#> d_KA        0.000000   0.00000000  0.00000000  147.24270     1.52226  192.23403
-#> d_CL        0.000000   0.00000000  0.00000000    1.52226  2254.55188    1.21987
-#> d_V         0.000000   0.00000000  0.00000000  192.23403     1.21987  634.42055
-#> sig_prop    0.000000   0.00000000  0.00000000  148.86724   844.57325  387.53816
-#> sig_add     0.000000   0.00000000  0.00000000 6555.68433 14391.88132 8669.58391
-#>             sig_prop     sig_add
-#> KA            0.0000       0.000
-#> CL            0.0000       0.000
-#> V             0.0000       0.000
-#> d_KA        148.8672    6555.684
-#> d_CL        844.5733   14391.881
-#> d_V         387.5382    8669.584
-#> sig_prop   7759.5374  110702.705
-#> sig_add  110702.7045 4436323.946
-#> 
-#> $rse
-#>         KA         CL          V       d_KA       d_CL        d_V   sig_prop 
-#>  16.285678   4.909749  11.209270 120.825798  34.448477  57.300408  36.104027 
-#>    sig_add 
-#>  24.339781
-

All the computations give very similar results:

-
-eval_ode_desolve <- evaluate_design(poped_db_ode_desolve) 
-all.equal(eval_std$ofv,eval_ode_desolve$ofv)
-#> [1] "Mean relative difference: 5.044611e-08"
-
-eval_ode_desolve_c <- evaluate_design(poped_db_ode_desolve_c) 
-all.equal(eval_std$ofv,eval_ode_desolve_c$ofv)
-#> [1] "Mean relative difference: 5.112116e-08"
-
-eval_ode_desolve_rccp <- evaluate_design(poped_db_ode_desolve_rcpp) 
-all.equal(eval_std$ofv,eval_ode_desolve_rccp$ofv)
-#> [1] "Mean relative difference: 5.112116e-08"
-
-eval_ode_pkpdsim <- evaluate_design(poped_db_ode_pkpdsim) 
-all.equal(eval_std$ofv,eval_ode_pkpdsim$ofv)
-#> [1] TRUE
-
-eval_ode_mrg <- evaluate_design(poped_db_ode_mrg) 
-all.equal(eval_std$ofv,eval_ode_mrg$ofv)
-#> [1] "Mean relative difference: 2.388152e-08"
-
-
-

Speed of FIM computation -

-

We can compare the speed of the computations. Analytic solutions are -fast, as expected, in this case more than 20 times faster than any of -the ODE methods. mrgsolve is the fastest of the ODE solvers in this -example. Note that much of the speed difference between mrgsolve, RxODE -and PKPDsim has been found to be due to the overhead from pre- and -post-processing of the simulation from ODE systems. Other ways of -handling the pre- and post-processing may speed up these -computations.

-
-library(microbenchmark)
-library(ggplot2)
-
-compare <- microbenchmark(
-  evaluate_design(poped_db_analytic),
-  evaluate_design(poped_db_ode_desolve),
-  evaluate_design(poped_db_ode_desolve_c),
-  evaluate_design(poped_db_ode_desolve_rcpp),
-  evaluate_design(poped_db_ode_pkpdsim),
-  evaluate_design(poped_db_ode_mrg),
-  evaluate_design(poped_db_ode_rx),
-  times = 100L)
-
-autoplot(compare)
-

-
-
-

Version information -

-
-devtools::session_info()
-#> ─ Session info ───────────────────────────────────────────────────────────────
-#>  setting  value
-#>  version  R version 4.3.2 (2023-10-31)
-#>  os       macOS Ventura 13.6.2
-#>  system   aarch64, darwin20
-#>  ui       X11
-#>  language en
-#>  collate  en_US.UTF-8
-#>  ctype    en_US.UTF-8
-#>  tz       Europe/Stockholm
-#>  date     2023-11-09
-#>  pandoc   3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)
-#> 
-#> ─ Packages ───────────────────────────────────────────────────────────────────
-#>  ! package       * version    date (UTC) lib source
-#>    backports       1.4.1      2021-12-13 [1] CRAN (R 4.3.0)
-#>    bookdown        0.36       2023-10-16 [1] CRAN (R 4.3.1)
-#>    boot            1.3-28.1   2022-11-22 [1] CRAN (R 4.3.2)
-#>    brio            1.1.3      2021-11-30 [1] CRAN (R 4.3.0)
-#>    bslib           0.5.1      2023-08-11 [1] CRAN (R 4.3.0)
-#>    cachem          1.0.8      2023-05-01 [1] CRAN (R 4.3.0)
-#>    callr           3.7.3      2022-11-02 [1] CRAN (R 4.3.0)
-#>    checkmate       2.3.0      2023-10-25 [1] CRAN (R 4.3.1)
-#>    cli             3.6.1      2023-03-23 [1] CRAN (R 4.3.0)
-#>    codetools       0.2-19     2023-02-01 [1] CRAN (R 4.3.2)
-#>    colorspace      2.1-0      2023-01-23 [1] CRAN (R 4.3.0)
-#>    crayon          1.5.2      2022-09-29 [1] CRAN (R 4.3.0)
-#>    data.table      1.14.8     2023-02-17 [1] CRAN (R 4.3.0)
-#>    desc            1.4.2      2022-09-08 [1] CRAN (R 4.3.0)
-#>    deSolve       * 1.38       2023-09-05 [1] CRAN (R 4.3.0)
-#>    devtools        2.4.5      2022-10-11 [1] CRAN (R 4.3.0)
-#>    digest          0.6.33     2023-07-07 [1] CRAN (R 4.3.0)
-#>    dparser         1.3.1-10   2023-03-16 [1] CRAN (R 4.3.0)
-#>    dplyr           1.1.3      2023-09-03 [1] CRAN (R 4.3.0)
-#>    ellipsis        0.3.2      2021-04-29 [1] CRAN (R 4.3.0)
-#>    evaluate        0.23       2023-11-01 [1] CRAN (R 4.3.1)
-#>    fansi           1.0.5      2023-10-08 [1] CRAN (R 4.3.1)
-#>    fastmap         1.1.1      2023-02-24 [1] CRAN (R 4.3.0)
-#>    fs              1.6.3      2023-07-20 [1] CRAN (R 4.3.0)
-#>    generics        0.1.3      2022-07-05 [1] CRAN (R 4.3.0)
-#>    ggplot2         3.4.4      2023-10-12 [1] CRAN (R 4.3.1)
-#>    glue            1.6.2      2022-02-24 [1] CRAN (R 4.3.0)
-#>    gtable          0.3.4      2023-08-21 [1] CRAN (R 4.3.0)
-#>    gtools          3.9.4      2022-11-27 [1] CRAN (R 4.3.0)
-#>    htmltools       0.5.7      2023-11-03 [1] CRAN (R 4.3.1)
-#>    htmlwidgets     1.6.2      2023-03-17 [1] CRAN (R 4.3.0)
-#>    httpuv          1.6.12     2023-10-23 [1] CRAN (R 4.3.1)
-#>    httr            1.4.7      2023-08-15 [1] CRAN (R 4.3.0)
-#>    jquerylib       0.1.4      2021-04-26 [1] CRAN (R 4.3.0)
-#>    jsonlite        1.8.7      2023-06-29 [1] CRAN (R 4.3.0)
-#>    kableExtra    * 1.3.4      2021-02-20 [1] CRAN (R 4.3.0)
-#>    knitr         * 1.45       2023-10-30 [1] CRAN (R 4.3.1)
-#>    later           1.3.1      2023-05-02 [1] CRAN (R 4.3.0)
-#>    lattice         0.22-5     2023-10-24 [1] CRAN (R 4.3.1)
-#>    lifecycle       1.0.3      2022-10-07 [1] CRAN (R 4.3.0)
-#>    lotri           0.4.3      2023-03-20 [1] CRAN (R 4.3.0)
-#>    magrittr        2.0.3      2022-03-30 [1] CRAN (R 4.3.0)
-#>    MASS            7.3-60     2023-05-04 [1] CRAN (R 4.3.2)
-#>    memoise         2.0.1      2021-11-26 [1] CRAN (R 4.3.0)
-#>    mime            0.12       2021-09-28 [1] CRAN (R 4.3.0)
-#>    miniUI          0.1.1.1    2018-05-18 [1] CRAN (R 4.3.0)
-#>    mrgsolve      * 1.1.1      2023-08-16 [1] CRAN (R 4.3.0)
-#>    munsell         0.5.0      2018-06-12 [1] CRAN (R 4.3.0)
-#>    mvtnorm         1.2-3      2023-08-25 [1] CRAN (R 4.3.0)
-#>    nlme            3.1-163    2023-08-09 [1] CRAN (R 4.3.2)
-#>    pillar          1.9.0      2023-03-22 [1] CRAN (R 4.3.0)
-#>    pkgbuild        1.4.2      2023-06-26 [1] CRAN (R 4.3.0)
-#>    pkgconfig       2.0.3      2019-09-22 [1] CRAN (R 4.3.0)
-#>    pkgdown         2.0.7      2022-12-14 [1] CRAN (R 4.3.0)
-#>    pkgload         1.3.3      2023-09-22 [1] CRAN (R 4.3.1)
-#>    PKPDsim       * 1.3.0      2023-03-02 [1] CRAN (R 4.3.0)
-#>  P PopED         * 0.6.0.9002 2023-11-08 [?] load_all()
-#>    PreciseSums     0.6        2023-04-22 [1] CRAN (R 4.3.0)
-#>    prettyunits     1.2.0      2023-09-24 [1] CRAN (R 4.3.1)
-#>    processx        3.8.2      2023-06-30 [1] CRAN (R 4.3.0)
-#>    profvis         0.3.8      2023-05-02 [1] CRAN (R 4.3.0)
-#>    promises        1.2.1      2023-08-10 [1] CRAN (R 4.3.0)
-#>    ps              1.7.5      2023-04-18 [1] CRAN (R 4.3.0)
-#>    purrr           1.0.2      2023-08-10 [1] CRAN (R 4.3.0)
-#>    qs              0.25.5     2023-02-22 [1] CRAN (R 4.3.0)
-#>    R6              2.5.1      2021-08-19 [1] CRAN (R 4.3.0)
-#>    ragg            1.2.6      2023-10-10 [1] CRAN (R 4.3.1)
-#>    RApiSerialize   0.1.2      2022-08-25 [1] CRAN (R 4.3.0)
-#>    Rcpp          * 1.0.11     2023-07-06 [1] CRAN (R 4.3.0)
-#>    RcppParallel    5.1.7      2023-02-27 [1] CRAN (R 4.3.0)
-#>    remotes         2.4.2.1    2023-07-18 [1] CRAN (R 4.3.0)
-#>    rlang           1.1.1      2023-04-28 [1] CRAN (R 4.3.0)
-#>    rmarkdown       2.25       2023-09-18 [1] CRAN (R 4.3.1)
-#>    rprojroot       2.0.3      2022-04-02 [1] CRAN (R 4.3.0)
-#>    rstudioapi      0.15.0     2023-07-07 [1] CRAN (R 4.3.0)
-#>    rvest           1.0.3      2022-08-19 [1] CRAN (R 4.3.0)
-#>    rxode2        * 2.0.14     2023-10-07 [1] CRAN (R 4.3.1)
-#>    rxode2et        2.0.10     2023-03-17 [1] CRAN (R 4.3.0)
-#>    rxode2parse     2.0.16     2023-03-28 [1] CRAN (R 4.3.0)
-#>    rxode2random    2.0.11     2023-03-28 [1] CRAN (R 4.3.0)
-#>    sass            0.4.7      2023-07-15 [1] CRAN (R 4.3.0)
-#>    scales          1.2.1      2022-08-20 [1] CRAN (R 4.3.0)
-#>    sessioninfo     1.2.2      2021-12-06 [1] CRAN (R 4.3.0)
-#>    shiny           1.7.5.1    2023-10-14 [1] CRAN (R 4.3.1)
-#>    stringfish      0.15.8     2023-05-30 [1] CRAN (R 4.3.0)
-#>    stringi         1.7.12     2023-01-11 [1] CRAN (R 4.3.0)
-#>    stringr         1.5.0      2022-12-02 [1] CRAN (R 4.3.0)
-#>    svglite         2.1.2      2023-10-11 [1] CRAN (R 4.3.1)
-#>    sys             3.4.2      2023-05-23 [1] CRAN (R 4.3.0)
-#>    systemfonts     1.0.5      2023-10-09 [1] CRAN (R 4.3.1)
-#>    testthat      * 3.2.0      2023-10-06 [1] CRAN (R 4.3.1)
-#>    textshaping     0.3.7      2023-10-09 [1] CRAN (R 4.3.1)
-#>    tibble          3.2.1      2023-03-20 [1] CRAN (R 4.3.0)
-#>    tidyselect      1.2.0      2022-10-10 [1] CRAN (R 4.3.0)
-#>    urlchecker      1.0.1      2021-11-30 [1] CRAN (R 4.3.0)
-#>    usethis         2.2.2      2023-07-06 [1] CRAN (R 4.3.0)
-#>    utf8            1.2.4      2023-10-22 [1] CRAN (R 4.3.1)
-#>    vctrs           0.6.4      2023-10-12 [1] CRAN (R 4.3.1)
-#>    viridisLite     0.4.2      2023-05-02 [1] CRAN (R 4.3.0)
-#>    webshot         0.5.5      2023-06-26 [1] CRAN (R 4.3.0)
-#>    withr           2.5.2      2023-10-30 [1] CRAN (R 4.3.1)
-#>    xfun            0.41       2023-11-01 [1] CRAN (R 4.3.1)
-#>    xml2            1.3.5      2023-07-06 [1] CRAN (R 4.3.0)
-#>    xtable          1.8-4      2019-04-21 [1] CRAN (R 4.3.0)
-#>    yaml            2.3.7      2023-01-23 [1] CRAN (R 4.3.0)
-#> 
-#>  [1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
-#> 
-#>  P ── Loaded and on-disk path mismatch.
-#> 
-#> ──────────────────────────────────────────────────────────────────────────────
-#sessionInfo()
- -
-
- - - -
- - - - -
- - - - - - - - diff --git a/docs/articles/model_def_other_pkgs_1-comp-lin-abs.png b/docs/articles/model_def_other_pkgs_1-comp-lin-abs.png deleted file mode 100644 index 63b4c3a9..00000000 Binary files a/docs/articles/model_def_other_pkgs_1-comp-lin-abs.png and /dev/null differ diff --git a/docs/articles/model_def_other_pkgs_compare_speed.png b/docs/articles/model_def_other_pkgs_compare_speed.png deleted file mode 100644 index b5a3e09b..00000000 Binary files a/docs/articles/model_def_other_pkgs_compare_speed.png and /dev/null differ diff --git a/docs/articles/model_def_other_pkgs_files/figure-html/unnamed-chunk-14-1.png b/docs/articles/model_def_other_pkgs_files/figure-html/unnamed-chunk-14-1.png deleted file mode 100644 index 309a1d8e..00000000 Binary files a/docs/articles/model_def_other_pkgs_files/figure-html/unnamed-chunk-14-1.png and /dev/null differ diff --git a/docs/articles/model_def_other_pkgs_files/header-attrs-2.1/header-attrs.js b/docs/articles/model_def_other_pkgs_files/header-attrs-2.1/header-attrs.js deleted file mode 100644 index dd57d92e..00000000 --- a/docs/articles/model_def_other_pkgs_files/header-attrs-2.1/header-attrs.js +++ /dev/null @@ -1,12 +0,0 @@ -// Pandoc 2.9 adds attributes on both header and div. We remove the former (to -// be compatible with the behavior of Pandoc < 2.8). -document.addEventListener('DOMContentLoaded', function(e) { - var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); - var i, h, a; - for (i = 0; i < hs.length; i++) { - h = hs[i]; - if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 - a = h.attributes; - while (a.length > 0) h.removeAttribute(a[0].name); - } -}); diff --git a/docs/articles/model_def_other_pkgs_files/header-attrs-2.2/header-attrs.js b/docs/articles/model_def_other_pkgs_files/header-attrs-2.2/header-attrs.js deleted file mode 100644 index dd57d92e..00000000 --- a/docs/articles/model_def_other_pkgs_files/header-attrs-2.2/header-attrs.js +++ /dev/null @@ -1,12 +0,0 @@ -// Pandoc 2.9 adds attributes on both header and div. We remove the former (to -// be compatible with the behavior of Pandoc < 2.8). -document.addEventListener('DOMContentLoaded', function(e) { - var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); - var i, h, a; - for (i = 0; i < hs.length; i++) { - h = hs[i]; - if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 - a = h.attributes; - while (a.length > 0) h.removeAttribute(a[0].name); - } -}); diff --git a/docs/articles/model_def_other_pkgs_files/header-attrs-2.8/header-attrs.js b/docs/articles/model_def_other_pkgs_files/header-attrs-2.8/header-attrs.js deleted file mode 100644 index dd57d92e..00000000 --- a/docs/articles/model_def_other_pkgs_files/header-attrs-2.8/header-attrs.js +++ /dev/null @@ -1,12 +0,0 @@ -// Pandoc 2.9 adds attributes on both header and div. We remove the former (to -// be compatible with the behavior of Pandoc < 2.8). -document.addEventListener('DOMContentLoaded', function(e) { - var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); - var i, h, a; - for (i = 0; i < hs.length; i++) { - h = hs[i]; - if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 - a = h.attributes; - while (a.length > 0) h.removeAttribute(a[0].name); - } -}); diff --git a/docs/articles/model_def_other_pkgs_files/kePrint-0.0.1/kePrint.js b/docs/articles/model_def_other_pkgs_files/kePrint-0.0.1/kePrint.js deleted file mode 100644 index e6fbbfc4..00000000 --- a/docs/articles/model_def_other_pkgs_files/kePrint-0.0.1/kePrint.js +++ /dev/null @@ -1,8 +0,0 @@ -$(document).ready(function(){ - if (typeof $('[data-toggle="tooltip"]').tooltip === 'function') { - $('[data-toggle="tooltip"]').tooltip(); - } - if ($('[data-toggle="popover"]').popover === 'function') { - $('[data-toggle="popover"]').popover(); - } -}); diff --git a/docs/articles/model_def_other_pkgs_files/lightable-0.0.1/lightable.css b/docs/articles/model_def_other_pkgs_files/lightable-0.0.1/lightable.css deleted file mode 100644 index 3be3be90..00000000 --- a/docs/articles/model_def_other_pkgs_files/lightable-0.0.1/lightable.css +++ /dev/null @@ -1,272 +0,0 @@ -/*! - * lightable v0.0.1 - * Copyright 2020 Hao Zhu - * Licensed under MIT (https://github.com/haozhu233/kableExtra/blob/master/LICENSE) - */ - -.lightable-minimal { - border-collapse: separate; - border-spacing: 16px 1px; - width: 100%; - margin-bottom: 10px; -} - -.lightable-minimal td { - margin-left: 5px; - margin-right: 5px; -} - -.lightable-minimal th { - margin-left: 5px; - margin-right: 5px; -} - -.lightable-minimal thead tr:last-child th { - border-bottom: 2px solid #00000050; - empty-cells: hide; - -} - -.lightable-minimal tbody tr:first-child td { - padding-top: 0.5em; -} - -.lightable-minimal.lightable-hover tbody tr:hover { - background-color: #f5f5f5; -} - -.lightable-minimal.lightable-striped tbody tr:nth-child(even) { - background-color: #f5f5f5; -} - -.lightable-classic { - border-top: 0.16em solid #111111; - border-bottom: 0.16em solid #111111; - width: 100%; - margin-bottom: 10px; - margin: 10px 5px; -} - -.lightable-classic tfoot tr td { - border: 0; -} - -.lightable-classic tfoot tr:first-child td { - border-top: 0.14em solid #111111; -} - -.lightable-classic caption { - color: #222222; -} - -.lightable-classic td { - padding-left: 5px; - padding-right: 5px; - color: #222222; -} - -.lightable-classic th { - padding-left: 5px; - padding-right: 5px; - font-weight: normal; - color: #222222; -} - -.lightable-classic thead tr:last-child th { - border-bottom: 0.10em solid #111111; -} - -.lightable-classic.lightable-hover tbody tr:hover { - background-color: #F9EEC1; -} - -.lightable-classic.lightable-striped tbody tr:nth-child(even) { - background-color: #f5f5f5; -} - -.lightable-classic-2 { - border-top: 3px double #111111; - border-bottom: 3px double #111111; - width: 100%; - margin-bottom: 10px; -} - -.lightable-classic-2 tfoot tr td { - border: 0; -} - -.lightable-classic-2 tfoot tr:first-child td { - border-top: 3px double #111111; -} - -.lightable-classic-2 caption { - color: #222222; -} - -.lightable-classic-2 td { - padding-left: 5px; - padding-right: 5px; - color: #222222; -} - -.lightable-classic-2 th { - padding-left: 5px; - padding-right: 5px; - font-weight: normal; - color: #222222; -} - -.lightable-classic-2 tbody tr:last-child td { - border-bottom: 3px double #111111; -} - -.lightable-classic-2 thead tr:last-child th { - border-bottom: 1px solid #111111; -} - -.lightable-classic-2.lightable-hover tbody tr:hover { - background-color: #F9EEC1; -} - -.lightable-classic-2.lightable-striped tbody tr:nth-child(even) { - background-color: #f5f5f5; -} - -.lightable-material { - min-width: 100%; - white-space: nowrap; - table-layout: fixed; - font-family: Roboto, sans-serif; - border: 1px solid #EEE; - border-collapse: collapse; - margin-bottom: 10px; -} - -.lightable-material tfoot tr td { - border: 0; -} - -.lightable-material tfoot tr:first-child td { - border-top: 1px solid #EEE; -} - -.lightable-material th { - height: 56px; - padding-left: 16px; - padding-right: 16px; -} - -.lightable-material td { - height: 52px; - padding-left: 16px; - padding-right: 16px; - border-top: 1px solid #eeeeee; -} - -.lightable-material.lightable-hover tbody tr:hover { - background-color: #f5f5f5; -} - -.lightable-material.lightable-striped tbody tr:nth-child(even) { - background-color: #f5f5f5; -} - -.lightable-material.lightable-striped tbody td { - border: 0; -} - -.lightable-material.lightable-striped thead tr:last-child th { - border-bottom: 1px solid #ddd; -} - -.lightable-material-dark { - min-width: 100%; - white-space: nowrap; - table-layout: fixed; - font-family: Roboto, sans-serif; - border: 1px solid #FFFFFF12; - border-collapse: collapse; - margin-bottom: 10px; - background-color: #363640; -} - -.lightable-material-dark tfoot tr td { - border: 0; -} - -.lightable-material-dark tfoot tr:first-child td { - border-top: 1px solid #FFFFFF12; -} - -.lightable-material-dark th { - height: 56px; - padding-left: 16px; - padding-right: 16px; - color: #FFFFFF60; -} - -.lightable-material-dark td { - height: 52px; - padding-left: 16px; - padding-right: 16px; - color: #FFFFFF; - border-top: 1px solid #FFFFFF12; -} - -.lightable-material-dark.lightable-hover tbody tr:hover { - background-color: #FFFFFF12; -} - -.lightable-material-dark.lightable-striped tbody tr:nth-child(even) { - background-color: #FFFFFF12; -} - -.lightable-material-dark.lightable-striped tbody td { - border: 0; -} - -.lightable-material-dark.lightable-striped thead tr:last-child th { - border-bottom: 1px solid #FFFFFF12; -} - -.lightable-paper { - width: 100%; - margin-bottom: 10px; - color: #444; -} - -.lightable-paper tfoot tr td { - border: 0; -} - -.lightable-paper tfoot tr:first-child td { - border-top: 1px solid #00000020; -} - -.lightable-paper thead tr:last-child th { - color: #666; - vertical-align: bottom; - border-bottom: 1px solid #00000020; - line-height: 1.15em; - padding: 10px 5px; -} - -.lightable-paper td { - vertical-align: middle; - border-bottom: 1px solid #00000010; - line-height: 1.15em; - padding: 7px 5px; -} - -.lightable-paper.lightable-hover tbody tr:hover { - background-color: #F9EEC1; -} - -.lightable-paper.lightable-striped tbody tr:nth-child(even) { - background-color: #00000008; -} - -.lightable-paper.lightable-striped tbody td { - border: 0; -} - diff --git a/docs/articles/model_def_other_pkgs_speed.png b/docs/articles/model_def_other_pkgs_speed.png deleted file mode 100644 index 9d569a90..00000000 Binary files a/docs/articles/model_def_other_pkgs_speed.png and /dev/null differ diff --git a/docs/authors.html b/docs/authors.html deleted file mode 100644 index ab34aa6b..00000000 --- a/docs/authors.html +++ /dev/null @@ -1,159 +0,0 @@ - -Authors and Citation • PopED - - -
-
- - - -
-
-
- - - -
  • -

    Andrew C. Hooker. Author, maintainer, translator, copyright holder. -

    -
  • -
  • -

    Marco Foracchia. Author. -
    O-Matrix version

    -
  • -
  • -

    Eric Stroemberg. Contributor. -
    MATLAB version

    -
  • -
  • -

    Martin Fink. Contributor. -
    Streamlining code, added functionality, vignettes

    -
  • -
  • -

    Giulia Lestini. Contributor. -
    Streamlining code, added functionality, vignettes

    -
  • -
  • -

    Sebastian Ueckert. Author. -
    MATLAB version

    -
  • -
  • -

    Joakim Nyberg. Author. -
    MATLAB version

    -
  • -
-
-
-

Citation

- Source: inst/CITATION -
-
- - -

Nyberg J, Ueckert S, Stroemberg EA, Hennig S, Karlsson MO, Hooker AC (2012). -“PopED: An extended, parallelized, nonlinear mixed effects models optimal design tool.” -Computer Methods and Programs in Biomedicine, 108. -

-
@Article{,
-  title = {PopED: An extended, parallelized, nonlinear mixed effects models optimal design tool},
-  author = {Joakim Nyberg and Sebastian Ueckert and Eric A Stroemberg and Stefanie Hennig and Mats O Karlsson and Andrew C Hooker},
-  journal = {Computer Methods and Programs in Biomedicine},
-  year = {2012},
-  volume = {108},
-}
-

Foracchia M, Hooker AC, Vicini P, Ruggeri A (2004). -“POPED, a software for optimal experiment design in population kinetics.” -Computer Methods and Programs in Biomedicine, 74. -

-
@Article{,
-  title = {POPED, a software for optimal experiment design in population kinetics},
-  author = {Marco Foracchia and Andrew C Hooker and Paolo Vicini and A Ruggeri},
-  journal = {Computer Methods and Programs in Biomedicine},
-  year = {2004},
-  volume = {74},
-}
- -
- -
- - - -
- - - - - - - - diff --git a/docs/bootstrap-toc.css b/docs/bootstrap-toc.css deleted file mode 100644 index 5a859415..00000000 --- a/docs/bootstrap-toc.css +++ /dev/null @@ -1,60 +0,0 @@ -/*! - * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) - * Copyright 2015 Aidan Feldman - * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ - -/* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ - -/* All levels of nav */ -nav[data-toggle='toc'] .nav > li > a { - display: block; - padding: 4px 20px; - font-size: 13px; - font-weight: 500; - color: #767676; -} -nav[data-toggle='toc'] .nav > li > a:hover, -nav[data-toggle='toc'] .nav > li > a:focus { - padding-left: 19px; - color: #563d7c; - text-decoration: none; - background-color: transparent; - border-left: 1px solid #563d7c; -} -nav[data-toggle='toc'] .nav > .active > a, -nav[data-toggle='toc'] .nav > .active:hover > a, -nav[data-toggle='toc'] .nav > .active:focus > a { - padding-left: 18px; - font-weight: bold; - color: #563d7c; - background-color: transparent; - border-left: 2px solid #563d7c; -} - -/* Nav: second level (shown on .active) */ -nav[data-toggle='toc'] .nav .nav { - display: none; /* Hide by default, but at >768px, show it */ - padding-bottom: 10px; -} -nav[data-toggle='toc'] .nav .nav > li > a { - padding-top: 1px; - padding-bottom: 1px; - padding-left: 30px; - font-size: 12px; - font-weight: normal; -} -nav[data-toggle='toc'] .nav .nav > li > a:hover, -nav[data-toggle='toc'] .nav .nav > li > a:focus { - padding-left: 29px; -} -nav[data-toggle='toc'] .nav .nav > .active > a, -nav[data-toggle='toc'] .nav .nav > .active:hover > a, -nav[data-toggle='toc'] .nav .nav > .active:focus > a { - padding-left: 28px; - font-weight: 500; -} - -/* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ -nav[data-toggle='toc'] .nav > .active > ul { - display: block; -} diff --git a/docs/bootstrap-toc.js b/docs/bootstrap-toc.js deleted file mode 100644 index 1cdd573b..00000000 --- a/docs/bootstrap-toc.js +++ /dev/null @@ -1,159 +0,0 @@ -/*! - * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) - * Copyright 2015 Aidan Feldman - * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ -(function() { - 'use strict'; - - window.Toc = { - helpers: { - // return all matching elements in the set, or their descendants - findOrFilter: function($el, selector) { - // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ - // http://stackoverflow.com/a/12731439/358804 - var $descendants = $el.find(selector); - return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); - }, - - generateUniqueIdBase: function(el) { - var text = $(el).text(); - var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); - return anchor || el.tagName.toLowerCase(); - }, - - generateUniqueId: function(el) { - var anchorBase = this.generateUniqueIdBase(el); - for (var i = 0; ; i++) { - var anchor = anchorBase; - if (i > 0) { - // add suffix - anchor += '-' + i; - } - // check if ID already exists - if (!document.getElementById(anchor)) { - return anchor; - } - } - }, - - generateAnchor: function(el) { - if (el.id) { - return el.id; - } else { - var anchor = this.generateUniqueId(el); - el.id = anchor; - return anchor; - } - }, - - createNavList: function() { - return $(''); - }, - - createChildNavList: function($parent) { - var $childList = this.createNavList(); - $parent.append($childList); - return $childList; - }, - - generateNavEl: function(anchor, text) { - var $a = $(''); - $a.attr('href', '#' + anchor); - $a.text(text); - var $li = $('
  • '); - $li.append($a); - return $li; - }, - - generateNavItem: function(headingEl) { - var anchor = this.generateAnchor(headingEl); - var $heading = $(headingEl); - var text = $heading.data('toc-text') || $heading.text(); - return this.generateNavEl(anchor, text); - }, - - // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). - getTopLevel: function($scope) { - for (var i = 1; i <= 6; i++) { - var $headings = this.findOrFilter($scope, 'h' + i); - if ($headings.length > 1) { - return i; - } - } - - return 1; - }, - - // returns the elements for the top level, and the next below it - getHeadings: function($scope, topLevel) { - var topSelector = 'h' + topLevel; - - var secondaryLevel = topLevel + 1; - var secondarySelector = 'h' + secondaryLevel; - - return this.findOrFilter($scope, topSelector + ',' + secondarySelector); - }, - - getNavLevel: function(el) { - return parseInt(el.tagName.charAt(1), 10); - }, - - populateNav: function($topContext, topLevel, $headings) { - var $context = $topContext; - var $prevNav; - - var helpers = this; - $headings.each(function(i, el) { - var $newNav = helpers.generateNavItem(el); - var navLevel = helpers.getNavLevel(el); - - // determine the proper $context - if (navLevel === topLevel) { - // use top level - $context = $topContext; - } else if ($prevNav && $context === $topContext) { - // create a new level of the tree and switch to it - $context = helpers.createChildNavList($prevNav); - } // else use the current $context - - $context.append($newNav); - - $prevNav = $newNav; - }); - }, - - parseOps: function(arg) { - var opts; - if (arg.jquery) { - opts = { - $nav: arg - }; - } else { - opts = arg; - } - opts.$scope = opts.$scope || $(document.body); - return opts; - } - }, - - // accepts a jQuery object, or an options object - init: function(opts) { - opts = this.helpers.parseOps(opts); - - // ensure that the data attribute is in place for styling - opts.$nav.attr('data-toggle', 'toc'); - - var $topContext = this.helpers.createChildNavList(opts.$nav); - var topLevel = this.helpers.getTopLevel(opts.$scope); - var $headings = this.helpers.getHeadings(opts.$scope, topLevel); - this.helpers.populateNav($topContext, topLevel, $headings); - } - }; - - $(function() { - $('nav[data-toggle="toc"]').each(function(i, el) { - var $nav = $(el); - Toc.init($nav); - }); - }); -})(); diff --git a/docs/dev/LICENSE.html b/docs/dev/LICENSE.html deleted file mode 100644 index b9daca59..00000000 --- a/docs/dev/LICENSE.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - - - - - -NA • PopED - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - - -

    GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007

    -

    Copyright (C) 2007 Free Software Foundation, Inc. http://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

    -

    This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.

    -
      -
    1. Additional Definitions.
    2. -
    -

    As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.

    -

    “The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.

    -

    An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.

    -

    A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.

    -

    The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.

    -

    The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.

    -
      -
    1. Exception to Section 3 of the GNU GPL.
    2. -
    -

    You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.

    -
      -
    1. Conveying Modified Versions.
    2. -
    -

    If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:

    -

    a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or

    -

    b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.

    -
      -
    1. Object Code Incorporating Material from Library Header Files.
    2. -
    -

    The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:

    -

    a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.

    -

    b) Accompany the object code with a copy of the GNU GPL and this license document.

    -
      -
    1. Combined Works.
    2. -
    -

    You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:

    -

    a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.

    -

    b) Accompany the Combined Work with a copy of the GNU GPL and this license document.

    -

    c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.

    -

    d) Do one of the following:

    - -

    e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)

    -
      -
    1. Combined Libraries.
    2. -
    -

    You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:

    -

    a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.

    -

    b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.

    -
      -
    1. Revised Versions of the GNU Lesser General Public License.
    2. -
    -

    The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

    -

    Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.

    -

    If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy’s public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.

    - - -
    - -
    - - - - -
    - - - - - - - - diff --git a/docs/dev/authors.html b/docs/dev/authors.html deleted file mode 100644 index 93443f0e..00000000 --- a/docs/dev/authors.html +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - -Citation and Authors • PopED - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -

    Nyberg J, Ueckert S, Stroemberg EA, Hennig S, Karlsson MO, Hooker AC (2012). -“PopED: An extended, parallelized, nonlinear mixed effects models optimal design tool.” -Computer Methods and Programs in Biomedicine, 108. -

    -
    @Article{,
    -  title = {PopED: An extended, parallelized, nonlinear mixed effects models optimal design tool},
    -  author = {Joakim Nyberg and Sebastian Ueckert and Eric A Stroemberg and Stefanie Hennig and Mats O Karlsson and Andrew C Hooker},
    -  journal = {Computer Methods and Programs in Biomedicine},
    -  year = {2012},
    -  volume = {108},
    -}
    -

    Foracchia M, Hooker AC, Vicini P, Ruggeri A (2004). -“POPED, a software for optimal experiment design in population kinetics.” -Computer Methods and Programs in Biomedicine, 74. -

    -
    @Article{,
    -  title = {POPED, a software for optimal experiment design in population kinetics},
    -  author = {Marco Foracchia and Andrew C Hooker and Paolo Vicini and A Ruggeri},
    -  journal = {Computer Methods and Programs in Biomedicine},
    -  year = {2004},
    -  volume = {74},
    -}
    - - - -
      -
    • -

      Andrew C. Hooker. Author, maintainer, translator, copyright holder. ORCID -

      -
    • -
    • -

      Marco Foracchia. Author. -
      O-Matrix version

      -
    • -
    • -

      Eric Stroemberg. Contributor. -
      MATLAB version

      -
    • -
    • -

      Martin Fink. Contributor. -
      Streamlining code, added functionality, vignettes

      -
    • -
    • -

      Giulia Lestini. Contributor. -
      Streamlining code, added functionality, vignettes

      -
    • -
    • -

      Sebastian Ueckert. Author. ORCID -
      MATLAB version

      -
    • -
    • -

      Joakim Nyberg. Author. -
      MATLAB version

      -
    • -
    - -
    - -
    - - - - -
    - - - - - - - - diff --git a/docs/dev/index.html b/docs/dev/index.html deleted file mode 100644 index ba476d25..00000000 --- a/docs/dev/index.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - -Population (and Individual) Optimal Experimental Design • PopED - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    -
    -
    - - -

    PopED computes optimal experimental designs for both population and individual studies based on nonlinear mixed-effect models. Often this is based on a computation of the Fisher Information Matrix (FIM).

    -
    -

    -Installation

    -

    You need to have R installed. Download the latest version of R from www.r-project.org. You can install the released version of PopED from CRAN with:

    - -

    And the development version from GitHub with:

    - -
    -
    -

    -Getting started

    -

    To get started you need to define

    -
      -
    1. A model.
    2. -
    3. An initial design (and design space if you want to optimize).
    4. -
    5. The tasks to perform.
    6. -
    -

    Learn more in this introduction to PopED

    -
    -
    -

    -Contact

    -

    You are welcome to:

    - -
    -
    -
    - - -
    - - - -
    - - - - - - diff --git a/docs/docsearch.css b/docs/docsearch.css deleted file mode 100644 index e5f1fe1d..00000000 --- a/docs/docsearch.css +++ /dev/null @@ -1,148 +0,0 @@ -/* Docsearch -------------------------------------------------------------- */ -/* - Source: https://github.com/algolia/docsearch/ - License: MIT -*/ - -.algolia-autocomplete { - display: block; - -webkit-box-flex: 1; - -ms-flex: 1; - flex: 1 -} - -.algolia-autocomplete .ds-dropdown-menu { - width: 100%; - min-width: none; - max-width: none; - padding: .75rem 0; - background-color: #fff; - background-clip: padding-box; - border: 1px solid rgba(0, 0, 0, .1); - box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); -} - -@media (min-width:768px) { - .algolia-autocomplete .ds-dropdown-menu { - width: 175% - } -} - -.algolia-autocomplete .ds-dropdown-menu::before { - display: none -} - -.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { - padding: 0; - background-color: rgb(255,255,255); - border: 0; - max-height: 80vh; -} - -.algolia-autocomplete .ds-dropdown-menu .ds-suggestions { - margin-top: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion { - padding: 0; - overflow: visible -} - -.algolia-autocomplete .algolia-docsearch-suggestion--category-header { - padding: .125rem 1rem; - margin-top: 0; - font-size: 1.3em; - font-weight: 500; - color: #00008B; - border-bottom: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--wrapper { - float: none; - padding-top: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { - float: none; - width: auto; - padding: 0; - text-align: left -} - -.algolia-autocomplete .algolia-docsearch-suggestion--content { - float: none; - width: auto; - padding: 0 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--content::before { - display: none -} - -.algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { - padding-top: .75rem; - margin-top: .75rem; - border-top: 1px solid rgba(0, 0, 0, .1) -} - -.algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { - display: block; - padding: .1rem 1rem; - margin-bottom: 0.1; - font-size: 1.0em; - font-weight: 400 - /* display: none */ -} - -.algolia-autocomplete .algolia-docsearch-suggestion--title { - display: block; - padding: .25rem 1rem; - margin-bottom: 0; - font-size: 0.9em; - font-weight: 400 -} - -.algolia-autocomplete .algolia-docsearch-suggestion--text { - padding: 0 1rem .5rem; - margin-top: -.25rem; - font-size: 0.8em; - font-weight: 400; - line-height: 1.25 -} - -.algolia-autocomplete .algolia-docsearch-footer { - width: 110px; - height: 20px; - z-index: 3; - margin-top: 10.66667px; - float: right; - font-size: 0; - line-height: 0; -} - -.algolia-autocomplete .algolia-docsearch-footer--logo { - background-image: url("data:image/svg+xml;utf8,"); - background-repeat: no-repeat; - background-position: 50%; - background-size: 100%; - overflow: hidden; - text-indent: -9000px; - width: 100%; - height: 100%; - display: block; - transform: translate(-8px); -} - -.algolia-autocomplete .algolia-docsearch-suggestion--highlight { - color: #FF8C00; - background: rgba(232, 189, 54, 0.1) -} - - -.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { - box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) -} - -.algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { - background-color: rgba(192, 192, 192, .15) -} diff --git a/docs/docsearch.js b/docs/docsearch.js deleted file mode 100644 index b35504cd..00000000 --- a/docs/docsearch.js +++ /dev/null @@ -1,85 +0,0 @@ -$(function() { - - // register a handler to move the focus to the search bar - // upon pressing shift + "/" (i.e. "?") - $(document).on('keydown', function(e) { - if (e.shiftKey && e.keyCode == 191) { - e.preventDefault(); - $("#search-input").focus(); - } - }); - - $(document).ready(function() { - // do keyword highlighting - /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ - var mark = function() { - - var referrer = document.URL ; - var paramKey = "q" ; - - if (referrer.indexOf("?") !== -1) { - var qs = referrer.substr(referrer.indexOf('?') + 1); - var qs_noanchor = qs.split('#')[0]; - var qsa = qs_noanchor.split('&'); - var keyword = ""; - - for (var i = 0; i < qsa.length; i++) { - var currentParam = qsa[i].split('='); - - if (currentParam.length !== 2) { - continue; - } - - if (currentParam[0] == paramKey) { - keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); - } - } - - if (keyword !== "") { - $(".contents").unmark({ - done: function() { - $(".contents").mark(keyword); - } - }); - } - } - }; - - mark(); - }); -}); - -/* Search term highlighting ------------------------------*/ - -function matchedWords(hit) { - var words = []; - - var hierarchy = hit._highlightResult.hierarchy; - // loop to fetch from lvl0, lvl1, etc. - for (var idx in hierarchy) { - words = words.concat(hierarchy[idx].matchedWords); - } - - var content = hit._highlightResult.content; - if (content) { - words = words.concat(content.matchedWords); - } - - // return unique words - var words_uniq = [...new Set(words)]; - return words_uniq; -} - -function updateHitURL(hit) { - - var words = matchedWords(hit); - var url = ""; - - if (hit.anchor) { - url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; - } else { - url = hit.url + '?q=' + escape(words.join(" ")); - } - - return url; -} diff --git a/docs/favicon-16x16.png b/docs/favicon-16x16.png deleted file mode 100644 index 61565c1a..00000000 Binary files a/docs/favicon-16x16.png and /dev/null differ diff --git a/docs/favicon-32x32.png b/docs/favicon-32x32.png deleted file mode 100644 index b7be0979..00000000 Binary files a/docs/favicon-32x32.png and /dev/null differ diff --git a/docs/favicon.ico b/docs/favicon.ico deleted file mode 100644 index ded12398..00000000 Binary files a/docs/favicon.ico and /dev/null differ diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index e4af7c14..00000000 --- a/docs/index.html +++ /dev/null @@ -1,218 +0,0 @@ - - - - - - - -Population (and Individual) Optimal Experimental Design • PopED - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    -
    -
    - - - -

    PopED computes optimal experimental designs for both population and individual studies based on nonlinear mixed-effect models. Often this is based on a computation of the Fisher Information Matrix (FIM).

    -
    -

    Installation -

    -

    You need to have R installed. Download the latest version of R from www.r-project.org. You can install the released version of PopED from CRAN with:

    - -

    And the development version from GitHub with:

    -
    -# install.packages("devtools")
    -devtools::install_github("andrewhooker/PopED")
    -
    -
    -

    Getting started -

    -

    To get started you need to define

    -
      -
    1. A model.
    2. -
    3. An initial design (and design space if you want to optimize).
    4. -
    5. The tasks to perform.
    6. -
    -

    Learn more in this introduction to PopED

    -
    -
    -

    Contact -

    -

    You are welcome to:

    - -
    -
    -
    - - -
    - - - -
    - - - - - - - - diff --git a/docs/jquery.sticky-kit.min.js b/docs/jquery.sticky-kit.min.js deleted file mode 100644 index e2a3c6de..00000000 --- a/docs/jquery.sticky-kit.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | http://leafo.net -*/ -(function(){var b,f;b=this.jQuery||window.jQuery;f=b(window);b.fn.stick_in_parent=function(d){var A,w,J,n,B,K,p,q,k,E,t;null==d&&(d={});t=d.sticky_class;B=d.inner_scrolling;E=d.recalc_every;k=d.parent;q=d.offset_top;p=d.spacer;w=d.bottoming;null==q&&(q=0);null==k&&(k=void 0);null==B&&(B=!0);null==t&&(t="is_stuck");A=b(document);null==w&&(w=!0);J=function(a,d,n,C,F,u,r,G){var v,H,m,D,I,c,g,x,y,z,h,l;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);I=A.height();g=a.parent();null!=k&&(g=g.closest(k)); -if(!g.length)throw"failed to find stick parent";v=m=!1;(h=null!=p?p&&a.closest(p):b("
    "))&&h.css("position",a.css("position"));x=function(){var c,f,e;if(!G&&(I=A.height(),c=parseInt(g.css("border-top-width"),10),f=parseInt(g.css("padding-top"),10),d=parseInt(g.css("padding-bottom"),10),n=g.offset().top+c+f,C=g.height(),m&&(v=m=!1,null==p&&(a.insertAfter(h),h.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(t),e=!0),F=a.offset().top-(parseInt(a.css("margin-top"),10)||0)-q, -u=a.outerHeight(!0),r=a.css("float"),h&&h.css({width:a.outerWidth(!0),height:u,display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":r}),e))return l()};x();if(u!==C)return D=void 0,c=q,z=E,l=function(){var b,l,e,k;if(!G&&(e=!1,null!=z&&(--z,0>=z&&(z=E,x(),e=!0)),e||A.height()===I||x(),e=f.scrollTop(),null!=D&&(l=e-D),D=e,m?(w&&(k=e+u+c>C+n,v&&!k&&(v=!1,a.css({position:"fixed",bottom:"",top:c}).trigger("sticky_kit:unbottom"))),eb&&!v&&(c-=l,c=Math.max(b-u,c),c=Math.min(q,c),m&&a.css({top:c+"px"})))):e>F&&(m=!0,b={position:"fixed",top:c},b.width="border-box"===a.css("box-sizing")?a.outerWidth()+"px":a.width()+"px",a.css(b).addClass(t),null==p&&(a.after(h),"left"!==r&&"right"!==r||h.append(a)),a.trigger("sticky_kit:stick")),m&&w&&(null==k&&(k=e+u+c>C+n),!v&&k)))return v=!0,"static"===g.css("position")&&g.css({position:"relative"}), -a.css({position:"absolute",bottom:d,top:"auto"}).trigger("sticky_kit:bottom")},y=function(){x();return l()},H=function(){G=!0;f.off("touchmove",l);f.off("scroll",l);f.off("resize",y);b(document.body).off("sticky_kit:recalc",y);a.off("sticky_kit:detach",H);a.removeData("sticky_kit");a.css({position:"",bottom:"",top:"",width:""});g.position("position","");if(m)return null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),h.remove()),a.removeClass(t)},f.on("touchmove",l),f.on("scroll",l),f.on("resize", -y),b(document.body).on("sticky_kit:recalc",y),a.on("sticky_kit:detach",H),setTimeout(l,0)}};n=0;for(K=this.length;n - - - - - diff --git a/docs/logo.png b/docs/logo.png deleted file mode 100644 index d0133857..00000000 Binary files a/docs/logo.png and /dev/null differ diff --git a/docs/news/index.html b/docs/news/index.html deleted file mode 100644 index 7af27603..00000000 --- a/docs/news/index.html +++ /dev/null @@ -1,320 +0,0 @@ - - - - - - - - -Changelog • PopED - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    -PopED 0.6.0 Unreleased -

    -
      -
    • Added the options allow_replicates=TRUE/FALSE, allow_replicates_xt=TRUE/FALSE and allow_replicates_a=TRUE/FALSE to poped_optim. This allows the optimization algorithm to avoid replicates (or not) in the design components. Currently only works for discrete variable optimization. Future versions will also handle continuous optimization.

    • -
    • Exported a function for the computation of the Bayesian Fisher information matrix for individual parameters of a population model based on Maximum A Posteriori (MAP) estimation of the empirical Bayes estimates (EBEs) in a population model. See ?evaluate_fim_map for more details.

    • -
    • Allowing for no covariates in the function that automatically builds a PopED parameter function from a model function (?build_sfg).

    • -
    • Updates to documentation and package testing.

    • -
    • Minor bug fixes.

    • -
    -
    -
    -

    -PopED 0.5.0 2020-06-13 -

    -
      -
    • Added the ability to incorporate limit of quantification information into FIM calculations (both upper and lower limits). See the new vignette on the webpage https://andrewhooker.github.io/PopED/articles/handling_loq.html

    • -
    • Adding functionality to optimize groupsize and total size of the study. See ?optimize_groupsize, `?optimize_n_eff and ?optimize_n_rse. This is also implemented in poped_optim through the opt_inds=T argument.

    • -
    • Updating Vignettes, including a new one about using other tools to use as simulators for design computations. See https://andrewhooker.github.io/PopED/articles/model_def_other_pkgs.html

    • -
    • Simplify RxODE syntax in the above vingette (#47, @mattfidler).

    • -
    • Added the ability to predict and plot model prediction intervals by computing the expected variance (using an FO approximation) and then computing a prediction interval based on an assumption of normality. See ?model_prediciton and ?plot_model_prediction. The computation is faster but less accurate compared to using DV=TRUE (and groupsize_sim = 500) in the two functions.

    • -
    • Named parameters are now passed to all calculations so that the FIM and RSE output is more readable with parameter names instead of default names.

    • -
    • Allow for parallel computation in plot_efficiency_of_windows (#50).

    • -
    • Make parallelization work with mrgsolve on windows (#37, #45, #46, #51, @Vincent-AC).

    • -
    • Updated the function for automatic building of parameter model function (see build_sfg).

    • -
    • Simplify derivative calculations (#34, @martin-gmx).

    • -
    • Allow for only simulating model_switch > 1 models.

    • -
    • Change the defult Ds calculation to be on log scale.

    • -
    • Updated the website at https://andrewhooker.github.io/PopED

    • -
    • Remove options for discontinued dplyr commands rbind_all and rbind_list.

    • -
    • Minor bug fixes in shrinkage calculations (#44, #39, @martin-gmx).

    • -
    -
    -
    -

    -PopED 0.4.0 2018-09-10 -

    -
      -
    • New and improved vignettes (#30, @giulialestini)!

    • -
    • Added power evaluation script to test the power of a design to identify a parameter different than an assumed value. The function also calculates the number of individuals needed in a design to have a specific power. See ?evaluate_power for more information (#26, @martin-gmx).

    • -
    • Added function to compute expected shrinkage of a design. See ?shrinkage for more information.

    • -
    • Updated and added new example scripts in system.file("examples", package="PopED") (). This includes an example describing how to handle covariate distributions in optimal design, an example on how to incorporate IOV, an example on how to handle shrinkage, an example with a full covariance matrix and an example with a prior FIM (#30, @giulialestini and @martin-gmx).

    • -
    • Major overhaul in optimization methods used in poped_optim() so that generic optimization routines like optim() can be easily used in optimizing PopED designs.

    • -
    • Update speed of FIM calculations (#20, @martin-gmx).

    • -
    • Update RSE calculations so that prior FIM is handled correctly (#22, @martin-gmx).

    • -
    • Simplified code and removed duplicated code (#21, #24 and #32, @martin-gmx).

    • -
    • New ways of handling inverting matricies, should be faster and work better when the matricies are ill-conditioned. See ?inv for more information (#19, @martin-gmx).

    • -
    • Updated functionality of IOV calculations.

    • -
    • Updates to optim_ARS() for when to stop search.

    • -
    • Extended functionality of plot.model.prediction() (#23, @martin-gmx).

    • -
    • Bug fixing. See https://github.com/andrewhooker/PopED/commits/master for more information.

    • -
    -
    -
    -

    -PopED 0.3.2 2016-12-12 -

    -
      -
    • Exported the summary method for the results of poped_optim in the PopED NAMESPACE, so that the method can actually be used! Just use summary(output).

    • -
    • Fixed some old bugs that used return as a varible in functions, a la MATLAB.

    • -
    -
    -
    -

    -PopED 0.3.1 2016-10-19 -

    -
      -
    • Added a vignette to introduce PopED!

    • -
    • Improved optimization with poped_optim, plus all example scripts now running with poped_optim.

    • -
    • Update to more easily allow discrete optimization of xt and a variables. See the example scripts.

    • -
    • Added a summary method for the results of poped_optim. Just use summary(output).

    • -
    • changed handling of seed numbers in optimizations.

    • -
    • more robust handling of non-population models

    • -
    • more natural handling of NA values in design vectors

    • -
    • NAMESPACE: removed ggplot2 from “Depends” and added to “Imports”

    • -
    • Added mean line to efficiency plots.

    • -
    • Update to computation and error handling for Laplace approximation to ED objective function.

    • -
    • Added more intuitive cost function input. See examples in ?poped_optim

    • -
    • Various small changes and bug fixes.

    • -
    -
    -
    -

    -PopED 0.3.0 2015-12-29 -

    -
      -
    • Added new optimization methods and tools, see ?poped_optim(). This function incorporates the new optimization routines optim_ARS() and optim_LS which are optimized versions of previous optimization algorithms used in PopED. Both can be run with parallelization. poped_optim() also incorporates the genetic algorithm from GA::ga(), which can also be run with parallelization, and the “L-BFGS-B” method from stats::optim(). poped_optim() should be more efficient and faster than poped_optimize().

    • -
    • Changed the default objective function to be the log of the determinant of the FIM. create.poped.database(ofv_calc_type=4)

    • -
    • Various small changes and bug fixes.

    • -
    -
    -
    -

    -PopED 0.2.0 2015-03-20 -

    -
      -
    • Fixed plot_efficiency_of_windows() bug that had wrong headers on each subplot.

    • -
    • Fixed bug in plot_model_prediction() that did not plot the optimized design, but instead the initial design

    • -
    • Reorganized the database created from create.poped.database(). The output from this function is now a list with 5 sub-lists: design, design_space, model, parameters and settings. Also removed duplicate entries in the database for easier manipulation. This will cause some back compatibility issues when referring to elements in a database.

    • -
    • Added example 10 describing a PKPD design of hepatitis C virus (HCV) kinetics to the system.file("examples",package="PopED") directory of the PopED installation.

    • -
    -
    -
    -

    -PopED 0.1.2 2014-11-19 -

    -
      -
    • Updated model_prediction() to allow for creation of NONMEM datasets.
      -Useful for testing of optimized designs via PsN’s (http://psn.sf.net) SSE tool, for example.

    • -
    • Two new functions create_design() and create_design_space() that allow for design and design space creation without the need for a model or parameter values.

    • -
    • Updated the create.poped.database() function to use create_design() and create_design_space()

    • -
    • Added examples for evaluation and optimization of a one-target quasi-steady-state target mediated drug disposition model (TMDD) to the system.file(“examples”,package=“PopED”) directory of the PopED installation.

    • -
    • Added a 2-compartment, oral absorption, multiple dose example to the system.file(“examples”, package=“PopED”) directory of the PopED installation.

    • -
    • Updated plot_efficiency_of_windows() to allow for the plotting of the RSE of each parameter on the y-axis.

    • -
    • Updated error handing for the Laplace approximation of the ED OFV.

    • -
    • Fixed bug when computing FIM with only one BSV term present in model (calculation gave an error).

    • -
    • Fixed a bug in plot_model_predictions where an error was returned if not all time values in the xt matrix were to be used for the design calculation (ni is different from size(xt,2), see ?create_poped_database).

    • -
    • Various small bug fixes.

    • -
    -
    -
    -

    -PopED 0.1.1 2014-05-27 -

    -
      -
    • Updated package author list

    • -
    • New functionality to compute the ED OFV using the Laplace approximation. This can be orders of magnitude faster than the standard MC integration approach. See ‘?ed_laplace_ofv’ and ‘?evaluate.e.ofv.fim’

    • -
    • Added a general function to compute the FIM and OFV(FIM) for all available methods in PopED. See ‘?calc_ofv_and_fim’.

    • -
    • Added a general optimization algorithm ‘RS_opt_gen()’ that works for both D-family and E-family optimization.

    • -
    • Added optimization of E-family designs to ‘poped_optimize()’.

    • -
    • Changed distribution tests for package building

    • -
    • Fixed bug where correlations between BSV (between subject variability) terms in the model gave an error when creating a PopED database

    • -
    • Fixed a bug where get_rse failed when a parameter had a value of 3.

    • -
    -
    -
    -

    -PopED 0.1.0 2014-04-28 -

    -
      -
    • PopED has been translated to R from MATLAB and this is the initial release.
    • -
    -
    -
    - - - -
    - - - -
    - - - - - - - - diff --git a/docs/pkgdown.css b/docs/pkgdown.css deleted file mode 100644 index 80ea5b83..00000000 --- a/docs/pkgdown.css +++ /dev/null @@ -1,384 +0,0 @@ -/* Sticky footer */ - -/** - * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ - * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css - * - * .Site -> body > .container - * .Site-content -> body > .container .row - * .footer -> footer - * - * Key idea seems to be to ensure that .container and __all its parents__ - * have height set to 100% - * - */ - -html, body { - height: 100%; -} - -body { - position: relative; -} - -body > .container { - display: flex; - height: 100%; - flex-direction: column; -} - -body > .container .row { - flex: 1 0 auto; -} - -footer { - margin-top: 45px; - padding: 35px 0 36px; - border-top: 1px solid #e5e5e5; - color: #666; - display: flex; - flex-shrink: 0; -} -footer p { - margin-bottom: 0; -} -footer div { - flex: 1; -} -footer .pkgdown { - text-align: right; -} -footer p { - margin-bottom: 0; -} - -img.icon { - float: right; -} - -/* Ensure in-page images don't run outside their container */ -.contents img { - max-width: 100%; - height: auto; -} - -/* Fix bug in bootstrap (only seen in firefox) */ -summary { - display: list-item; -} - -/* Typographic tweaking ---------------------------------*/ - -.contents .page-header { - margin-top: calc(-60px + 1em); -} - -dd { - margin-left: 3em; -} - -/* Section anchors ---------------------------------*/ - -a.anchor { - display: none; - margin-left: 5px; - width: 20px; - height: 20px; - - background-image: url(./link.svg); - background-repeat: no-repeat; - background-size: 20px 20px; - background-position: center center; -} - -h1:hover .anchor, -h2:hover .anchor, -h3:hover .anchor, -h4:hover .anchor, -h5:hover .anchor, -h6:hover .anchor { - display: inline-block; -} - -/* Fixes for fixed navbar --------------------------*/ - -.contents h1, .contents h2, .contents h3, .contents h4 { - padding-top: 60px; - margin-top: -40px; -} - -/* Navbar submenu --------------------------*/ - -.dropdown-submenu { - position: relative; -} - -.dropdown-submenu>.dropdown-menu { - top: 0; - left: 100%; - margin-top: -6px; - margin-left: -1px; - border-radius: 0 6px 6px 6px; -} - -.dropdown-submenu:hover>.dropdown-menu { - display: block; -} - -.dropdown-submenu>a:after { - display: block; - content: " "; - float: right; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; - border-width: 5px 0 5px 5px; - border-left-color: #cccccc; - margin-top: 5px; - margin-right: -10px; -} - -.dropdown-submenu:hover>a:after { - border-left-color: #ffffff; -} - -.dropdown-submenu.pull-left { - float: none; -} - -.dropdown-submenu.pull-left>.dropdown-menu { - left: -100%; - margin-left: 10px; - border-radius: 6px 0 6px 6px; -} - -/* Sidebar --------------------------*/ - -#pkgdown-sidebar { - margin-top: 30px; - position: -webkit-sticky; - position: sticky; - top: 70px; -} - -#pkgdown-sidebar h2 { - font-size: 1.5em; - margin-top: 1em; -} - -#pkgdown-sidebar h2:first-child { - margin-top: 0; -} - -#pkgdown-sidebar .list-unstyled li { - margin-bottom: 0.5em; -} - -/* bootstrap-toc tweaks ------------------------------------------------------*/ - -/* All levels of nav */ - -nav[data-toggle='toc'] .nav > li > a { - padding: 4px 20px 4px 6px; - font-size: 1.5rem; - font-weight: 400; - color: inherit; -} - -nav[data-toggle='toc'] .nav > li > a:hover, -nav[data-toggle='toc'] .nav > li > a:focus { - padding-left: 5px; - color: inherit; - border-left: 1px solid #878787; -} - -nav[data-toggle='toc'] .nav > .active > a, -nav[data-toggle='toc'] .nav > .active:hover > a, -nav[data-toggle='toc'] .nav > .active:focus > a { - padding-left: 5px; - font-size: 1.5rem; - font-weight: 400; - color: inherit; - border-left: 2px solid #878787; -} - -/* Nav: second level (shown on .active) */ - -nav[data-toggle='toc'] .nav .nav { - display: none; /* Hide by default, but at >768px, show it */ - padding-bottom: 10px; -} - -nav[data-toggle='toc'] .nav .nav > li > a { - padding-left: 16px; - font-size: 1.35rem; -} - -nav[data-toggle='toc'] .nav .nav > li > a:hover, -nav[data-toggle='toc'] .nav .nav > li > a:focus { - padding-left: 15px; -} - -nav[data-toggle='toc'] .nav .nav > .active > a, -nav[data-toggle='toc'] .nav .nav > .active:hover > a, -nav[data-toggle='toc'] .nav .nav > .active:focus > a { - padding-left: 15px; - font-weight: 500; - font-size: 1.35rem; -} - -/* orcid ------------------------------------------------------------------- */ - -.orcid { - font-size: 16px; - color: #A6CE39; - /* margins are required by official ORCID trademark and display guidelines */ - margin-left:4px; - margin-right:4px; - vertical-align: middle; -} - -/* Reference index & topics ----------------------------------------------- */ - -.ref-index th {font-weight: normal;} - -.ref-index td {vertical-align: top; min-width: 100px} -.ref-index .icon {width: 40px;} -.ref-index .alias {width: 40%;} -.ref-index-icons .alias {width: calc(40% - 40px);} -.ref-index .title {width: 60%;} - -.ref-arguments th {text-align: right; padding-right: 10px;} -.ref-arguments th, .ref-arguments td {vertical-align: top; min-width: 100px} -.ref-arguments .name {width: 20%;} -.ref-arguments .desc {width: 80%;} - -/* Nice scrolling for wide elements --------------------------------------- */ - -table { - display: block; - overflow: auto; -} - -/* Syntax highlighting ---------------------------------------------------- */ - -pre, code, pre code { - background-color: #f8f8f8; - color: #333; -} -pre, pre code { - white-space: pre-wrap; - word-break: break-all; - overflow-wrap: break-word; -} - -pre { - border: 1px solid #eee; -} - -pre .img, pre .r-plt { - margin: 5px 0; -} - -pre .img img, pre .r-plt img { - background-color: #fff; -} - -code a, pre a { - color: #375f84; -} - -a.sourceLine:hover { - text-decoration: none; -} - -.fl {color: #1514b5;} -.fu {color: #000000;} /* function */ -.ch,.st {color: #036a07;} /* string */ -.kw {color: #264D66;} /* keyword */ -.co {color: #888888;} /* comment */ - -.error {font-weight: bolder;} -.warning {font-weight: bolder;} - -/* Clipboard --------------------------*/ - -.hasCopyButton { - position: relative; -} - -.btn-copy-ex { - position: absolute; - right: 0; - top: 0; - visibility: hidden; -} - -.hasCopyButton:hover button.btn-copy-ex { - visibility: visible; -} - -/* headroom.js ------------------------ */ - -.headroom { - will-change: transform; - transition: transform 200ms linear; -} -.headroom--pinned { - transform: translateY(0%); -} -.headroom--unpinned { - transform: translateY(-100%); -} - -/* mark.js ----------------------------*/ - -mark { - background-color: rgba(255, 255, 51, 0.5); - border-bottom: 2px solid rgba(255, 153, 51, 0.3); - padding: 1px; -} - -/* vertical spacing after htmlwidgets */ -.html-widget { - margin-bottom: 10px; -} - -/* fontawesome ------------------------ */ - -.fab { - font-family: "Font Awesome 5 Brands" !important; -} - -/* don't display links in code chunks when printing */ -/* source: https://stackoverflow.com/a/10781533 */ -@media print { - code a:link:after, code a:visited:after { - content: ""; - } -} - -/* Section anchors --------------------------------- - Added in pandoc 2.11: https://github.com/jgm/pandoc-templates/commit/9904bf71 -*/ - -div.csl-bib-body { } -div.csl-entry { - clear: both; -} -.hanging-indent div.csl-entry { - margin-left:2em; - text-indent:-2em; -} -div.csl-left-margin { - min-width:2em; - float:left; -} -div.csl-right-inline { - margin-left:2em; - padding-left:1em; -} -div.csl-indent { - margin-left: 2em; -} diff --git a/docs/pkgdown.js b/docs/pkgdown.js deleted file mode 100644 index 6f0eee40..00000000 --- a/docs/pkgdown.js +++ /dev/null @@ -1,108 +0,0 @@ -/* http://gregfranko.com/blog/jquery-best-practices/ */ -(function($) { - $(function() { - - $('.navbar-fixed-top').headroom(); - - $('body').css('padding-top', $('.navbar').height() + 10); - $(window).resize(function(){ - $('body').css('padding-top', $('.navbar').height() + 10); - }); - - $('[data-toggle="tooltip"]').tooltip(); - - var cur_path = paths(location.pathname); - var links = $("#navbar ul li a"); - var max_length = -1; - var pos = -1; - for (var i = 0; i < links.length; i++) { - if (links[i].getAttribute("href") === "#") - continue; - // Ignore external links - if (links[i].host !== location.host) - continue; - - var nav_path = paths(links[i].pathname); - - var length = prefix_length(nav_path, cur_path); - if (length > max_length) { - max_length = length; - pos = i; - } - } - - // Add class to parent
  • , and enclosing
  • if in dropdown - if (pos >= 0) { - var menu_anchor = $(links[pos]); - menu_anchor.parent().addClass("active"); - menu_anchor.closest("li.dropdown").addClass("active"); - } - }); - - function paths(pathname) { - var pieces = pathname.split("/"); - pieces.shift(); // always starts with / - - var end = pieces[pieces.length - 1]; - if (end === "index.html" || end === "") - pieces.pop(); - return(pieces); - } - - // Returns -1 if not found - function prefix_length(needle, haystack) { - if (needle.length > haystack.length) - return(-1); - - // Special case for length-0 haystack, since for loop won't run - if (haystack.length === 0) { - return(needle.length === 0 ? 0 : -1); - } - - for (var i = 0; i < haystack.length; i++) { - if (needle[i] != haystack[i]) - return(i); - } - - return(haystack.length); - } - - /* Clipboard --------------------------*/ - - function changeTooltipMessage(element, msg) { - var tooltipOriginalTitle=element.getAttribute('data-original-title'); - element.setAttribute('data-original-title', msg); - $(element).tooltip('show'); - element.setAttribute('data-original-title', tooltipOriginalTitle); - } - - if(ClipboardJS.isSupported()) { - $(document).ready(function() { - var copyButton = ""; - - $("div.sourceCode").addClass("hasCopyButton"); - - // Insert copy buttons: - $(copyButton).prependTo(".hasCopyButton"); - - // Initialize tooltips: - $('.btn-copy-ex').tooltip({container: 'body'}); - - // Initialize clipboard: - var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { - text: function(trigger) { - return trigger.parentNode.textContent.replace(/\n#>[^\n]*/g, ""); - } - }); - - clipboardBtnCopies.on('success', function(e) { - changeTooltipMessage(e.trigger, 'Copied!'); - e.clearSelection(); - }); - - clipboardBtnCopies.on('error', function() { - changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); - }); - }); - } -})(window.jQuery || window.$) diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml deleted file mode 100644 index 1c674370..00000000 --- a/docs/pkgdown.yml +++ /dev/null @@ -1,10 +0,0 @@ -pandoc: 3.1.1 -pkgdown: 2.0.7 -pkgdown_sha: ~ -articles: - examples: examples.html - handling_LOQ: handling_LOQ.html - intro-poped: intro-poped.html - model_def_other_pkgs: model_def_other_pkgs.html -last_built: 2023-11-08T15:36Z - diff --git a/docs/reference/Doptim.html b/docs/reference/Doptim.html deleted file mode 100644 index 855560c9..00000000 --- a/docs/reference/Doptim.html +++ /dev/null @@ -1,469 +0,0 @@ - -D-family optimization function — Doptim • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Optimize the objective function. There are 4 different optimization -algorithms used in this function

    1. Adaptive random search. -See RS_opt.

    2. -
    3. Stochastic gradient.

    4. -
    5. A Broyden Fletcher -Goldfarb Shanno (BFGS) method for nonlinear minimization with box -constraints.

    6. -
    7. A line search. See a_line_search.

    8. -

    The -optimization algorithms run in series, taking as input the output from the -previous method. The stopping rule used is to test if the line search -algorithm fids a better optimum then its initial value. If so, then the chain -of algorithms is run again. If line search is not used then the argument -iter_tot defines the number of times the chain of algorithms is run. -This function takes information from the PopED database supplied as an -argument. The PopED database supplies information about the the model, -parameters, design and methods to use. Some of the arguments coming from the -PopED database can be overwritten; if they are supplied then they are used -instead of the arguments from the PopED database.

    -
    - -
    -
    Doptim(
    -  poped.db,
    -  ni,
    -  xt,
    -  model_switch,
    -  x,
    -  a,
    -  bpopdescr,
    -  ddescr,
    -  maxxt,
    -  minxt,
    -  maxa,
    -  mina,
    -  fmf = 0,
    -  dmf = 0,
    -  trflag = TRUE,
    -  bUseRandomSearch = poped.db$settings$bUseRandomSearch,
    -  bUseStochasticGradient = poped.db$settings$bUseStochasticGradient,
    -  bUseBFGSMinimizer = poped.db$settings$bUseBFGSMinimizer,
    -  bUseLineSearch = poped.db$settings$bUseLineSearch,
    -  sgit = poped.db$settings$sgit,
    -  ls_step_size = poped.db$settings$ls_step_size,
    -  BFGSConvergenceCriteriaMinStep = poped.db$settings$BFGSConvergenceCriteriaMinStep,
    -  BFGSProjectedGradientTol = poped.db$settings$BFGSProjectedGradientTol,
    -  BFGSTolerancef = poped.db$settings$BFGSTolerancef,
    -  BFGSToleranceg = poped.db$settings$BFGSToleranceg,
    -  BFGSTolerancex = poped.db$settings$BFGSTolerancex,
    -  iter_tot = poped.db$settings$iNumSearchIterationsIfNotLineSearch,
    -  iter_max = 10,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    xt
    -

    A matrix of sample times. Each row is a vector of sample times for a group.

    - - -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    a
    -

    A matrix of covariates. Each row is a group.

    - - -
    bpopdescr
    -

    Matrix defining the fixed effects, per row (row number = -parameter_number) we should have:

    • column 1 the type of the -distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, 3 = -User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the -distribution (or length of uniform distribution).

    • -
    - - -
    ddescr
    -

    Matrix defining the diagonals of the IIV (same logic as for -the bpopdescr).

    - - -
    maxxt
    -

    Matrix or single value defining the maximum value for each xt sample. If a single value is -supplied then all xt values are given the same maximum value.

    - - -
    minxt
    -

    Matrix or single value defining the minimum value for each xt sample. If a single value is -supplied then all xt values are given the same minimum value

    - - -
    maxa
    -

    Vector defining the max value for each covariate. If a single value is supplied then -all a values are given the same max value

    - - -
    mina
    -

    Vector defining the min value for each covariate. If a single value is supplied then -all a values are given the same max value

    - - -
    fmf
    -

    The initial value of the FIM. If set to zero then it is computed.

    - - -
    dmf
    -

    The initial OFV. If set to zero then it is computed.

    - - -
    trflag
    -

    Should the optimization be output to the screen and to a file?

    - - -
    bUseRandomSearch
    -
    • ******START OF Optimization algorithm SPECIFICATION OPTIONS**********

    • -

    Use random search (1=TRUE, 0=FALSE)

    - - -
    bUseStochasticGradient
    -

    Use Stochastic Gradient search (1=TRUE, 0=FALSE)

    - - -
    bUseBFGSMinimizer
    -

    Use BFGS Minimizer (1=TRUE, 0=FALSE)

    - - -
    bUseLineSearch
    -

    Use Line search (1=TRUE, 0=FALSE)

    - - -
    sgit
    -

    Number of stochastic gradient iterations

    - - -
    ls_step_size
    -

    Number of grid points in the line search.

    - - -
    BFGSConvergenceCriteriaMinStep
    -

    BFGS Minimizer Convergence Criteria Minimum Step

    - - -
    BFGSProjectedGradientTol
    -

    BFGS Minimizer Convergence Criteria Normalized Projected Gradient Tolerance

    - - -
    BFGSTolerancef
    -

    BFGS Minimizer Line Search Tolerance f

    - - -
    BFGSToleranceg
    -

    BFGS Minimizer Line Search Tolerance g

    - - -
    BFGSTolerancex
    -

    BFGS Minimizer Line Search Tolerance x

    - - -
    iter_tot
    -

    Number of iterations to use if line search is not used. Must -be less than iter_max to be used.

    - - -
    iter_max
    -

    If line search is used then the algorithm tests if line -search (always run at the end of the optimization iteration) changes the -design in any way. If not, the algorithm stops. If yes, then a new -iteration is run unless iter_max iterations have already been run.

    - - -
    ...
    -

    arguments passed to evaluate.fim and ofv_fim.

    - -
    -
    -

    References

    - -
    1. M. Foracchia, A.C. Hooker, P. Vicini and A. - Ruggeri, "PopED, a software for optimal experimental design in population - kinetics", Computer Methods and Programs in Biomedicine, 74, 2004.

    2. -
    3. J. - Nyberg, S. Ueckert, E.A. Stroemberg, S. Hennig, M.O. Karlsson and A.C. - Hooker, "PopED: An extended, parallelized, nonlinear mixed effects models - optimal design tool", Computer Methods and Programs in Biomedicine, 108, - 2012.

    4. -
    - - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -if (FALSE) {
    -  
    -  ##############
    -  # typically one will use poped_optimize 
    -  # This then calls Doptim for continuous optimization problems
    -  ##############
    -  
    -  
    -  # RS+SG+LS optimization of sample times
    -  # optimization with just a few iterations
    -  # only to check that things are working
    -  output <- poped_optimize(poped.db,opt_xt=T,
    -                           rsit=5,sgit=5,ls_step_size=5)
    -  
    -  # RS+SG+LS optimization of sample times 
    -  # (longer run time than above but more likely to reach a maximum)
    -  output <- poped_optimize(poped.db,opt_xt=T)
    -  get_rse(output$fmf,output$poped.db)
    -  plot_model_prediction(output$poped.db)
    -  
    -  
    -  # Random search (just a few samples here)
    -  rs.output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,rsit=20,
    -                              bUseRandomSearch= 1,
    -                              bUseStochasticGradient = 0,
    -                              bUseBFGSMinimizer = 0,
    -                              bUseLineSearch = 0)
    -  
    -  # line search, DOSE and sample time optimization
    -  ls.output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,
    -                              bUseRandomSearch= 0,
    -                              bUseStochasticGradient = 0,
    -                              bUseBFGSMinimizer = 0,
    -                              bUseLineSearch = 1,
    -                              ls_step_size=10)
    -  
    -  # Stochastic gradient search, DOSE and sample time optimization
    -  sg.output <- poped_optimize(poped.db,opt_xt=1,opt_a=1, 
    -                              bUseRandomSearch= 0,
    -                              bUseStochasticGradient = 1,
    -                              bUseBFGSMinimizer = 0,
    -                              bUseLineSearch = 0,
    -                              sgit=20)
    -  
    -  # BFGS search, DOSE and sample time optimization
    -  bfgs.output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,
    -                                bUseRandomSearch= 0,
    -                                bUseStochasticGradient = 0,
    -                                bUseBFGSMinimizer = 1,
    -                                bUseLineSearch = 0)
    -
    -  ##############
    -  # If you really want to you can use Doptim dirtectly
    -  ##############
    -  dsl <- downsizing_general_design(poped.db)
    -  poped.db$settings$optsw[2] <- 1  # sample time optimization
    -  output <- Doptim(poped.db,dsl$ni, dsl$xt, dsl$model_switch, dsl$x, dsl$a, 
    -         dsl$bpop, dsl$d, dsl$maxxt, dsl$minxt,dsl$maxa,dsl$mina) 
    -  
    -}
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/Dtrace.html b/docs/reference/Dtrace.html deleted file mode 100644 index 0548e487..00000000 --- a/docs/reference/Dtrace.html +++ /dev/null @@ -1,408 +0,0 @@ - -Trace optimization routines — Dtrace • PopED - - -
    -
    - - - -
    -
    - - -
    -

    A helper function for writing output to the screen and files when optimizing.

    -
    - -
    -
    Dtrace(
    -  fn,
    -  it,
    -  ni,
    -  xtopt,
    -  xopt,
    -  aopt,
    -  gxt,
    -  ga,
    -  dmf,
    -  diff,
    -  ixt,
    -  ia,
    -  itvector,
    -  dmfvector,
    -  poped.db,
    -  opt_xt = poped.db$settings$optsw[2],
    -  opt_a = poped.db$settings$optsw[4],
    -  opt_x = poped.db$settings$optsw[3],
    -  opt_samps = poped.db$settings$optsw[1],
    -  opt_inds = poped.db$settings$optsw[5],
    -  rsit = poped.db$settings$rsit,
    -  convergence_eps = poped.db$settings$convergence_eps
    -)
    -
    - -
    -

    Arguments

    -
    fn
    -

    A file to output information to. Can also be the screen if ''.

    - - -
    it
    -

    the iteration number.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    xtopt
    -

    The matrix defining current best sampling schedule.

    - - -
    xopt
    -

    The cell structure defining the current best discrete design variables.

    - - -
    aopt
    -

    The matrix defining the current best continuous design variables.

    - - -
    gxt
    -

    The matrix defining the current gradient of the xt vector.

    - - -
    ga
    -

    The matrix defining the current gradient for the continuous design variables.

    - - -
    dmf
    -

    The current OFV.

    - - -
    diff
    -

    The difference from the previous iteration.

    - - -
    ixt
    -

    If xt Gradient Inversion occurred or not.

    - - -
    ia
    -

    If a Gradient Inversion occurred or not.

    - - -
    itvector
    -

    The iteration vector. Not currently used.

    - - -
    dmfvector
    -

    The dmf vector. Not currently used.

    - - -
    poped.db
    -

    A PopED database.

    - - -
    opt_xt
    -

    Should the sample times be optimized?

    - - -
    opt_a
    -

    Should the continuous design variables be optimized?

    - - -
    opt_x
    -

    Should the discrete design variables be optimized?

    - - -
    opt_samps
    -

    Are the number of sample times per group being optimized?

    - - -
    opt_inds
    -

    Are the number of individuals per group being optimized?

    - - -
    rsit
    -

    Number of Random search iterations

    - - -
    convergence_eps
    -

    Stochastic Gradient convergence value, -(difference in OFV for D-optimal, difference in gradient for ED-optimal)

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -FIM <- evaluate.fim(poped.db) 
    -dmf <- det(FIM)
    -
    -Dtrace(fn="",
    -       it=1,
    -       ni=poped.db$design$ni,
    -       xtopt=poped.db$design$xt,
    -       xopt=poped.db$design$x,
    -       aopt=poped.db$design$a,
    -       gxt=0,ga=0,
    -       dmf=dmf,diff=3,
    -       ixt=FALSE,
    -       ia=FALSE, 
    -       itvector=NULL,
    -       dmfvector=NULL,
    -       poped.db,
    -       opt_xt=poped.db$settings$optsw[2],
    -       opt_a=poped.db$settings$optsw[4],opt_x=poped.db$settings$optsw[3],
    -       opt_samps=poped.db$settings$optsw[1],opt_inds=poped.db$settings$optsw[5],
    -       rsit=200)
    -#> RS - It. : 1   OFV : 1.14386e+24
    -
    -Dtrace(fn="",
    -       it=1,
    -       ni=poped.db$design$ni,
    -       xtopt=poped.db$design$xt,
    -       xopt=poped.db$design$x,
    -       aopt=poped.db$design$a,
    -       gxt=0,ga=0,
    -       dmf=dmf,diff=3,
    -       ixt=FALSE,
    -       ia=FALSE, 
    -       itvector=NULL,
    -       dmfvector=NULL,
    -       poped.db,
    -       opt_xt=poped.db$settings$optsw[2],
    -       opt_a=poped.db$settings$optsw[4],opt_x=poped.db$settings$optsw[3],
    -       opt_samps=poped.db$settings$optsw[1],opt_inds=poped.db$settings$optsw[5],
    -       rsit=0)
    -#> SG - It. : 1  OFV : 1.144e+24   Diff. :     3
    -
    -Dtrace(fn="",
    -       it=1,
    -       ni=poped.db$design$ni,
    -       xtopt=poped.db$design$xt,
    -       xopt=poped.db$design$x,
    -       aopt=poped.db$design$a,
    -       gxt=0,ga=0,
    -       dmf=dmf,diff=3,
    -       ixt=FALSE,
    -       ia=FALSE, 
    -       itvector=NULL,
    -       dmfvector=NULL,
    -       poped.db,
    -       opt_xt=poped.db$settings$optsw[2],
    -       opt_a=poped.db$settings$optsw[4],opt_x=poped.db$settings$optsw[3],
    -       opt_samps=poped.db$settings$optsw[1],opt_inds=poped.db$settings$optsw[5],
    -       rsit=1)
    -#> RS - It. : 1   OFV : 1.14386e+24
    -#> 
    -#> *******************************
    -#> RS Results
    -#>  OFV(mf) = 1.14386e+24
    -#> 
    -#> *********************************
    -#> 
    -
    -Dtrace(fn="",
    -       it=1,
    -       ni=poped.db$design$ni,
    -       xtopt=poped.db$design$xt,
    -       xopt=poped.db$design$x,
    -       aopt=poped.db$design$a,
    -       gxt=0,ga=0,
    -       dmf=dmf,
    -       diff=0,
    -       ixt=FALSE,
    -       ia=FALSE, 
    -       itvector=NULL,
    -       dmfvector=NULL,
    -       poped.db,
    -       opt_xt=poped.db$settings$optsw[2],
    -       opt_a=poped.db$settings$optsw[4],opt_x=poped.db$settings$optsw[3],
    -       opt_samps=poped.db$settings$optsw[1],opt_inds=poped.db$settings$optsw[5],
    -       rsit=1)
    -#> RS - It. : 1   OFV : 1.14386e+24
    -#> 
    -#> *******************************
    -#> RS Results
    -#>  OFV(mf) = 1.14386e+24
    -#> 
    -#> *********************************
    -#> 
    -
    -Dtrace(fn="",
    -       it=5,
    -       ni=poped.db$design$ni,
    -       xtopt=poped.db$design$xt,
    -       xopt=poped.db$design$x,
    -       aopt=poped.db$design$a,
    -       gxt=0,ga=0,
    -       dmf=dmf,
    -       diff=0,
    -       ixt=FALSE,
    -       ia=FALSE, 
    -       itvector=NULL,
    -       dmfvector=NULL,
    -       poped.db,
    -       opt_xt=poped.db$settings$optsw[2],
    -       opt_a=poped.db$settings$optsw[4],opt_x=poped.db$settings$optsw[3],
    -       opt_samps=poped.db$settings$optsw[1],opt_inds=poped.db$settings$optsw[5],
    -       rsit=1)
    -#> SG - It. : 4  OFV : 1.144e+24   Diff. :     0
    -#> 
    -#> SG - Iteration 4 --------- FINAL -------------------------
    -#> OFV(mf)    : 1.14386e+24
    -#> diff       : 0
    -#> *************************************************************
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/LEDoptim.html b/docs/reference/LEDoptim.html deleted file mode 100644 index b09ffdf2..00000000 --- a/docs/reference/LEDoptim.html +++ /dev/null @@ -1,409 +0,0 @@ - -Optimization function for D-family, E-family and Laplace approximated ED designs — LEDoptim • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Optimize the objective function for D-family, E-family and Laplace approximated ED designs. -Right now there is only one optimization algorithm used in this -function

    1. Adaptive random search. See RS_opt.

    2. -

    This function takes information from the PopED database supplied as an argument. -The PopED database supplies information about the the model, parameters, design and methods to use. -Some of the arguments coming from the PopED database can be overwritten; -if they are supplied then they are used instead of the arguments from the PopED database.

    -
    - -
    -
    LEDoptim(
    -  poped.db,
    -  model_switch = NULL,
    -  ni = NULL,
    -  xt = NULL,
    -  x = NULL,
    -  a = NULL,
    -  bpopdescr = NULL,
    -  ddescr = NULL,
    -  maxxt = NULL,
    -  minxt = NULL,
    -  maxa = NULL,
    -  mina = NULL,
    -  ofv_init = 0,
    -  fim_init = 0,
    -  trflag = TRUE,
    -  header_flag = TRUE,
    -  footer_flag = TRUE,
    -  opt_xt = poped.db$settings$optsw[2],
    -  opt_a = poped.db$settings$optsw[4],
    -  opt_x = poped.db$settings$optsw[3],
    -  out_file = NULL,
    -  d_switch = FALSE,
    -  use_laplace = T,
    -  laplace.fim = FALSE,
    -  use_RS = poped.db$settings$bUseRandomSearch,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    xt
    -

    A matrix of sample times. Each row is a vector of sample times for a group.

    - - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    a
    -

    A matrix of covariates. Each row is a group.

    - - -
    bpopdescr
    -

    Matrix defining the fixed effects, per row (row number = -parameter_number) we should have:

    • column 1 the type of the -distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, 3 = -User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the -distribution (or length of uniform distribution).

    • -
    - - -
    ddescr
    -

    Matrix defining the diagonals of the IIV (same logic as for -the bpopdescr).

    - - -
    maxxt
    -

    Matrix or single value defining the maximum value for each xt sample. If a single value is -supplied then all xt values are given the same maximum value.

    - - -
    minxt
    -

    Matrix or single value defining the minimum value for each xt sample. If a single value is -supplied then all xt values are given the same minimum value

    - - -
    maxa
    -

    Vector defining the max value for each covariate. If a single value is supplied then -all a values are given the same max value

    - - -
    mina
    -

    Vector defining the min value for each covariate. If a single value is supplied then -all a values are given the same max value

    - - -
    ofv_init
    -

    The initial OFV. If set to zero then it is computed.

    - - -
    fim_init
    -

    The initial value of the FIM. If set to zero then it is computed.

    - - -
    trflag
    -

    Should the optimization be output to the screen and to a file?

    - - -
    header_flag
    -

    Should the header text be printed out?

    - - -
    footer_flag
    -

    Should the footer text be printed out?

    - - -
    opt_xt
    -

    Should the sample times be optimized?

    - - -
    opt_a
    -

    Should the continuous design variables be optimized?

    - - -
    opt_x
    -

    Should the discrete design variables be optimized?

    - - -
    out_file
    -

    Which file should the output be directed to? A string, a file handle using -file or "" will output to the screen.

    - - -
    d_switch
    -
    • ******START OF CRITERION SPECIFICATION OPTIONS**********

    • -

    D-family design (1) or ED-family design (0) (with or without parameter uncertainty)

    - - -
    use_laplace
    -

    Should the Laplace method be used in calculating the expectation of the OFV?

    - - -
    laplace.fim
    -

    Should an E(FIM) be calculated when computing the Laplace approximated E(OFV). Typically -the FIM does not need to be computed and, if desired, this calculation -is done using the standard MC integration technique, so can be slow.

    - - -
    use_RS
    -

    should the function use a random search algorithm?

    - - -
    ...
    -

    arguments passed to evaluate.fim and ofv_fim.

    - -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization
    -##  with parameter uncertainty)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error
    -## to avoid sample times at very low concentrations (time 0 or very late samoples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -# Adding 10% log-normal Uncertainty to fixed effects (not Favail)
    -bpop_vals <- c(CL=0.15, V=8, KA=1.0, Favail=1)
    -bpop_vals_ed_ln <- cbind(ones(length(bpop_vals),1)*4, # log-normal distribution
    -                         bpop_vals,
    -                         ones(length(bpop_vals),1)*(bpop_vals*0.1)^2) # 10% of bpop value
    -bpop_vals_ed_ln["Favail",]  <- c(0,1,0)
    -bpop_vals_ed_ln
    -#>          bpop_vals         
    -#> CL     4      0.15 0.000225
    -#> V      4      8.00 0.640000
    -#> KA     4      1.00 0.010000
    -#> Favail 0      1.00 0.000000
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=bpop_vals_ed_ln, 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(0.01,0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0,
    -                                  maxxt=120,
    -                                  a=70,
    -                                  mina=0,
    -                                  maxa=100)
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization
    -##  with parameter uncertainty)
    -#####################################
    -
    -# warfarin ed model
    -
    -if (FALSE) {
    -  
    -  LEDoptim(poped.db) 
    -  
    -  LEDoptim(poped.db,opt_xt=T,rsit=10) 
    -  
    -  LEDoptim(poped.db,opt_xt=T,rsit=10,d_switch=TRUE) 
    -
    -  LEDoptim(poped.db,opt_xt=T,rsit=10,laplace.fim=TRUE) 
    -  
    -  LEDoptim(poped.db,opt_xt=T,rsit=10,use_laplace=FALSE) 
    -  
    -  ## testing header and footer
    -  LEDoptim(poped.db,opt_xt=T,rsit=10,d_switch=TRUE,
    -           out_file="foobar.txt") 
    -  
    -  ff <- LEDoptim(poped.db,opt_xt=T,rsit=10,d_switch=TRUE,
    -                 trflag=FALSE) 
    -  
    -  LEDoptim(poped.db,opt_xt=T,rsit=10,d_switch=TRUE,
    -           header_flag=FALSE) 
    -  
    -  LEDoptim(poped.db,opt_xt=T,rsit=10,d_switch=TRUE,
    -           out_file="") 
    -  
    -  LEDoptim(poped.db,opt_xt=T,rsit=10,d_switch=TRUE,
    -           footer_flag=FALSE) 
    -  
    -  LEDoptim(poped.db,opt_xt=T,rsit=10,d_switch=TRUE,
    -           footer_flag=FALSE, header_flag=FALSE) 
    -  
    -  LEDoptim(poped.db,opt_xt=T,rsit=10,d_switch=TRUE,
    -           footer_flag=FALSE, header_flag=FALSE,out_file="foobar.txt") 
    -  
    -  LEDoptim(poped.db,opt_xt=T,rsit=10,d_switch=TRUE,
    -           footer_flag=FALSE, header_flag=FALSE,out_file="") 
    -
    -}
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/LinMatrixH.html b/docs/reference/LinMatrixH.html deleted file mode 100644 index 92896323..00000000 --- a/docs/reference/LinMatrixH.html +++ /dev/null @@ -1,169 +0,0 @@ - -Model linearization with respect to epsilon. — LinMatrixH • PopED - - -
    -
    - - - -
    -
    - - -
    -

    The function performs a linearization of the model with respect to the residual variability. -Derivative of model w.r.t. eps evaluated at eps=0

    -
    - -
    -
    LinMatrixH(model_switch, xt_ind, x, a, bpop, b_ind, bocc_ind, poped.db)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    xt_ind
    -

    A vector of the individual/group sample times

    - - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    a
    -

    A matrix of covariates. Each row is a group.

    - - -
    bpop
    -

    The fixed effects parameter values. Supplied as a vector.

    - - -
    b_ind
    -

    vector of individual realization of the BSV terms b

    - - -
    bocc_ind
    -

    Vector of individual realizations of the BOV terms bocc

    - - -
    poped.db
    -

    A PopED database.

    - -
    -
    -

    Value

    - - -

    A matrix of size (samples per individual x number of epsilons)

    -
    -
    -

    See also

    - -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/LinMatrixL.html b/docs/reference/LinMatrixL.html deleted file mode 100644 index c88add22..00000000 --- a/docs/reference/LinMatrixL.html +++ /dev/null @@ -1,245 +0,0 @@ - -The linearized matrix L — LinMatrixL • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Function computes the derivative of the model with respect to the between subject variability -terms in the model (b's and bocc's) evaluated at -a defined point -(b_ind and bocc_ind).

    -
    - -
    -
    LinMatrixL(model_switch, xt_ind, x, a, bpop, b_ind, bocc_ind, poped.db)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    A vector that is the same size as xt, specifying which model each sample belongs to.

    - - -
    x
    -

    A vector for the discrete design variables.

    - - -
    a
    -

    A vector of covariates.

    - - -
    bpop
    -

    The fixed effects parameter values. Supplied as a vector.

    - - -
    b_ind
    -

    The point at which to evaluate the derivative

    - - -
    bocc_ind
    -

    The point at which to evaluate the derivative

    - - -
    poped.db
    -

    A PopED database.

    - -
    -
    -

    Value

    - - -

    As a list:

    -
    y
    -

    A matrix of size (samples per individual x number of random effects)

    - -
    poped.db
    -

    A PopED database

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -#for the FO approximation
    -ind=1
    -LinMatrixL(model_switch=t(poped.db$design$model_switch[ind,,drop=FALSE]),
    -          xt_ind=t(poped.db$design$xt[ind,,drop=FALSE]),
    -          x=zeros(0,1),
    -          a=t(poped.db$design$a[ind,,drop=FALSE]),
    -          bpop=poped.db$parameters$bpop[,2,drop=FALSE],
    -          b_ind=zeros(poped.db$parameters$NumRanEff,1),
    -          bocc_ind=zeros(poped.db$parameters$NumDocc,1),
    -          poped.db)["y"]
    -#> $y
    -#>             [,1]       [,2]        [,3]
    -#> [1,] -0.01736446 -3.4080713  2.63882264
    -#> [2,] -0.05954832 -5.4115558  3.17591023
    -#> [3,] -0.18102648 -7.2011569  2.27256206
    -#> [4,] -0.74460344 -7.2016770 -0.01921862
    -#> [5,] -2.44998833 -3.2358678 -0.10864692
    -#> [6,] -2.97791129 -1.5623370 -0.08675634
    -#> [7,] -3.07661786  0.7649213 -0.04417255
    -#> [8,] -2.09673861  1.1568729 -0.01795922
    -#> 
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/LinMatrixLH.html b/docs/reference/LinMatrixLH.html deleted file mode 100644 index bcded63f..00000000 --- a/docs/reference/LinMatrixLH.html +++ /dev/null @@ -1,277 +0,0 @@ - -Model linearization with respect to epsilon and eta. — LinMatrixLH • PopED - - -
    -
    - - - -
    -
    - - -
    -

    The function performs a linearization of the model with respect to the residual variability and -then the between subject variability. -Derivative of model w.r.t. eps then eta, evaluated at eps=0 and b=b_ind.

    -
    - -
    -
    LinMatrixLH(
    -  model_switch,
    -  xt_ind,
    -  x,
    -  a,
    -  bpop,
    -  b_ind,
    -  bocc_ind,
    -  NumEPS,
    -  poped.db
    -)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    xt_ind
    -

    A vector of the individual/group sample times

    - - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    a
    -

    A matrix of covariates. Each row is a group.

    - - -
    bpop
    -

    The fixed effects parameter values. Supplied as a vector.

    - - -
    b_ind
    -

    vector of individual realization of the BSV terms b

    - - -
    bocc_ind
    -

    Vector of individual realizations of the BOV terms bocc

    - - -
    NumEPS
    -

    The number of eps() terms in the model.

    - - -
    poped.db
    -

    A PopED database.

    - -
    -
    -

    Value

    - - -

    A matrix of size (samples per individual x (number of sigma x number of omega))

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -#for the FOI approximation
    -ind=1
    -poped.db$settings$iApproximationMethod=3 # FOI approximation method
    -
    -LinMatrixLH(model_switch=t(poped.db$design$model_switch[ind,,drop=FALSE]),
    -          xt_ind=t(poped.db$design$xt[ind,,drop=FALSE]),
    -          x=zeros(0,1),
    -          a=t(poped.db$design$a[ind,,drop=FALSE]),
    -          bpop=poped.db$parameters$bpop[,2,drop=FALSE],
    -          b_ind=zeros(poped.db$parameters$NumRanEff,1),
    -          bocc_ind=zeros(poped.db$parameters$NumDocc,1),
    -          NumEPS=size(poped.db$parameters$sigma,1),
    -          poped.db)["y"]
    -#> $y
    -#>             [,1] [,2]       [,3] [,4]        [,5] [,6]
    -#> [1,] -0.01736389    0 -3.4080716    0  2.63882249    0
    -#> [2,] -0.05954792    0 -5.4115556    0  3.17591065    0
    -#> [3,] -0.18102853    0 -7.2011552    0  2.27256214    0
    -#> [4,] -0.74460438    0 -7.2016748    0 -0.01922018    0
    -#> [5,] -2.44998688    0 -3.2358671    0 -0.10864643    0
    -#> [6,] -2.97791125    0 -1.5623369    0 -0.08675727    0
    -#> [7,] -3.07661785    0  0.7649203    0 -0.04417244    0
    -#> [8,] -2.09673889    0  1.1568727    0 -0.01795897    0
    -#> 
    -
    -  
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/LinMatrixL_occ.html b/docs/reference/LinMatrixL_occ.html deleted file mode 100644 index 4c776b1f..00000000 --- a/docs/reference/LinMatrixL_occ.html +++ /dev/null @@ -1,266 +0,0 @@ - -Model linearization with respect to occasion variability parameters. — LinMatrixL_occ • PopED - - -
    -
    - - - -
    -
    - - -
    -

    The function performs a linearization of the model with respect to the occasion variability parameter.. -Derivative of model w.r.t. eta_occ, evaluated bocc_ind.

    -
    - -
    -
    LinMatrixL_occ(
    -  model_switch,
    -  xt_ind,
    -  x,
    -  a,
    -  bpop,
    -  b_ind,
    -  bocc_ind,
    -  iCurrentOcc,
    -  poped.db
    -)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    xt_ind
    -

    A vector of the individual/group sample times

    - - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    a
    -

    A matrix of covariates. Each row is a group.

    - - -
    bpop
    -

    The fixed effects parameter values. Supplied as a vector.

    - - -
    b_ind
    -

    vector of individual realization of the BSV terms b

    - - -
    bocc_ind
    -

    Vector of individual realizations of the BOV terms bocc

    - - -
    iCurrentOcc
    -

    The current occasion.

    - - -
    poped.db
    -

    A PopED database.

    - -
    -
    -

    Value

    - - -

    A matrix of size (samples per individual x number of iovs)

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -#for the FO approximation
    -ind=1
    -
    -# no occasion defined in this example, so result is zero
    -LinMatrixL_occ(model_switch=t(poped.db$design$model_switch[ind,,drop=FALSE]),
    -          xt_ind=t(poped.db$design$xt[ind,,drop=FALSE]),
    -          x=zeros(0,1),
    -          a=t(poped.db$design$a[ind,,drop=FALSE]),
    -          bpop=poped.db$parameters$bpop[,2,drop=FALSE],
    -          b_ind=zeros(poped.db$parameters$NumRanEff,1),
    -          bocc_ind=zeros(poped.db$parameters$NumDocc,1),
    -          iCurrentOcc=1,
    -          poped.db)["y"]
    -#> $y
    -#> [1] 0
    -#> 
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/PopED-1.png b/docs/reference/PopED-1.png deleted file mode 100644 index a6c8b544..00000000 Binary files a/docs/reference/PopED-1.png and /dev/null differ diff --git a/docs/reference/PopED-2.png b/docs/reference/PopED-2.png deleted file mode 100644 index fd0a74d1..00000000 Binary files a/docs/reference/PopED-2.png and /dev/null differ diff --git a/docs/reference/PopED.html b/docs/reference/PopED.html deleted file mode 100644 index 060c1dbf..00000000 --- a/docs/reference/PopED.html +++ /dev/null @@ -1,302 +0,0 @@ - -PopED - Population (and individual) optimal Experimental Design. — PopED • PopED - - -
    -
    - - - -
    -
    - - -
    -

    PopED computes optimal experimental designs for both -population and individual studies based on nonlinear mixed-effect models. -Often this is based on a computation of the Fisher Information Matrix (FIM).

    -
    - - -
    -

    Details

    -

    To get started you need to define

    1. A model.

    2. -
    3. An initial design (and design space if you want to optimize).

    4. -
    5. The tasks to perform.

    6. -

    There are a number of functions to help you with these tasks. The user-level functions defined below are -meant to be run with a minimum of arguments (for beginners to advanced users). Many of the other functions in the package -(and not listed here) are called by these user-level functions -and are often not as user -friendly (developer level or advanced user functions).

    -

    Define a structural model: -ff.PK.1.comp.oral.md.CL, - ff.PK.1.comp.oral.md.KE, - ff.PK.1.comp.oral.sd.CL, - ff.PK.1.comp.oral.sd.KE, - ff.PKPD.1.comp.oral.md.CL.imax, - ff.PKPD.1.comp.sd.CL.emax.

    -

    Define a residual unexplained variability model (residual error model): -feps.add.prop, -feps.add, -feps.prop.

    -

    Create an initial study design (and design space): -create.poped.database.

    -

    Evaluate the model and/or design through simulation and graphics: -plot_model_prediction, -model_prediction, -plot_efficiency_of_windows.

    -

    Evaluate the design using the FIM: -evaluate_design, -evaluate.fim, -evaluate.e.ofv.fim, -ofv_fim, -get_rse.

    -

    Optimize the design (evaluate afterwards using the above functions): -poped_optim,

    -

    See the "Examples" section below for a short introduction to using the above functions. -There are several other examples, as r-scripts, in the "examples" folder in the -PopED installation directory located at (run at the R command line):

    -

    system.file("examples", package="PopED").

    -
    -
    -

    References

    - -
    1. J. Nyberg, S. Ueckert, E.A. Stroemberg, S. Hennig, M.O. Karlsson and A.C. Hooker, "PopED: An extended, -parallelized, nonlinear mixed effects models optimal design tool", -Computer Methods and Programs in Biomedicine, 108, 2012.

    2. -
    3. M. Foracchia, A.C. Hooker, P. Vicini and A. Ruggeri, "PopED, a software for optimal -experimental design in population kinetics", Computer Methods and Programs in Biomedicine, 74, 2004.

    4. -
    5. https://andrewhooker.github.io/PopED/

    6. -
    - -
    -

    Examples

    -
    
    -library(PopED)
    -
    -##-- Model: One comp first order absorption
    -## -- Analytic solution for both mutiple and single dosing
    -ff <- function(model_switch,xt,parameters,poped.db){
    -  with(as.list(parameters),{
    -    y=xt 
    -    N = floor(xt/TAU)+1
    -    y=(DOSE*Favail/V)*(KA/(KA - CL/V)) * 
    -      (exp(-CL/V * (xt - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - exp(-CL/V * TAU)) - 
    -         exp(-KA * (xt - (N - 1) * TAU)) * (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU)))  
    -    return(list( y=y,poped.db=poped.db))
    -  })
    -}
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c( V=bpop[1]*exp(b[1]),
    -                KA=bpop[2]*exp(b[2]),
    -                CL=bpop[3]*exp(b[3]),
    -                Favail=bpop[4],
    -                DOSE=a[1],
    -                TAU=a[2])
    -  return( parameters ) 
    -}
    -
    -## -- Residual unexplained variablity (RUV) function
    -## -- Additive + Proportional  
    -feps <- function(model_switch,xt,parameters,epsi,poped.db){
    -  returnArgs <- do.call(poped.db$model$ff_pointer,list(model_switch,xt,parameters,poped.db)) 
    -  y <- returnArgs[[1]]
    -  poped.db <- returnArgs[[2]]
    -  
    -  y = y*(1+epsi[,1])+epsi[,2]
    -  
    -  return(list( y= y,poped.db =poped.db )) 
    -}
    -
    -## -- Define design and design space
    -poped.db <- create.poped.database(ff_fun=ff,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps,
    -                                  bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(V=0.09,KA=0.09,CL=0.25^2), 
    -                                  sigma=c(0.04,5e-6),
    -                                  notfixed_sigma=c(0,0),
    -                                  m=2,
    -                                  groupsize=20,
    -                                  xt=c( 1,2,8,240,245),
    -                                  minxt=c(0,0,0,240,240),
    -                                  maxxt=c(10,10,10,248,248),
    -                                  bUseGrouped_xt=1,
    -                                  a=list(c(DOSE=20,TAU=24),c(DOSE=40, TAU=24)),
    -                                  maxa=c(DOSE=200,TAU=24),
    -                                  mina=c(DOSE=0,TAU=24))
    -
    -##  create plot of model without variability 
    -plot_model_prediction(poped.db, model_num_points = 300)
    -
    -
    -
    -if (FALSE) {
    -  
    -  ##  create plot of model with variability 
    -  plot_model_prediction(poped.db, IPRED=T, DV=T, separate.groups=T, model_num_points = 300)
    -  
    -}
    -
    -## evaluate initial design
    -evaluate_design(poped.db)
    -#> $ofv
    -#> [1] 28.9197
    -#> 
    -#> $fim
    -#>                V          KA           CL        d_V       d_KA        d_CL
    -#> V     0.05336692   -8.683963  -0.05863412   0.000000   0.000000    0.000000
    -#> KA   -8.68396266 2999.851007 -14.43058560   0.000000   0.000000    0.000000
    -#> CL   -0.05863412  -14.430586  37.15243290   0.000000   0.000000    0.000000
    -#> d_V   0.00000000    0.000000   0.00000000 999.953587 312.240246    3.202847
    -#> d_KA  0.00000000    0.000000   0.00000000 312.240246 439.412556    2.287838
    -#> d_CL  0.00000000    0.000000   0.00000000   3.202847   2.287838 3412.005199
    -#> 
    -#> $rse
    -#>         V        KA        CL       d_V      d_KA      d_CL 
    -#>  8.215338 10.090955  4.400304 39.833230 60.089601 27.391518 
    -#> 
    -
    -if (FALSE) {
    -  
    -  # Optimization of sample times
    -  output <- poped_optim(poped.db, opt_xt=TRUE, parallel = TRUE)
    -  summary(output)
    -  get_rse(output$FIM, output$poped.db)
    -  plot_model_prediction(output$poped.db)
    -  
    -  # Optimization of sample times and doses
    -  output_2 <- poped_optim(poped.db, opt_xt=TRUE, opt_a=TRUE, parallel = TRUE)
    -  summary(output_2)
    -  get_rse(output_2$FIM,output_2$poped.db)
    -  plot_model_prediction(output_2$poped.db)
    -  
    -  # Optimization of sample times with only integer time points in design space
    -  # faster than continuous optimization in this case
    -  poped.db.discrete <- create.poped.database(ff_fun=ff,
    -                                             fg_fun=sfg,
    -                                             fError_fun=feps,
    -                                             bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9), 
    -                                             notfixed_bpop=c(1,1,1,0),
    -                                             d=c(V=0.09,KA=0.09,CL=0.25^2), 
    -                                             sigma=c(0.04,5e-6),
    -                                             notfixed_sigma=c(0,0),
    -                                             m=2,
    -                                             groupsize=20,
    -                                             xt=c( 1,2,8,240,245),
    -                                             minxt=c(0,0,0,240,240),
    -                                             maxxt=c(10,10,10,248,248),
    -                                             discrete_xt = list(0:248),
    -                                             bUseGrouped_xt=1,
    -                                             a=list(c(DOSE=20,TAU=24),c(DOSE=40, TAU=24)),
    -                                             maxa=c(DOSE=200,TAU=24),
    -                                             mina=c(DOSE=0,TAU=24),
    -                                             ourzero = 0)
    -  
    -  output_discrete <- poped_optim(poped.db.discrete, opt_xt=T, parallel = TRUE)
    -  
    -  
    -  summary(output_discrete)
    -  get_rse(output_discrete$FIM,output_discrete$poped.db)
    -  plot_model_prediction(output_discrete$poped.db)
    -  
    -  # Efficiency of sampling windows
    -  plot_efficiency_of_windows(output_discrete$poped.db,xt_windows=0.5)
    -  plot_efficiency_of_windows(output_discrete$poped.db,xt_windows=1)
    -  
    -}
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/RS_opt.html b/docs/reference/RS_opt.html deleted file mode 100644 index 9d4b145a..00000000 --- a/docs/reference/RS_opt.html +++ /dev/null @@ -1,519 +0,0 @@ - -Optimize the objective function using an adaptive random search algorithm for D-family and E-family designs. — RS_opt • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Optimize the objective function using an adaptive random search algorithm. -Optimization can be performed for both D-family and E-family designs. -The function works for both discrete and continuous optimization variables. -This function takes information from the PopED database supplied as an argument. -The PopED database supplies information about the the model, parameters, design and methods to use. -Some of the arguments coming from the PopED database can be overwritten; -by default these arguments are NULL in the -function, if they are supplied then they are used instead of the arguments from the PopED database.

    -
    - -
    -
    RS_opt(
    -  poped.db,
    -  ni = NULL,
    -  xt = NULL,
    -  model_switch = NULL,
    -  x = NULL,
    -  a = NULL,
    -  bpopdescr = NULL,
    -  ddescr = NULL,
    -  maxxt = NULL,
    -  minxt = NULL,
    -  maxa = NULL,
    -  mina = NULL,
    -  fmf = 0,
    -  dmf = 0,
    -  trflag = TRUE,
    -  opt_xt = poped.db$settings$optsw[2],
    -  opt_a = poped.db$settings$optsw[4],
    -  opt_x = poped.db$settings$optsw[3],
    -  cfaxt = poped.db$settings$cfaxt,
    -  cfaa = poped.db$settings$cfaa,
    -  rsit = poped.db$settings$rsit,
    -  rsit_output = poped.db$settings$rsit_output,
    -  fim.calc.type = poped.db$settings$iFIMCalculationType,
    -  approx_type = poped.db$settings$iApproximationMethod,
    -  iter = NULL,
    -  d_switch = poped.db$settings$d_switch,
    -  use_laplace = poped.db$settings$iEDCalculationType,
    -  laplace.fim = FALSE,
    -  header_flag = TRUE,
    -  footer_flag = TRUE,
    -  out_file = NULL,
    -  compute_inv = TRUE,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    xt
    -

    A matrix of sample times. Each row is a vector of sample times for a group.

    - - -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    a
    -

    A matrix of covariates. Each row is a group.

    - - -
    bpopdescr
    -

    Matrix defining the fixed effects, per row (row number = -parameter_number) we should have:

    • column 1 the type of the -distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, 3 = -User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the -distribution (or length of uniform distribution).

    • -
    - - -
    ddescr
    -

    Matrix defining the diagonals of the IIV (same logic as for -the bpopdescr).

    - - -
    maxxt
    -

    Matrix or single value defining the maximum value for each xt sample. If a single value is -supplied then all xt values are given the same maximum value.

    - - -
    minxt
    -

    Matrix or single value defining the minimum value for each xt sample. If a single value is -supplied then all xt values are given the same minimum value

    - - -
    maxa
    -

    Vector defining the max value for each covariate. If a single value is supplied then -all a values are given the same max value

    - - -
    mina
    -

    Vector defining the min value for each covariate. If a single value is supplied then -all a values are given the same max value

    - - -
    fmf
    -

    The initial value of the FIM. If set to zero then it is computed.

    - - -
    dmf
    -

    The initial OFV. If set to zero then it is computed.

    - - -
    trflag
    -

    Should the optimization be output to the screen and to a file?

    - - -
    opt_xt
    -

    Should the sample times be optimized?

    - - -
    opt_a
    -

    Should the continuous design variables be optimized?

    - - -
    opt_x
    -

    Should the discrete design variables be optimized?

    - - -
    cfaxt
    -

    First step factor for sample times

    - - -
    cfaa
    -

    Stochastic Gradient search first step factor for covariates

    - - -
    rsit
    -

    Number of Random search iterations

    - - -
    rsit_output
    -

    Number of iterations in random search between screen output

    - - -
    fim.calc.type
    -

    The method used for calculating the FIM. Potential values:

    • 0 = Full FIM. No assumption that fixed and random effects are uncorrelated.

    • -
    • 1 = Reduced FIM. Assume that there is no correlation in the FIM between the fixed and random effects, and set these elements in -the FIM to zero.

    • -
    • 2 = weighted models (placeholder).

    • -
    • 3 = Not currently used.

    • -
    • 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). -This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the residual unexplained variation by default).

    • -
    • 5 = Full FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    • 6 = Calculate one model switch at a time, good for large matrices.

    • -
    • 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    - - -
    approx_type
    -

    Approximation method for model, 0=FO, 1=FOCE, 2=FOCEI, 3=FOI.

    - - -
    iter
    -

    The number of iterations entered into the blockheader_2 function.

    - - -
    d_switch
    -
    • ******START OF CRITERION SPECIFICATION OPTIONS**********

    • -

    D-family design (1) or ED-family design (0) (with or without parameter uncertainty)

    - - -
    use_laplace
    -

    Should the Laplace method be used in calculating the expectation of the OFV?

    - - -
    laplace.fim
    -

    Should an E(FIM) be calculated when computing the Laplace approximated E(OFV). Typically -the FIM does not need to be computed and, if desired, this calculation -is done using the standard MC integration technique, so can be slow.

    - - -
    header_flag
    -

    Should the header text be printed out?

    - - -
    footer_flag
    -

    Should the footer text be printed out?

    - - -
    out_file
    -

    Which file should the output be directed to? A string, a file handle using -file or "" will output to the screen.

    - - -
    compute_inv
    -

    should the inverse of the FIM be used to compute expected RSE values? Often not needed -except for diagnostic purposes.

    - - -
    ...
    -

    arguments passed to evaluate.fim and ofv_fim.

    - -
    -
    -

    References

    - -
    1. M. Foracchia, A.C. Hooker, P. Vicini and A. Ruggeri, "PopED, a software fir optimal -experimental design in population kinetics", Computer Methods and Programs in Biomedicine, 74, 2004.

    2. -
    3. J. Nyberg, S. Ueckert, E.A. Stroemberg, S. Hennig, M.O. Karlsson and A.C. Hooker, "PopED: An extended, -parallelized, nonlinear mixed effects models optimal design tool", -Computer Methods and Programs in Biomedicine, 108, 2012.

    4. -
    - - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization
    -##  with parameter uncertainty)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error
    -## to avoid sample times at very low concentrations (time 0 or very late samoples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -# Adding 10% log-normal Uncertainty to fixed effects (not Favail)
    -bpop_vals <- c(CL=0.15, V=8, KA=1.0, Favail=1)
    -bpop_vals_ed_ln <- cbind(ones(length(bpop_vals),1)*4, # log-normal distribution
    -                         bpop_vals,
    -                         ones(length(bpop_vals),1)*(bpop_vals*0.1)^2) # 10% of bpop value
    -bpop_vals_ed_ln["Favail",]  <- c(0,1,0)
    -bpop_vals_ed_ln
    -#>          bpop_vals         
    -#> CL     4      0.15 0.000225
    -#> V      4      8.00 0.640000
    -#> KA     4      1.00 0.010000
    -#> Favail 0      1.00 0.000000
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=bpop_vals_ed_ln, 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(0.01,0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0,
    -                                  maxxt=120,
    -                                  a=70,
    -                                  mina=0,
    -                                  maxa=100)
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization
    -##  with parameter uncertainty)
    -#####################################
    -
    -
    -# Just a few iterations, optimize on DOSE and sample times using the full FIM
    -out_1 <- RS_opt(poped.db,opt_xt=1,opt_a=1,rsit=3,fim.calc.type=0, out_file = "")
    -#> ===============================================================================
    -#> Initial design evaluation
    -#> 
    -#> Initial OFV = 57.0828
    -#> 
    -#> Initial design
    -#> expected relative standard error
    -#> (%RSE, rounded to nearest integer)
    -#>     Parameter   Values   RSE_0
    -#>            CL     0.15       5
    -#>             V        8       3
    -#>            KA        1       7
    -#>          d_CL     0.07      30
    -#>           d_V     0.02      37
    -#>          d_KA      0.6      28
    -#>    SIGMA[1,1]     0.01      33
    -#>    SIGMA[2,2]     0.25      26
    -#> 
    -#> ==============================================================================
    -#> Optimization of design parameters
    -#> 
    -#> * Optimize Sampling Schedule
    -#> * Optimize Covariates
    -#> 
    -#> *******************************
    -#> Initial Value
    -#>  OFV(mf) = 57.0828
    -#> *******************************
    -#> 
    -#> RS - It. : 3   OFV : 57.0828
    -#> 
    -#> *******************************
    -#> RS Results
    -#>  OFV(mf) = 57.0828
    -#> 
    -#> Optimized Sampling Schedule
    -#> Group 1:    0.5      1      2      6     24     36     72    120
    -#> 
    -#> Optimized Covariates:
    -#> Group 1: 70
    -#> 
    -#> *********************************
    -#> 
    -#> ===============================================================================
    -#> FINAL RESULTS
    -#> Optimized Sampling Schedule
    -#> Group 1:    0.5      1      2      6     24     36     72    120
    -#> 
    -#> Optimized Covariates:
    -#> Group 1: 70
    -#> 
    -#> OFV = 57.0828
    -#> 
    -#> Efficiency: 
    -#>   ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1
    -#> 
    -#> Expected relative standard error
    -#> (%RSE, rounded to nearest integer):
    -#>     Parameter   Values   RSE_0   RSE
    -#>            CL     0.15       5     5
    -#>             V        8       3     3
    -#>            KA        1       7     7
    -#>          d_CL     0.07       0     0
    -#>           d_V     0.02      37    37
    -#>          d_KA      0.6       0     0
    -#>    SIGMA[1,1]     0.01      33    33
    -#>    SIGMA[2,2]     0.25      26    26
    -#> 
    -#> Total running time: 0.017 seconds
    -
    -if (FALSE) {
    -  
    -  RS_opt(poped.db)
    -  
    -  RS_opt(poped.db,opt_xt=TRUE,rsit=100,compute_inv=F)
    -  RS_opt(poped.db,opt_xt=TRUE,rsit=20,d_switch=0)
    -  RS_opt(poped.db,opt_xt=TRUE,rsit=10,d_switch=0,use_laplace=T)
    -  RS_opt(poped.db,opt_xt=TRUE,rsit=10,d_switch=0,use_laplace=T,laplace.fim=T)
    -  
    -  ## Different headers and footers of output
    -  RS_opt(poped.db,opt_xt=TRUE,rsit=10,out_file="foo.txt")
    -  output <- RS_opt(poped.db,opt_xt=TRUE,rsit=100,trflag=FALSE)
    -  RS_opt(poped.db,opt_xt=TRUE,rsit=10,out_file="")
    -  RS_opt(poped.db,opt_xt=TRUE,rsit=10,header_flag=FALSE)
    -  RS_opt(poped.db,opt_xt=TRUE,rsit=10,footer_flag=FALSE)
    -  RS_opt(poped.db,opt_xt=TRUE,rsit=10,header_flag=FALSE,footer_flag=FALSE)
    -  RS_opt(poped.db,opt_xt=TRUE,rsit=10,header_flag=FALSE,footer_flag=FALSE,out_file="foo.txt")
    -  RS_opt(poped.db,opt_xt=TRUE,rsit=10,header_flag=FALSE,footer_flag=FALSE,out_file="") 
    -
    -}
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/RS_opt_gen.html b/docs/reference/RS_opt_gen.html deleted file mode 100644 index 43dd8992..00000000 --- a/docs/reference/RS_opt_gen.html +++ /dev/null @@ -1,500 +0,0 @@ - - - - - - - - -Optimize the objective function using an adaptive random search algorithm for D-family and E-family designs. — RS_opt_gen • PopED - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Optimize the objective function using an adaptive random search algorithm. -Optimization can be performed for both D-family and E-family designs. -The function works for both discrete and continuous optimization variables. -This function takes information from the PopED database supplied as an argument. -The PopED database supplies information about the the model, parameters, design and methods to use. -Some of the arguments coming from the PopED database can be overwritten; -by default these arguments are NULL in the -function, if they are supplied then they are used instead of the arguments from the PopED database.

    - -
    - -
    RS_opt_gen(poped.db, ni = NULL, xt = NULL, model_switch = NULL,
    -  x = NULL, a = NULL, bpopdescr = NULL, ddescr = NULL, maxxt = NULL,
    -  minxt = NULL, maxa = NULL, mina = NULL, fmf = 0, dmf = 0,
    -  trflag = TRUE, opt_xt = poped.db$settings$optsw[2],
    -  opt_a = poped.db$settings$optsw[4], opt_x = poped.db$settings$optsw[3],
    -  cfaxt = poped.db$settings$cfaxt, cfaa = poped.db$settings$cfaa,
    -  rsit = poped.db$settings$rsit,
    -  rsit_output = poped.db$settings$rsit_output,
    -  fim.calc.type = poped.db$settings$iFIMCalculationType,
    -  approx_type = poped.db$settings$iApproximationMethod, iter = NULL,
    -  d_switch = poped.db$settings$d_switch,
    -  use_laplace = poped.db$settings$iEDCalculationType, laplace.fim = FALSE,
    -  header_flag = TRUE, footer_flag = TRUE, out_file = NULL,
    -  compute_inv = TRUE, ...)
    - -

    Arguments

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    poped.db

    A PopED database.

    ni

    A vector of the number of samples in each group.

    xt

    A matrix of sample times. Each row is a vector of sample times for a group.

    model_switch

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    x

    A matrix for the discrete design variables. Each row is a group.

    a

    A matrix of covariates. Each row is a group.

    bpopdescr

    Matrix defining the fixed effects, per row (row number = -parameter_number) we should have:

      -
    • column 1 the type of the -distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, 3 = -User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the -distribution (or length of uniform distribution).

    • -
    ddescr

    Matrix defining the diagnonals of the IIV (same logic as for -the bpopdescr).

    maxxt

    Matrix or single value defining the maximum value for each xt sample. If a single value is -supplied then all xt values are given the same maximum value.

    minxt

    Matrix or single value defining the minimum value for each xt sample. If a single value is -supplied then all xt values are given the same minimum value

    maxa

    Vector defining the max value for each covariate. If a single value is supplied then -all a values are given the same max value

    mina

    Vector defining the min value for each covariate. If a single value is supplied then -all a values are given the same max value

    fmf

    The initial value of the FIM. If set to zero then it is computed.

    dmf

    The inital OFV. If set to zero then it is computed.

    trflag

    Should the optimization be output to the screen and to a file?

    opt_xt

    Should the sample times be optimized?

    opt_a

    Should the continuous design variables be optimized?

    opt_x

    Should the discrete design variables be optimized?

    cfaxt

    First step factor for sample times

    cfaa

    Stochastic Gradient search first step factor for covariates

    rsit

    Number of Random search iterations

    rsit_output

    Number of iterations in random search between screen output

    fim.calc.type

    The method used for calculating the FIM. Potential values:

      -
    • 0 = Full FIM. No assumption that fixed and random effects are uncorrelated.

    • -
    • 1 = Reduced FIM. Assume that there is no correlation in the FIM between the fixed and random effects, and set these elements in -the FIM to zero.

    • -
    • 2 = weighted models (placeholder).

    • -
    • 3 = Not currently used.

    • -
    • 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). -This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the resudual unexplained variation by default).

    • -
    • 5 = Full FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    • 6 = Calculate one model switch at a time, good for large matrices.

    • -
    • 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    approx_type

    Approximation method for model, 0=FO, 1=FOCE, 2=FOCEI, 3=FOI.

    iter

    The number of iterations entered into the blockheader_2 function.

    d_switch
      -
    • ******START OF CRITERION SPECIFICATION OPTIONS**********

    • -

    D-family design (1) or ED-familty design (0) (with or without parameter uncertainty)

    use_laplace

    Should the Laplace method be used in calculating the expectation of the OFV?

    laplace.fim

    Should an E(FIM) be calculated when computing the Laplace approximated E(OFV). Typically -the FIM does not need to be computed and, if desired, this calculation -is done usng the standard MC integration technique, so can be slow.

    header_flag

    Should the header text be printed out?

    footer_flag

    Should the footer text be printed out?

    out_file

    Which file should the output be directed to? A string, a file handle using -file or "" will output to the screen.

    compute_inv

    should the inverse of the FIM be used to compute expected RSE values? Often not needed -except for diagnostic purposes.

    ...

    arguments passed to evaluate.fim and ofv_fim.

    - -

    References

    - -
      -
    1. M. Foracchia, A.C. Hooker, P. Vicini and A. Ruggeri, "PopED, a software fir optimal -experimental design in population kinetics", Computer Methods and Programs in Biomedicine, 74, 2004.

    2. -
    3. J. Nyberg, S. Ueckert, E.A. Stroemberg, S. Hennig, M.O. Karlsson and A.C. Hooker, "PopED: An extended, -parallelized, nonlinear mixed effects models optimal design tool", -Computer Methods and Programs in Biomedicine, 108, 2012.

    4. -
    - -

    See also

    - - - - -

    Examples

    -
    library(PopED) - -############# START ################# -## Create PopED database -## (warfarin model for optimization -## with parameter uncertainty) -##################################### - -## Warfarin example from software comparison in: -## Nyberg et al., "Methods and software tools for design evaluation -## for population pharmacokinetics-pharmacodynamics studies", -## Br. J. Clin. Pharm., 2014. - -## Optimization using an additive + proportional reidual error -## to avoid sample times at very low concentrations (time 0 or very late samoples). - -## find the parameters that are needed to define from the structural model -ff.PK.1.comp.oral.sd.CL
    #> function(model_switch,xt,parameters,poped.db){ -#> ##-- Model: One comp first order absorption -#> with(as.list(parameters),{ -#> y=xt -#> y=(DOSE*Favail*KA/(V*(KA-CL/V)))*(exp(-CL/V*xt)-exp(-KA*xt)) -#> return(list( y= y,poped.db=poped.db)) -#> }) -#> } -#> <environment: namespace:PopED>
    -## -- parameter definition function -## -- names match parameters in function ff -sfg <- function(x,a,bpop,b,bocc){ - parameters=c(CL=bpop[1]*exp(b[1]), - V=bpop[2]*exp(b[2]), - KA=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1]) - return(parameters) -} - -# Adding 10% log-normal Uncertainty to fixed effects (not Favail) -bpop_vals <- c(CL=0.15, V=8, KA=1.0, Favail=1) -bpop_vals_ed_ln <- cbind(ones(length(bpop_vals),1)*4, # log-normal distribution - bpop_vals, - ones(length(bpop_vals),1)*(bpop_vals*0.1)^2) # 10% of bpop value -bpop_vals_ed_ln["Favail",] <- c(0,1,0) -bpop_vals_ed_ln
    #> bpop_vals -#> CL 4 0.15 0.000225 -#> V 4 8.00 0.640000 -#> KA 4 1.00 0.010000 -#> Favail 0 1.00 0.000000
    -## -- Define initial design and design space -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, - fg_fun=sfg, - fError_fun=feps.add.prop, - bpop=bpop_vals_ed_ln, - notfixed_bpop=c(1,1,1,0), - d=c(CL=0.07, V=0.02, KA=0.6), - sigma=c(0.01,0.25), - groupsize=32, - xt=c( 0.5,1,2,6,24,36,72,120), - minxt=0, - maxxt=120, - a=70, - mina=0, - maxa=100) - -############# END ################### -## Create PopED database -## (warfarin model for optimization -## with parameter uncertainty) -##################################### - - -# Just a few iterations, optimize on DOSE and sample times using the full FIM -out_1 <- RS_opt_gen(poped.db,opt_xt=1,opt_a=1,rsit=3,fim.calc.type=0)
    #> =============================================================================== -#> Initial design evaluation -#> -#> Initial OFV = 57.0828 -#> -#> Efficiency criterion [usually defined as OFV^(1/npar)] = 1255.57 -#> -#> Initial design expected parameter -#> relative standard error (%RSE) -#> Parameter Values RSE_0 -#> bpop[1] 0.15 4.84 -#> bpop[2] 8.00 2.96 -#> bpop[3] 1.00 6.59 -#> D[1,1] 0.07 30.20 -#> D[2,2] 0.02 37.10 -#> D[3,3] 0.60 27.62 -#> SIGMA[1,1] 0.01 32.87 -#> SIGMA[2,2] 0.25 26.03 -#> -#> RS - It. : 3 OFV : 57.0828 -#> =============================================================================== -#> FINAL RESULTS -#> -#> Optimized Sampling Schedule -#> Group 1: 0.5 1 2 6 24 36 72 120 -#> -#> Optimized Covariates: -#> Group 1: 70 -#> -#> OFV = 57.0828 -#> -#> Efficiency: -#> ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1 -#> -#> Expected parameter -#> relative standard error (%RSE): -#> Parameter Values RSE_0 RSE -#> bpop[1] 0.15 4.84 4.84 -#> bpop[2] 8.00 2.96 2.96 -#> bpop[3] 1.00 6.59 6.59 -#> D[1,1] 0.07 30.20 30.20 -#> D[2,2] 0.02 37.10 37.10 -#> D[3,3] 0.60 27.62 27.62 -#> SIGMA[1,1] 0.01 32.87 32.87 -#> SIGMA[2,2] 0.25 26.03 26.03 -#> -#> Total running time: 0.205 seconds
    -
    # NOT RUN { - - RS_opt_gen(poped.db) - - RS_opt_gen(poped.db,opt_xt=TRUE,rsit=100,compute_inv=F) - RS_opt_gen(poped.db,opt_xt=TRUE,rsit=20,d_switch=0) - RS_opt_gen(poped.db,opt_xt=TRUE,rsit=10,d_switch=0,use_laplace=T) - RS_opt_gen(poped.db,opt_xt=TRUE,rsit=10,d_switch=0,use_laplace=T,laplace.fim=T) - - ## Different headers and footers of output - RS_opt_gen(poped.db,opt_xt=TRUE,rsit=10,out_file="foo.txt") - output <- RS_opt_gen(poped.db,opt_xt=TRUE,rsit=100,trflag=FALSE) - RS_opt_gen(poped.db,opt_xt=TRUE,rsit=10,out_file="") - RS_opt_gen(poped.db,opt_xt=TRUE,rsit=10,header_flag=FALSE) - RS_opt_gen(poped.db,opt_xt=TRUE,rsit=10,footer_flag=FALSE) - RS_opt_gen(poped.db,opt_xt=TRUE,rsit=10,header_flag=FALSE,footer_flag=FALSE) - RS_opt_gen(poped.db,opt_xt=TRUE,rsit=10,header_flag=FALSE,footer_flag=FALSE,out_file="foo.txt") - RS_opt_gen(poped.db,opt_xt=TRUE,rsit=10,header_flag=FALSE,footer_flag=FALSE,out_file="") - -# }
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - - - - diff --git a/docs/reference/Rplot001.png b/docs/reference/Rplot001.png deleted file mode 100644 index 17a35806..00000000 Binary files a/docs/reference/Rplot001.png and /dev/null differ diff --git a/docs/reference/Rplot002.png b/docs/reference/Rplot002.png deleted file mode 100644 index 77b068a6..00000000 Binary files a/docs/reference/Rplot002.png and /dev/null differ diff --git a/docs/reference/a_line_search.html b/docs/reference/a_line_search.html deleted file mode 100644 index 979d12ef..00000000 --- a/docs/reference/a_line_search.html +++ /dev/null @@ -1,348 +0,0 @@ - -Optimize using line search — a_line_search • PopED - - -
    -
    - - - -
    -
    - - -
    -

    The function performs a grid search sequentially along -design variables. The grid is defined by ls_step_size.

    -
    - -
    -
    a_line_search(
    -  poped.db,
    -  out_file = "",
    -  bED = FALSE,
    -  diff = 0,
    -  fmf_initial = 0,
    -  dmf_initial = 0,
    -  opt_xt = poped.db$settings$optsw[2],
    -  opt_a = poped.db$settings$optsw[4],
    -  opt_x = poped.db$settings$optsw[3],
    -  opt_samps = poped.db$settings$optsw[1],
    -  opt_inds = poped.db$settings$optsw[5],
    -  ls_step_size = poped.db$settings$ls_step_size
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    out_file
    -

    The output file to write to.

    - - -
    bED
    -

    If the algorithm should use E-family methods. Logical.

    - - -
    diff
    -

    The OFV difference that is deemed significant for changing a design. If, -by changing a design variable the difference between the new and old OFV is less than diff -the change is not made.

    - - -
    fmf_initial
    -

    The initial value of the FIM. If 0 then the FIM is calculated from poped.db.

    - - -
    dmf_initial
    -

    The initial value of the objective function value (OFV). -If 0 then the OFV is calculated from poped.db.

    - - -
    opt_xt
    -

    Should the sample times be optimized?

    - - -
    opt_a
    -

    Should the continuous design variables be optimized?

    - - -
    opt_x
    -

    Should the discrete design variables be optimized?

    - - -
    opt_samps
    -

    Are the number of sample times per group being optimized?

    - - -
    opt_inds
    -

    Are the number of individuals per group being optimized?

    - - -
    ls_step_size
    -

    Number of grid points in the line search.

    - -
    -
    -

    Value

    - - -

    A list containing:

    -
    fmf
    -

    The FIM.

    - -
    dmf
    -

    The final value of the objective function value.

    - -
    best_changed
    -

    If the algorithm has found a better design than the starting design.

    - -
    xt
    -

    A matrix of sample times. Each row is a vector of sample times for a group.

    - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - -
    a
    -

    A matrix of covariates. Each row is a group.

    - -
    poped.db
    -

    A PopED database.

    - -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -# very sparse grid to evaluate (4 points for each design valiable)
    -output <- a_line_search(poped.db, opt_xt=TRUE, opt_a=TRUE, ls_step_size=4)
    -#> *****************************
    -#>             Line Search
    -#> 
    -#> Searching xt5 on group 1
    -#> group 1 -- xt[5] changed from  24 to  0.01
    -#>      OFV(MF) changed from 55.3964 to 55.545 
    -#> group 1 -- xt[5] changed from  0.01 to  120
    -#>      OFV(MF) changed from 55.545 to 55.5979 
    -#> Searching xt1 on group 1
    -#> group 1 -- xt[1] changed from  0.5 to  0.01
    -#>      OFV(MF) changed from 55.5979 to 55.6096 
    -#> group 1 -- xt[1] changed from  0.01 to  30.0075
    -#>      OFV(MF) changed from 55.6096 to 55.6818 
    -#> Searching xt3 on group 1
    -#> Searching xt4 on group 1
    -#> Searching xt8 on group 1
    -#> Searching xt7 on group 1
    -#> group 1 -- xt[7] changed from  72 to  90.0025
    -#>      OFV(MF) changed from 55.6818 to 55.7642 
    -#> group 1 -- xt[7] changed from  90.0025 to  120
    -#>      OFV(MF) changed from 55.7642 to 55.7932 
    -#> Searching xt2 on group 1
    -#> Searching xt6 on group 1
    -#> group 1 -- xt[6] changed from  36 to  30.0075
    -#>      OFV(MF) changed from 55.7932 to 55.857 
    -#>     OFV(MF): 55.857
    -#> 
    -#> Best value for OFV(MF) = 55.857
    -#> 
    -#> Best value for xt:
    -#> Group 1:      1      2      6  30.01  30.01    120    120    120
    -#> 
    -#> Searching a1 on individual/group 1
    -#> group 1 -- a[1] changed from  70 to  75.0025
    -#>      OFV(MF) changed from 55.857 to 56.0566 
    -#> group 1 -- a[1] changed from  75.0025 to  100
    -#>      OFV(MF) changed from 56.0566 to 56.6925 
    -#>     OFV(MF): 56.6925
    -#> Best value for OFV(MF) = 56.6925
    -#> 
    -#> Best value for a: 
    -#> Group 1: 100 [0.01,100]
    -#> 
    -#> 
    -#> Line search run time: 0.161 seconds
    -#> ***************************
    -#> 
    -
    -if (FALSE) {  
    -  
    -  # longer run time
    -  output <- a_line_search(poped.db,opt_xt=TRUE)
    -  
    -  # output to a text file
    -  output <- a_line_search(poped.db,opt_xt=TRUE,out_file="tmp.txt")
    -  
    -}
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/bfgsb_min.html b/docs/reference/bfgsb_min.html deleted file mode 100644 index bd64a471..00000000 --- a/docs/reference/bfgsb_min.html +++ /dev/null @@ -1,276 +0,0 @@ - -Nonlinear minimization using BFGS with box constraints — bfgsb_min • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This is the implementation of a Broyden Fletcher Goldfarb Shanno (BFGS) -method for nonlinear minimization with box constraints.

    -
    - -
    -
    bfgsb_min(f_name, f_options, x0, l, u, options = list())
    -
    - -
    -

    Arguments

    -
    f_name
    -

    A function name (as a text string) that returns an objective function and the gradient of that objective function, in that order. -See calc_ofv_and_grad as used in Doptim.

    - - -
    f_options
    -

    Options for the f_name argument.

    - - -
    x0
    -

    the initial values to optimize

    - - -
    l
    -

    the lower bounds

    - - -
    u
    -

    the upper bounds

    - - -
    options
    -

    a list of additional settings arguments

    - -
    -
    -

    Value

    - - -

    A list containing:

    -
    x_k
    -

    The objective function.

    - -
    f_k
    -

    The gradient.

    - -
    B_k
    -

    The hessian.

    - -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -if (FALSE) {  
    -  
    -  # BFGS search, DOSE and sample time optimization
    -  bfgs.output <- poped_optimize(poped.db,opt_xt=1,opt_a=0,
    -                                bUseRandomSearch= 0,
    -                                bUseStochasticGradient = 0,
    -                                bUseBFGSMinimizer = 1,
    -                                bUseLineSearch = 0)
    -  
    -  f_name <- 'calc_ofv_and_grad' 
    -  gen_des <- downsizing_general_design(poped.db)
    -  
    -  aa <- 0*poped.db$settings$cfaa*matrix(1,poped.db$design$m,size(poped.db$design$a,2))
    -  axt=1*poped.db$settings$cfaxt*matrix(1,poped.db$design$m,max(poped.db$design_space$maxni))
    -  
    -  f_options_1 <- list(gen_des$x,1, 0, gen_des$model_switch,
    -                    aa=aa,axt=axt,poped.db$design$groupsize,
    -                    gen_des$ni,
    -                    gen_des$xt,gen_des$x,gen_des$a,gen_des$bpop[,2,drop=F],
    -                    getfulld(gen_des$d[,2,drop=F],poped.db$parameters$covd),
    -                    poped.db$parameters$sigma,
    -                    getfulld(poped.db$parameters$docc[,2,drop=F],
    -                             poped.db$parameters$covdocc),poped.db)
    -  
    -  options=list('factr'=poped.db$settings$BFGSConvergenceCriteriaMinStep,
    -               #'factr'=0.01,
    -               'pgtol'=poped.db$settings$BFGSProjectedGradientTol,
    -               'ftol'=poped.db$settings$BFGSTolerancef,
    -               'gtol'=poped.db$settings$BFGSToleranceg,
    -               'xtol'=poped.db$settings$BFGSTolerancex)
    -  
    -  x_k=t(gen_des$xt)
    -  lb=t(gen_des$minxt)
    -  ub=t(gen_des$maxxt)
    -  
    -  output <- bfgsb_min(f_name,f_options, x_k,lb,ub,options) 
    -  
    -}
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/blockexp.html b/docs/reference/blockexp.html deleted file mode 100644 index 280565b2..00000000 --- a/docs/reference/blockexp.html +++ /dev/null @@ -1,310 +0,0 @@ - -Summarize your experiment for optimization routines — blockexp • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Create some output to the screen and a text file that summarizes the initial design and the design space -you will use to optimize.

    -
    - -
    -
    blockexp(
    -  fn,
    -  poped.db,
    -  e_flag = FALSE,
    -  opt_xt = poped.db$settings$optsw[2],
    -  opt_a = poped.db$settings$optsw[4],
    -  opt_x = poped.db$settings$optsw[4],
    -  opt_samps = poped.db$settings$optsw[1],
    -  opt_inds = poped.db$settings$optsw[5]
    -)
    -
    - -
    -

    Arguments

    -
    fn
    -

    The file handle to write to.

    - - -
    poped.db
    -

    A PopED database.

    - - -
    e_flag
    -

    Should output be with uncertainty around parameters?

    - - -
    opt_xt
    -

    Should the sample times be optimized?

    - - -
    opt_a
    -

    Should the continuous design variables be optimized?

    - - -
    opt_x
    -

    Should the discrete design variables be optimized?

    - - -
    opt_samps
    -

    Are the number of sample times per group being optimized?

    - - -
    opt_inds
    -

    Are the number of individuals per group being optimized?

    - -
    -
    -

    See also

    -

    Other Helper: -blockfinal(), -blockheader(), -blockopt()

    -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -blockexp("",poped.db, opt_xt=TRUE)
    -#> ==============================================================================
    -#> Model description : PopED model 
    -#> 
    -#> Model Sizes : 
    -#> Number of individual model parameters                  g[j]    : Ng    = 5
    -#> Number of population model fixed parameters            bpop[j] : Nbpop = 4
    -#> Number of population model random effects parameters   b[j]    : Nb    = 3
    -#> 
    -#> Typical Population Parameters:
    -#> Warning: 5 arguments not used by format '%s[%g%s]: %5.4g %s
    -#> '
    -#> bpop[1]:  0.15 
    -#> Warning: 5 arguments not used by format '%s[%g%s]: %5.4g %s
    -#> '
    -#> bpop[2]:     8 
    -#> Warning: 5 arguments not used by format '%s[%g%s]: %5.4g %s
    -#> '
    -#> bpop[3]:     1 
    -#> Warning: 5 arguments not used by format '%s[%g%s]: %5.4g %s
    -#> '
    -#> bpop[4]:     1 
    -#> 
    -#> Between Subject Variability matrix D (variance units) 
    -#> 0.07 0.00 0.00
    -#> 0.00 0.02 0.00
    -#> 0.00 0.00 0.60
    -#> 
    -#> Diagonal Elements of D [sqrt(param)]:
    -#> Warning: 5 arguments not used by format '%s[%g%s]: %5.4g %s
    -#> '
    -#> D[1,1]:  0.07 [0.2646] 
    -#> Warning: 5 arguments not used by format '%s[%g%s]: %5.4g %s
    -#> '
    -#> D[2,2]:  0.02 [0.1414] 
    -#> Warning: 5 arguments not used by format '%s[%g%s]: %5.4g %s
    -#> '
    -#> D[3,3]:   0.6 [0.7746] 
    -#> 
    -#> Residual Unexplained Variability matrix SIGMA (variance units) : 
    -#> 0.01 0.00
    -#> 0.00 0.25
    -#> 
    -#> Diagonal Elements of SIGMA [sqrt(param)]:
    -#> Warning: 5 arguments not used by format '%s[%g%s]: %5.4g %s
    -#> '
    -#> SIGMA[1,1]:  0.01 [  0.1] 
    -#> Warning: 5 arguments not used by format '%s[%g%s]: %5.4g %s
    -#> '
    -#> SIGMA[2,2]:  0.25 [  0.5] 
    -#> 
    -#> ==============================================================================
    -#> Experiment description (design and design space)
    -#> 
    -#> Warning: 2 arguments not used by format 'Number of individuals: %g
    -#> '
    -#> Number of individuals: 32
    -#> Number of groups (individuals with same design): 1
    -#> Number of individuals per group:
    -#>  
    -#> Warning: 2 arguments not used by format '    Group %g: %g
    -#> '
    -#>     Group 1: 32
    -#> Number of samples per group:
    -#>  Number of discrete experimental variables: 0
    -#> Number of model covariates: 1
    -#> 
    -#> Initial Sampling Schedule
    -#> Group 1:    0.5      1      2      6     24     36     72    120
    -#> 
    -#> Minimum allowed sampling values
    -#> Group 1:   0.01   0.01   0.01   0.01   0.01   0.01   0.01   0.01
    -#> 
    -#> Maximum allowed sampling values
    -#> Group 1:    120    120    120    120    120    120    120    120
    -#> 
    -#> Covariates:
    -#> Group 1: 
    -#> Warning: 2 arguments not used by format '%g'
    -#> 70
    -#> 
    -#> NULL
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/blockfinal.html b/docs/reference/blockfinal.html deleted file mode 100644 index ca805657..00000000 --- a/docs/reference/blockfinal.html +++ /dev/null @@ -1,373 +0,0 @@ - -Result function for optimization routines — blockfinal • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Create some output to the screen and a text file that summarizes the problem you solved.

    -
    - -
    -
    blockfinal(
    -  fn,
    -  fmf,
    -  dmf,
    -  groupsize,
    -  ni,
    -  xt,
    -  x,
    -  a,
    -  model_switch,
    -  bpop,
    -  d,
    -  docc,
    -  sigma,
    -  poped.db,
    -  opt_xt = poped.db$settings$optsw[2],
    -  opt_a = poped.db$settings$optsw[4],
    -  opt_x = poped.db$settings$optsw[3],
    -  opt_inds = poped.db$settings$optsw[5],
    -  fmf_init = NULL,
    -  dmf_init = NULL,
    -  param_cvs_init = NULL,
    -  compute_inv = TRUE,
    -  out_file = NULL,
    -  trflag = TRUE,
    -  footer_flag = TRUE,
    -  run_time = NULL,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    fn
    -

    The file handle to write to.

    - - -
    fmf
    -

    The initial value of the FIM. If set to zero then it is computed.

    - - -
    dmf
    -

    The initial OFV. If set to zero then it is computed.

    - - -
    groupsize
    -

    A vector of the number of individuals in each group.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    xt
    -

    A matrix of sample times. Each row is a vector of sample times for a group.

    - - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    a
    -

    A matrix of covariates. Each row is a group.

    - - -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    bpop
    -

    Matrix defining the fixed effects, per row (row number = parameter_number) we should have:

    • column 1 the type of the distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, - 3 = User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the distribution (or length of uniform distribution).

    • -

    Can also just supply the parameter values as a vector c() if no uncertainty around the -parameter value is to be used. The parameter order of 'bpop' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'bpop' then the order will be worked out automatically.

    - - -
    d
    -

    Matrix defining the diagonals of the IIV (same logic as for the fixed effects -matrix bpop to define uncertainty). One can also just supply the parameter values as a c(). -The parameter order of 'd' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'd' then the order will be worked out automatically.

    - - -
    docc
    -

    Matrix defining the IOV, the IOV variances and the IOV distribution as for d and bpop.

    - - -
    sigma
    -

    Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagonal parameter values (variances) as a c().

    - - -
    poped.db
    -

    A PopED database.

    - - -
    opt_xt
    -

    Should the sample times be optimized?

    - - -
    opt_a
    -

    Should the continuous design variables be optimized?

    - - -
    opt_x
    -

    Should the discrete design variables be optimized?

    - - -
    opt_inds
    -

    Are the number of individuals per group being optimized?

    - - -
    fmf_init
    -

    Initial FIM.

    - - -
    dmf_init
    -

    Initial OFV.

    - - -
    param_cvs_init
    -

    The initial design parameter RSE values in percent.

    - - -
    compute_inv
    -

    should the inverse of the FIM be used to compute expected RSE values? Often not needed -except for diagnostic purposes.

    - - -
    out_file
    -

    Which file should the output be directed to? A string, a file handle using -file or "" will output to the screen.

    - - -
    trflag
    -

    Should the optimization be output to the screen and to a file?

    - - -
    footer_flag
    -

    Should the footer text be printed out?

    - - -
    ...
    -

    arguments passed to evaluate.fim and ofv_fim.

    - -
    -
    -

    See also

    -

    Other Helper: -blockexp(), -blockheader(), -blockopt()

    -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -FIM <- evaluate.fim(poped.db) 
    -dmf <- det(FIM)
    -
    -
    -blockfinal(fn="",fmf=FIM,
    -           dmf=dmf,
    -           groupsize=poped.db$design$groupsize,
    -           ni=poped.db$design$ni,
    -           xt=poped.db$design$xt,
    -           x=poped.db$design$x,a=poped.db$design$a,
    -           model_switch=poped.db$design$model_switch,
    -           poped.db$parameters$param.pt.val$bpop,
    -           poped.db$parameters$param.pt.val$d,
    -           poped.db$parameters$docc,
    -           poped.db$parameters$param.pt.val$sigma,
    -           poped.db,
    -           opt_xt=TRUE,
    -           fmf_init=FIM,
    -           dmf_init=dmf,
    -           param_cvs_init=get_rse(FIM,poped.db))
    -#> ===============================================================================
    -#> FINAL RESULTS
    -#> Optimized Sampling Schedule
    -#> Group 1:    0.5      1      2      6     24     36     72    120
    -#> 
    -#> OFV = 1.14386e+24
    -#> 
    -#> Efficiency: 
    -#>   ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = NaN
    -#> 
    -#> Expected relative standard error
    -#> (%RSE, rounded to nearest integer):
    -#>    Parameter   Values   RSE_0   RSE
    -#>           CL     0.15       5     5
    -#>            V        8       3     3
    -#>           KA        1      14    14
    -#>         d_CL     0.07      30    30
    -#>          d_V     0.02      37    37
    -#>         d_KA      0.6      27    27
    -#>     sig_prop     0.01      32    32
    -#>      sig_add     0.25      26    26
    -#> 
    -#> Total running time: 1.25 seconds
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/blockheader.html b/docs/reference/blockheader.html deleted file mode 100644 index 96c45254..00000000 --- a/docs/reference/blockheader.html +++ /dev/null @@ -1,434 +0,0 @@ - -Header function for optimization routines — blockheader • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Create some output to the screen and a text file that summarizes the problem you are tying to solve.

    -
    - -
    -
    blockheader(
    -  poped.db,
    -  name = "Default",
    -  iter = NULL,
    -  e_flag = !(poped.db$settings$d_switch),
    -  opt_xt = poped.db$settings$optsw[2],
    -  opt_a = poped.db$settings$optsw[4],
    -  opt_x = poped.db$settings$optsw[3],
    -  opt_samps = poped.db$settings$optsw[1],
    -  opt_inds = poped.db$settings$optsw[5],
    -  fmf = 0,
    -  dmf = 0,
    -  bpop = NULL,
    -  d = NULL,
    -  docc = NULL,
    -  sigma = NULL,
    -  name_header = poped.db$settings$strOutputFileName,
    -  file_path = poped.db$settings$strOutputFilePath,
    -  out_file = NULL,
    -  compute_inv = TRUE,
    -  trflag = TRUE,
    -  header_flag = TRUE,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    name
    -

    The name used for the output file. Combined with name_header and iter. -If "" then output is to the screen.

    - - -
    iter
    -

    The last number in the name printed to the output file, combined with name.

    - - -
    e_flag
    -

    Should output be with uncertainty around parameters?

    - - -
    opt_xt
    -

    Should the sample times be optimized?

    - - -
    opt_a
    -

    Should the continuous design variables be optimized?

    - - -
    opt_x
    -

    Should the discrete design variables be optimized?

    - - -
    opt_samps
    -

    Are the number of sample times per group being optimized?

    - - -
    opt_inds
    -

    Are the number of individuals per group being optimized?

    - - -
    fmf
    -

    The initial value of the FIM. If set to zero then it is computed.

    - - -
    dmf
    -

    The initial OFV. If set to zero then it is computed.

    - - -
    bpop
    -

    Matrix defining the fixed effects, per row (row number = parameter_number) we should have:

    • column 1 the type of the distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, - 3 = User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the distribution (or length of uniform distribution).

    • -

    Can also just supply the parameter values as a vector c() if no uncertainty around the -parameter value is to be used. The parameter order of 'bpop' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'bpop' then the order will be worked out automatically.

    - - -
    d
    -

    Matrix defining the diagonals of the IIV (same logic as for the fixed effects -matrix bpop to define uncertainty). One can also just supply the parameter values as a c(). -The parameter order of 'd' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'd' then the order will be worked out automatically.

    - - -
    docc
    -

    Matrix defining the IOV, the IOV variances and the IOV distribution as for d and bpop.

    - - -
    sigma
    -

    Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagonal parameter values (variances) as a c().

    - - -
    name_header
    -

    The initial portion of the file name.

    - - -
    file_path
    -

    The path to where the file should be created.

    - - -
    out_file
    -

    Which file should the output be directed to? A string, a file handle using -file or "" will output to the screen.

    - - -
    compute_inv
    -

    should the inverse of the FIM be used to compute expected RSE values? Often not needed -except for diagnostic purposes.

    - - -
    trflag
    -

    Should the optimization be output to the screen and to a file?

    - - -
    header_flag
    -

    Should the header text be printed out?

    - - -
    ...
    -

    Additional arguments passed to further functions.

    - -
    -
    -

    Value

    - - -

    fn A file handle (or '' if name='')

    -
    -
    -

    See also

    -

    Other Helper: -blockexp(), -blockfinal(), -blockopt()

    -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -FIM <- evaluate.fim(poped.db) 
    -dmf <- det(FIM)
    -
    -blockheader(poped.db,name="")
    -#> ==============================================================================
    -#> Optimization of design parameters
    -#> 
    -#> 
    -#> [1] ""
    -
    -blockheader(name="",iter=1,poped.db)
    -#> ==============================================================================
    -#> Optimization of design parameters
    -#> 
    -#> 
    -#> [1] ""
    -
    -
    -blockheader(name='',
    -              iter=1,
    -              poped.db,
    -              e_flag=FALSE,
    -              opt_xt=TRUE,
    -              opt_a=TRUE,opt_x=poped.db$settings$optsw[4],
    -              opt_samps=poped.db$settings$optsw[1],opt_inds=poped.db$settings$optsw[5],
    -              fmf=FIM,dmf=dmf,
    -              bpop=poped.db$parameters$param.pt.val$bpop,
    -              d=poped.db$parameters$param.pt.val$d,
    -              docc=poped.db$parameters$docc,sigma=poped.db$parameters$param.pt.val$sigma)
    -#> ===============================================================================
    -#> Initial design evaluation
    -#> 
    -#> Initial OFV = 1.14386e+24
    -#> 
    -#> Initial design
    -#> expected relative standard error
    -#> (%RSE, rounded to nearest integer)
    -#>    Parameter   Values   RSE_0
    -#>           CL     0.15       5
    -#>            V        8       3
    -#>           KA        1      14
    -#>         d_CL     0.07      30
    -#>          d_V     0.02      37
    -#>         d_KA      0.6      27
    -#>     sig_prop     0.01      32
    -#>      sig_add     0.25      26
    -#> 
    -#> ==============================================================================
    -#> Optimization of design parameters
    -#> 
    -#> * Optimize Sampling Schedule
    -#> * Optimize Covariates
    -#> 
    -#> [1] ""
    -
    -
    -
    -blockheader(name='',
    -              iter=1,
    -              poped.db,
    -              e_flag=TRUE,
    -              opt_xt=TRUE,
    -              opt_a=TRUE,opt_x=poped.db$settings$optsw[4],
    -              opt_samps=poped.db$settings$optsw[1],opt_inds=poped.db$settings$optsw[5],
    -              fmf=FIM,dmf=dmf,
    -              bpop=poped.db$parameters$param.pt.val$bpop,
    -              d=poped.db$parameters$param.pt.val$d,
    -              docc=poped.db$parameters$docc,sigma=poped.db$parameters$param.pt.val$sigma)
    -#> ===============================================================================
    -#> Initial design evaluation
    -#> 
    -#> Initial OFV = 1.14386e+24
    -#> 
    -#> Initial design
    -#> expected relative standard error
    -#> (%RSE, rounded to nearest integer)
    -#>    Parameter   Values   RSE_0
    -#>           CL     0.15       5
    -#>            V        8       3
    -#>           KA        1      14
    -#>         d_CL     0.07      30
    -#>          d_V     0.02      37
    -#>         d_KA      0.6      27
    -#>     sig_prop     0.01      32
    -#>      sig_add     0.25      26
    -#> 
    -#> ==============================================================================
    -#> Optimization of design parameters
    -#> 
    -#> * Optimize Sampling Schedule
    -#> * Optimize Covariates
    -#> 
    -#> [1] ""
    -  
    -  
    -poped.db.1 <- create.poped.database(ff_file="ff.PK.1.comp.oral.sd.CL",
    -                                  fg_file="sfg",
    -                                  fError_file="feps.add.prop",
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(0.01,0.25),
    -                                  groupsize=32,
    -                                  xt=rbind(c( 0.5,1,2,6,24,36,72,120),
    -                                           c( 0.5,1.1,2,6,24,36,72,120)),
    -                                  minxt=rbind(c(0,1,1.5,3,20,30,70,118),
    -                                              c(0.1,1.1,1.6,3.1,20.1,30.1,70.1,118.1)),
    -                                  maxxt=c(12,13,14,15,26,44,78,120),
    -                                  a=70,
    -                                  mina=0,
    -                                  maxa=100)
    -#> Warning: cannot open file 'sfg': No such file or directory
    -#> Error in file(filename, "r", encoding = encoding): cannot open the connection
    -
    -
    -blockheader(poped.db.1,name="",trflag=2,opt_xt=TRUE)
    -#> ==============================================================================
    -#> Error in eval(expr, envir, enclos): object 'poped.db.1' not found
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/blockopt.html b/docs/reference/blockopt.html deleted file mode 100644 index db40b4ca..00000000 --- a/docs/reference/blockopt.html +++ /dev/null @@ -1,229 +0,0 @@ - -Summarize your optimization settings for optimization routines — blockopt • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Create some output to the screen and a text file that summarizes the optimization settings -you will use to optimize.

    -
    - -
    -
    blockopt(fn, poped.db, opt_method = "")
    -
    - -
    -

    Arguments

    -
    fn
    -

    The file handle to write to.

    - - -
    poped.db
    -

    A PopED database.

    - - -
    opt_method
    -

    If "RS" (random search), "SG" (stochastic gradient) or "DO" (discrete optimization) then specific output is produced.

    - -
    -
    -

    See also

    -

    Other Helper: -blockexp(), -blockfinal(), -blockheader()

    -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -blockopt(fn="",poped.db,opt_method="SG")
    -#> ==============================================================================
    -#> Optimization Settings
    -#> 
    -#> Stochastic Gradient :
    -#> Maximum number of cycles : 150
    -#> Epsilon for termination : 1e-08
    -#> First step factor for xt: 0.001
    -#> First step factor for a: 0.001
    -#> RS m0it: 50
    -#> 
    -#> NULL
    -blockopt(fn="",poped.db,opt_method="RS")
    -#> ==============================================================================
    -#> Optimization Settings
    -#> 
    -#> Random Search :
    -#> Number of cycles : 300
    -#> Locality factor for xt : 10
    -#> Locality factor for a  : 10
    -#> 
    -#> NULL
    -blockopt(fn="",poped.db,opt_method="DO")
    -#> ==============================================================================
    -#> Optimization Settings
    -#> 
    -#> Discrete Optimization  :
    -#> RS int it: 250
    -#> SG int it: 50
    -#> 
    -#> NULL
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/build_sfg.html b/docs/reference/build_sfg.html deleted file mode 100644 index 684889a3..00000000 --- a/docs/reference/build_sfg.html +++ /dev/null @@ -1,168 +0,0 @@ - -Build PopED parameter function from a model function — build_sfg • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Build PopED parameter function from a model function

    -
    - -
    -
    build_sfg(
    -  model = "ff.PK.1.comp.oral.sd.CL",
    -  covariates = c("dose", "tau"),
    -  par_names = NULL,
    -  etas = "exp",
    -  no_etas = c("F", "Favail"),
    -  env = parent.frame()
    -)
    -
    - -
    -

    Arguments

    -
    model
    -

    A string of text describing the model function name

    - - -
    covariates
    -

    A list of covariate names to be filtered out of the model

    - - -
    par_names
    -

    A list of parameter names in the model file. If not supplied then -all undefined variables in the model file are extracted and the covariate names are -filtered out of that list.

    - - -
    etas
    -

    Can be "exp", "prop", "add" or "none". Either one value for all parameters or -a list defining the model per parameter.

    - - -
    no_etas
    -

    Parameters that should not have etas associated with them.

    - - -
    env
    -

    The environment to create the function in.

    - -
    -
    -

    Value

    - - -

    A parameter model function to be used as input to PopED calculations.

    -
    - -
    -

    Examples

    -
    build_sfg(model="ff.PK.1.comp.oral.md.CL")
    -#> function (x, a, bpop, b, bocc) 
    -#> parameters = c(CL = bpop[1] * exp(b[1]), Favail = bpop[2], KA = bpop[3] * 
    -#>     exp(b[2]), V = bpop[4] * exp(b[3]), DOSE = a[1], TAU = a[2])
    -#> <environment: 0x11047b668>
    -
    -etas <- c(Favail="exp",KA="exp",V="add",CL="exp")
    -build_sfg(model="ff.PK.1.comp.oral.md.CL",etas = etas)
    -#> function (x, a, bpop, b, bocc) 
    -#> parameters = c(CL = bpop[1] * exp(b[1]), Favail = bpop[2] * exp(b[2]), 
    -#>     KA = bpop[3] * exp(b[3]), V = bpop[4] + b[4], DOSE = a[1], 
    -#>     TAU = a[2])
    -#> <environment: 0x11047b668>
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/calc_autofocus.html b/docs/reference/calc_autofocus.html deleted file mode 100644 index a1543bb2..00000000 --- a/docs/reference/calc_autofocus.html +++ /dev/null @@ -1,334 +0,0 @@ - -Compute the autofocus portion of the stochastic gradient routine — calc_autofocus • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Compute the autofocus portion of the stochastic gradient routine

    -
    - -
    -
    calc_autofocus(
    -  m,
    -  ni_var,
    -  dmf,
    -  varopt,
    -  varopto,
    -  maxvar,
    -  minvar,
    -  gradvar,
    -  normgvar,
    -  avar,
    -  model_switch,
    -  groupsize,
    -  xtopt,
    -  xopt,
    -  aopt,
    -  ni,
    -  bpop,
    -  d,
    -  sigma,
    -  docc,
    -  poped.db
    -)
    -
    - -
    -

    Arguments

    -
    m
    -

    Number of groups in the study. Each individual in a group will have the same design.

    - - -
    ni_var
    -

    The ni_var.

    - - -
    dmf
    -

    The initial OFV. If set to zero then it is computed.

    - - -
    varopt
    -

    The varopt.

    - - -
    varopto
    -

    The varopto.

    - - -
    maxvar
    -

    The maxvar.

    - - -
    minvar
    -

    The minvar.

    - - -
    gradvar
    -

    The gradvar.

    - - -
    normgvar
    -

    The normgvar.

    - - -
    avar
    -

    The avar.

    - - -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    groupsize
    -

    A vector of the number of individuals in each group.

    - - -
    xtopt
    -

    The optimal sampling times matrix.

    - - -
    xopt
    -

    The optimal discrete design variables matrix.

    - - -
    aopt
    -

    The optimal continuous design variables matrix.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    bpop
    -

    Matrix defining the fixed effects, per row (row number = parameter_number) we should have:

    • column 1 the type of the distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, - 3 = User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the distribution (or length of uniform distribution).

    • -

    Can also just supply the parameter values as a vector c() if no uncertainty around the -parameter value is to be used. The parameter order of 'bpop' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'bpop' then the order will be worked out automatically.

    - - -
    d
    -

    Matrix defining the diagonals of the IIV (same logic as for the fixed effects -matrix bpop to define uncertainty). One can also just supply the parameter values as a c(). -The parameter order of 'd' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'd' then the order will be worked out automatically.

    - - -
    sigma
    -

    Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagonal parameter values (variances) as a c().

    - - -
    docc
    -

    Matrix defining the IOV, the IOV variances and the IOV distribution as for d and bpop.

    - - -
    poped.db
    -

    A PopED database.

    - -
    -
    -

    Value

    - - -

    A list containing:

    -
    navar
    -

    The autofocus parameter.

    - -
    poped.db
    -

    PopED database.

    - -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -if (FALSE) {
    -  
    -# Stochastic gradient search, DOSE and sample time optimization
    -sg.output <- poped_optimize(poped.db,opt_xt=1,opt_a=1, 
    -                            bUseRandomSearch= 0,
    -                            bUseStochasticGradient = 1,
    -                            bUseBFGSMinimizer = 0,
    -                            bUseLineSearch = 0,
    -                            sgit=20)
    -
    -}
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/calc_ofv_and_fim.html b/docs/reference/calc_ofv_and_fim.html deleted file mode 100644 index 7de90cbe..00000000 --- a/docs/reference/calc_ofv_and_fim.html +++ /dev/null @@ -1,397 +0,0 @@ - -Calculate the Fisher Information Matrix (FIM) and the OFV(FIM) for either point values or parameters or distributions. — calc_ofv_and_fim • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This function computes the expectation of the FIM and OFV(FIM) for either point values of parameter estimates -or parameter distributions given the model, parameters, -distributions of parameter uncertainty, design and methods defined in the -PopED database.

    -
    - -
    -
    calc_ofv_and_fim(
    -  poped.db,
    -  ofv = 0,
    -  fim = 0,
    -  d_switch = poped.db$settings$d_switch,
    -  bpopdescr = poped.db$parameters$bpop,
    -  ddescr = poped.db$parameters$d,
    -  bpop = bpopdescr[, 2, drop = F],
    -  d = getfulld(ddescr[, 2, drop = F], poped.db$parameters$covd),
    -  docc_full = getfulld(poped.db$parameters$docc[, 2, drop = F],
    -    poped.db$parameters$covdocc),
    -  model_switch = poped.db$design$model_switch,
    -  ni = poped.db$design$ni,
    -  xt = poped.db$design$xt,
    -  x = poped.db$design$x,
    -  a = poped.db$design$a,
    -  fim.calc.type = poped.db$settings$iFIMCalculationType,
    -  use_laplace = poped.db$settings$iEDCalculationType,
    -  laplace.fim = FALSE,
    -  ofv_fun = poped.db$settings$ofv_fun,
    -  evaluate_fim = TRUE,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    ofv
    -

    The current ofv. If other than zero then this value is simply returned unchanged.

    - - -
    fim
    -

    The current FIM. If other than zero then this value is simply returned unchanged.

    - - -
    d_switch
    -
    • ******START OF CRITERION SPECIFICATION OPTIONS**********

    • -

    D-family design (1) or ED-family design (0) (with or without parameter uncertainty)

    - - -
    bpopdescr
    -

    Matrix defining the fixed effects, per row (row number = -parameter_number) we should have:

    • column 1 the type of the -distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, 3 = -User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the -distribution (or length of uniform distribution).

    • -
    - - -
    ddescr
    -

    Matrix defining the diagonals of the IIV (same logic as for -the bpopdescr).

    - - -
    bpop
    -

    Matrix defining the fixed effects, per row (row number = parameter_number) we should have:

    • column 1 the type of the distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, - 3 = User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the distribution (or length of uniform distribution).

    • -

    Can also just supply the parameter values as a vector c() if no uncertainty around the -parameter value is to be used. The parameter order of 'bpop' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'bpop' then the order will be worked out automatically.

    - - -
    d
    -

    Matrix defining the diagonals of the IIV (same logic as for the fixed effects -matrix bpop to define uncertainty). One can also just supply the parameter values as a c(). -The parameter order of 'd' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'd' then the order will be worked out automatically.

    - - -
    docc_full
    -

    A between occasion variability matrix.

    - - -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    xt
    -

    A matrix of sample times. Each row is a vector of sample times for a group.

    - - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    a
    -

    A matrix of covariates. Each row is a group.

    - - -
    fim.calc.type
    -

    The method used for calculating the FIM. Potential values:

    • 0 = Full FIM. No assumption that fixed and random effects are uncorrelated.

    • -
    • 1 = Reduced FIM. Assume that there is no correlation in the FIM between the fixed and random effects, and set these elements in -the FIM to zero.

    • -
    • 2 = weighted models (placeholder).

    • -
    • 3 = Not currently used.

    • -
    • 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). -This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the residual unexplained variation by default).

    • -
    • 5 = Full FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    • 6 = Calculate one model switch at a time, good for large matrices.

    • -
    • 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    - - -
    use_laplace
    -

    Should the Laplace method be used in calculating the expectation of the OFV?

    - - -
    laplace.fim
    -

    Should an E(FIM) be calculated when computing the Laplace approximated E(OFV). Typically -the FIM does not need to be computed and, if desired, this calculation -is done using the standard MC integration technique, so can be slow.

    - - -
    ofv_fun
    -

    User defined function used to compute the objective function. The function must have a poped database object as its first -argument and have "..." in its argument list. Can be referenced as a function or as a file name where the function defined in the file has the same name as the file. -e.g. "cost.txt" has a function named "cost" in it.

    - - -
    evaluate_fim
    -

    Should the FIM be calculated?

    - - -
    ...
    -

    Other arguments passed to the function.

    - -
    -
    -

    Value

    - - -

    A list containing the FIM and OFV(FIM) or the E(FIM) and E(OFV(FIM)) according to the function arguments.

    -
    -
    -

    See also

    -

    Other FIM: -LinMatrixH(), -LinMatrixLH(), -LinMatrixL_occ(), -ed_laplace_ofv(), -ed_mftot(), -efficiency(), -evaluate.e.ofv.fim(), -evaluate.fim(), -gradf_eps(), -mf3(), -mf7(), -mftot(), -ofv_criterion(), -ofv_fim()

    -

    Other E-family: -ed_laplace_ofv(), -ed_mftot(), -evaluate.e.ofv.fim()

    -

    Other evaluate_FIM: -evaluate.e.ofv.fim(), -evaluate.fim(), -ofv_fim()

    -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization
    -##  with parameter uncertainty)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error
    -## to avoid sample times at very low concentrations (time 0 or very late samoples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -# Adding 10% log-normal Uncertainty to fixed effects (not Favail)
    -bpop_vals <- c(CL=0.15, V=8, KA=1.0, Favail=1)
    -bpop_vals_ed_ln <- cbind(ones(length(bpop_vals),1)*4, # log-normal distribution
    -                         bpop_vals,
    -                         ones(length(bpop_vals),1)*(bpop_vals*0.1)^2) # 10% of bpop value
    -bpop_vals_ed_ln["Favail",]  <- c(0,1,0)
    -bpop_vals_ed_ln
    -#>          bpop_vals         
    -#> CL     4      0.15 0.000225
    -#> V      4      8.00 0.640000
    -#> KA     4      1.00 0.010000
    -#> Favail 0      1.00 0.000000
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=bpop_vals_ed_ln, 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(0.01,0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0,
    -                                  maxxt=120,
    -                                  a=70,
    -                                  mina=0,
    -                                  maxa=100)
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization
    -##  with parameter uncertainty)
    -#####################################
    -
    -
    -calc_ofv_and_fim(poped.db)
    -#> $ofv
    -#> [1] 55.39645
    -#> 
    -#> $fim
    -#>             [,1]      [,2]      [,3]         [,4]         [,5]        [,6]
    -#> [1,] 17141.83891 20.838375 10.011000 0.000000e+00     0.000000  0.00000000
    -#> [2,]    20.83837 17.268051 -3.423641 0.000000e+00     0.000000  0.00000000
    -#> [3,]    10.01100 -3.423641 49.864697 0.000000e+00     0.000000  0.00000000
    -#> [4,]     0.00000  0.000000  0.000000 2.324341e+03     9.770352  0.03523364
    -#> [5,]     0.00000  0.000000  0.000000 9.770352e+00 19083.877564 11.72131703
    -#> [6,]     0.00000  0.000000  0.000000 3.523364e-02    11.721317 38.85137516
    -#> [7,]     0.00000  0.000000  0.000000 7.268410e+02  9656.158553 64.78095548
    -#> [8,]     0.00000  0.000000  0.000000 9.062739e+01   266.487127  2.94728469
    -#>              [,7]        [,8]
    -#> [1,]      0.00000    0.000000
    -#> [2,]      0.00000    0.000000
    -#> [3,]      0.00000    0.000000
    -#> [4,]    726.84097   90.627386
    -#> [5,]   9656.15855  266.487127
    -#> [6,]     64.78096    2.947285
    -#> [7,] 192840.20092 6659.569867
    -#> [8,]   6659.56987  475.500111
    -#> 
    -
    -if (FALSE) {
    -  
    -  calc_ofv_and_fim(poped.db,d_switch=0)
    -  calc_ofv_and_fim(poped.db,d_switch=0,use_laplace=TRUE)
    -  calc_ofv_and_fim(poped.db,d_switch=0,use_laplace=TRUE,laplace.fim=TRUE)
    -
    -}
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/calc_ofv_and_grad.html b/docs/reference/calc_ofv_and_grad.html deleted file mode 100644 index ed76388a..00000000 --- a/docs/reference/calc_ofv_and_grad.html +++ /dev/null @@ -1,365 +0,0 @@ - -Compute an objective function and gradient — calc_ofv_and_grad • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Compute an objective function and gradient with respect to the optimization parameters. -This function can be passed to the Broyden Fletcher Goldfarb Shanno (BFGS) -method for nonlinear minimization with box constraints implemented in bfgsb_min.

    -
    - -
    -
    calc_ofv_and_grad(
    -  x,
    -  optxt,
    -  opta,
    -  model_switch,
    -  aa,
    -  axt,
    -  groupsize,
    -  ni,
    -  xtopto,
    -  xopto,
    -  aopto,
    -  bpop,
    -  d,
    -  sigma,
    -  docc_full,
    -  poped.db,
    -  only_fim = FALSE
    -)
    -
    - -
    -

    Arguments

    -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    optxt
    -

    If sampling times are optimized

    - - -
    opta
    -

    If continuous design variables are optimized

    - - -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    aa
    -

    The aa value

    - - -
    axt
    -

    the axt value

    - - -
    groupsize
    -

    A vector of the number of individuals in each group.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    xtopto
    -

    the xtopto value

    - - -
    xopto
    -

    the xopto value

    - - -
    aopto
    -

    the aopto value

    - - -
    bpop
    -

    Matrix defining the fixed effects, per row (row number = parameter_number) we should have:

    • column 1 the type of the distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, - 3 = User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the distribution (or length of uniform distribution).

    • -

    Can also just supply the parameter values as a vector c() if no uncertainty around the -parameter value is to be used. The parameter order of 'bpop' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'bpop' then the order will be worked out automatically.

    - - -
    d
    -

    Matrix defining the diagonals of the IIV (same logic as for the fixed effects -matrix bpop to define uncertainty). One can also just supply the parameter values as a c(). -The parameter order of 'd' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'd' then the order will be worked out automatically.

    - - -
    sigma
    -

    Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagonal parameter values (variances) as a c().

    - - -
    docc_full
    -

    A between occasion variability matrix.

    - - -
    poped.db
    -

    A PopED database.

    - - -
    only_fim
    -

    Should the gradient be calculated?

    - -
    -
    -

    Value

    - - -

    A list containing:

    -
    f
    -

    The objective function.

    - -
    g
    -

    The gradient.

    - -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -opta=TRUE
    -aa=opta*poped.db$settings$cfaa*matrix(1,poped.db$design$m,size(poped.db$design$a,2))
    -aa
    -#>       [,1]
    -#> [1,] 0.001
    -
    -optxt=TRUE
    -axt=optxt*poped.db$settings$cfaxt*matrix(1,poped.db$design$m,max(poped.db$design_space$maxni))
    -axt
    -#>       [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]
    -#> [1,] 0.001 0.001 0.001 0.001 0.001 0.001 0.001 0.001
    -
    -calc_ofv_and_grad(x=c(poped.db$design$xt,poped.db$design$a),
    -                  optxt=optxt, opta=opta, 
    -                  model_switch=poped.db$design$model_switch,
    -                  aa=aa,
    -                  axt=axt,
    -                  groupsize=poped.db$design$groupsize,
    -                  ni=poped.db$design$ni,
    -                  xtopto=poped.db$design$xt,
    -                  xopto=poped.db$design$x,
    -                  aopto=poped.db$design$a,
    -                  bpop=poped.db$parameters$param.pt.val$bpop,
    -                  d=poped.db$parameters$param.pt.val$d,
    -                  sigma=poped.db$parameters$param.pt.val$sigma,
    -                  docc_full=poped.db$parameters$param.pt.val$docc,
    -                  poped.db,
    -                  only_fim=FALSE)
    -#> $f
    -#> [1] -55.39645
    -#> 
    -#> $g
    -#>               [,1]
    -#>  [1,]  0.079631184
    -#>  [2,] -0.025697327
    -#>  [3,] -0.312973786
    -#>  [4,]  0.009484130
    -#>  [5,]  0.019485306
    -#>  [6,] -0.001675713
    -#>  [7,] -0.009544063
    -#>  [8,] -0.001929802
    -#>  [9,] -0.035844547
    -#> 
    -
    -if (FALSE) {
    -  
    -  # BFGS search, DOSE and sample time optimization
    -  bfgs.output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,
    -                                bUseRandomSearch= 0,
    -                                bUseStochasticGradient = 0,
    -                                bUseBFGSMinimizer = 1,
    -                                bUseLineSearch = 0)
    -  
    -}
    -
    -
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/cell.html b/docs/reference/cell.html deleted file mode 100644 index 01126bd2..00000000 --- a/docs/reference/cell.html +++ /dev/null @@ -1,171 +0,0 @@ - -Create a cell array (a matrix of lists) — cell • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Create a cell array as in MATLAB.

    -
    - -
    -
    cell(...)
    -
    - -
    -

    Arguments

    -
    ...
    -

    Dimensions for the cell array.

    - -
    -
    -

    Value

    - - -

    A list of empty lists.

    -
    -
    -

    Note

    -

    This is a modified version of the same function in the matlab R-package.

    -
    -
    -

    See also

    -

    Other MATLAB: -diag_matlab(), -feval(), -fileparts(), -isempty(), -ones(), -randn(), -rand(), -size(), -tic(), -toc(), -zeros()

    -
    - -
    -

    Examples

    -
    
    -cell(3)
    -#>      [,1]      [,2]      [,3]     
    -#> [1,] numeric,0 numeric,0 numeric,0
    -#> [2,] numeric,0 numeric,0 numeric,0
    -#> [3,] numeric,0 numeric,0 numeric,0
    -cell(2,3)
    -#>      [,1]      [,2]      [,3]     
    -#> [1,] numeric,0 numeric,0 numeric,0
    -#> [2,] numeric,0 numeric,0 numeric,0
    -
    -## define possible values of 2 categorical design variable
    -x.space <- cell(1,2)
    -x.space[1,1] <- list(seq(10,100,10))
    -x.space[1,2] <- list(seq(10,300,10))
    -x.space
    -#>      [,1]       [,2]      
    -#> [1,] numeric,10 numeric,30
    -x.space[1,1]
    -#> [[1]]
    -#>  [1]  10  20  30  40  50  60  70  80  90 100
    -#> 
    -x.space[1,2]
    -#> [[1]]
    -#>  [1]  10  20  30  40  50  60  70  80  90 100 110 120 130 140 150 160 170 180 190
    -#> [20] 200 210 220 230 240 250 260 270 280 290 300
    -#> 
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/convert_variables.html b/docs/reference/convert_variables.html deleted file mode 100644 index d265d593..00000000 --- a/docs/reference/convert_variables.html +++ /dev/null @@ -1,136 +0,0 @@ - -Create global variables in the PopED database — convert_variables • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Function takes design variables from input files -and converts them to the global variables needed -in PopED. Typically not used by the user. Instead -use the function create.poped.database.

    -
    - -
    -
    convert_variables(poped.db)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database

    - -
    -
    -

    Value

    - - -

    A PopED database

    -
    - - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/create.poped.database.html b/docs/reference/create.poped.database.html deleted file mode 100644 index db8dd9a3..00000000 --- a/docs/reference/create.poped.database.html +++ /dev/null @@ -1,1015 +0,0 @@ - -Create a PopED database — create.poped.database • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This function takes the input file (a previously created poped database) supplied by the user, or function arguments, -and creates a database that can then be used to -run all other PopED functions. The function supplies default values to elements of the -database that are not specified in the -input file or as function arguments. Default arguments are supplied in the Usage section -(easiest to use a text search to find values you are interested in).

    -
    - -
    -
    create.poped.database(
    -  popedInput = list(),
    -  ff_file = NULL,
    -  ff_fun = poped.choose(popedInput$model$ff_pointer, NULL),
    -  fg_file = NULL,
    -  fg_fun = poped.choose(popedInput$model$fg_pointer, NULL),
    -  fError_file = NULL,
    -  fError_fun = poped.choose(popedInput$model$ferror_pointer, NULL),
    -  optsw = poped.choose(popedInput$settings$optsw, cbind(0, 0, 0, 0, 0)),
    -  xt = poped.choose(popedInput$design[["xt"]], stop("'xt' needs to be defined")),
    -  m = poped.choose(popedInput$design[["m"]], NULL),
    -  x = poped.choose(popedInput$design[["x"]], NULL),
    -  nx = poped.choose(popedInput$design$nx, NULL),
    -  a = poped.choose(popedInput$design[["a"]], NULL),
    -  groupsize = poped.choose(popedInput$design$groupsize,
    -    stop("'groupsize' needs to be defined")),
    -  ni = poped.choose(popedInput$design$ni, NULL),
    -  model_switch = poped.choose(popedInput$design$model_switch, NULL),
    -  maxni = poped.choose(popedInput$design_space$maxni, NULL),
    -  minni = poped.choose(popedInput$design_space$minni, NULL),
    -  maxtotni = poped.choose(popedInput$design_space$maxtotni, NULL),
    -  mintotni = poped.choose(popedInput$design_space$mintotni, NULL),
    -  maxgroupsize = poped.choose(popedInput$design_space$maxgroupsize, NULL),
    -  mingroupsize = poped.choose(popedInput$design_space$mingroupsize, NULL),
    -  maxtotgroupsize = poped.choose(popedInput$design_space$maxtotgroupsize, NULL),
    -  mintotgroupsize = poped.choose(popedInput$design_space$mintotgroupsize, NULL),
    -  maxxt = poped.choose(popedInput$design_space$maxxt, NULL),
    -  minxt = poped.choose(popedInput$design_space$minxt, NULL),
    -  discrete_xt = poped.choose(popedInput$design_space$xt_space, NULL),
    -  discrete_x = poped.choose(popedInput$design_space$discrete_x, NULL),
    -  maxa = poped.choose(popedInput$design_space$maxa, NULL),
    -  mina = poped.choose(popedInput$design_space$mina, NULL),
    -  discrete_a = poped.choose(popedInput$design_space$a_space, NULL),
    -  bUseGrouped_xt = poped.choose(popedInput$design_space$bUseGrouped_xt, FALSE),
    -  G_xt = poped.choose(popedInput$design_space$G_xt, NULL),
    -  bUseGrouped_a = poped.choose(popedInput$design_space$bUseGrouped_a, FALSE),
    -  G_a = poped.choose(popedInput$design_space$G_a, NULL),
    -  bUseGrouped_x = poped.choose(popedInput$design_space$bUseGrouped_x, FALSE),
    -  G_x = poped.choose(popedInput$design_space[["G_x"]], NULL),
    -  iFIMCalculationType = poped.choose(popedInput$settings$iFIMCalculationType, 1),
    -  iApproximationMethod = poped.choose(popedInput$settings$iApproximationMethod, 0),
    -  iFOCENumInd = poped.choose(popedInput$settings$iFOCENumInd, 1000),
    -  prior_fim = poped.choose(popedInput$settings$prior_fim, matrix(0, 0, 1)),
    -  strAutoCorrelationFile = poped.choose(popedInput$model$auto_pointer, ""),
    -  d_switch = poped.choose(popedInput$settings$d_switch, 1),
    -  ofv_calc_type = poped.choose(popedInput$settings$ofv_calc_type, 4),
    -  ds_index = popedInput$parameters$ds_index,
    -  strEDPenaltyFile = poped.choose(popedInput$settings$strEDPenaltyFile, ""),
    -  ofv_fun = poped.choose(popedInput$settings$ofv_fun, NULL),
    -  iEDCalculationType = poped.choose(popedInput$settings$iEDCalculationType, 0),
    -  ED_samp_size = poped.choose(popedInput$settings$ED_samp_size, 45),
    -  bLHS = poped.choose(popedInput$settings$bLHS, 1),
    -  strUserDistributionFile = poped.choose(popedInput$model$user_distribution_pointer, ""),
    -  nbpop = popedInput$parameters$nbpop,
    -  NumRanEff = popedInput$parameters$NumRanEff,
    -  NumDocc = popedInput$parameters$NumDocc,
    -  NumOcc = popedInput$parameters$NumOcc,
    -  bpop = poped.choose(popedInput$parameters$bpop, stop("bpop must be defined")),
    -  d = poped.choose(popedInput$parameters$d, NULL),
    -  covd = popedInput$parameters$covd,
    -  sigma = popedInput$parameters$sigma,
    -  docc = poped.choose(popedInput$parameters$docc, matrix(0, 0, 3)),
    -  covdocc = poped.choose(popedInput$parameters$covdocc, zeros(1, length(docc[, 2, drop =
    -    F]) * (length(docc[, 2, drop = F]) - 1)/2)),
    -  notfixed_bpop = popedInput$parameters$notfixed_bpop,
    -  notfixed_d = popedInput$parameters$notfixed_d,
    -  notfixed_covd = popedInput$parameters$notfixed_covd,
    -  notfixed_docc = popedInput$parameters$notfixed_docc,
    -  notfixed_covdocc = poped.choose(popedInput$parameters$notfixed_covdocc, zeros(1,
    -    length(covdocc))),
    -  notfixed_sigma = poped.choose(popedInput$parameters$notfixed_sigma, t(rep(1,
    -    size(sigma, 2)))),
    -  notfixed_covsigma = poped.choose(popedInput$parameters$notfixed_covsigma, zeros(1,
    -    length(notfixed_sigma) * (length(notfixed_sigma) - 1)/2)),
    -  bUseRandomSearch = poped.choose(popedInput$settings$bUseRandomSearch, TRUE),
    -  bUseStochasticGradient = poped.choose(popedInput$settings$bUseStochasticGradient, TRUE),
    -  bUseLineSearch = poped.choose(popedInput$settings$bUseLineSearch, TRUE),
    -  bUseExchangeAlgorithm = poped.choose(popedInput$settings$bUseExchangeAlgorithm, FALSE),
    -  bUseBFGSMinimizer = poped.choose(popedInput$settings$bUseBFGSMinimizer, FALSE),
    -  EACriteria = poped.choose(popedInput$settings$EACriteria, 1),
    -  strRunFile = poped.choose(popedInput$settings$run_file_pointer, ""),
    -  poped_version = poped.choose(popedInput$settings$poped_version,
    -    packageVersion("PopED")),
    -  modtit = poped.choose(popedInput$settings$modtit, "PopED model"),
    -  output_file = poped.choose(popedInput$settings$output_file, paste("PopED_output",
    -    "_summary", sep = "")),
    -  output_function_file = poped.choose(popedInput$settings$output_function_file,
    -    paste("PopED", "_output_", sep = "")),
    -  strIterationFileName = poped.choose(popedInput$settings$strIterationFileName,
    -    paste("PopED", "_current.R", sep = "")),
    -  user_data = poped.choose(popedInput$settings$user_data, cell(0, 0)),
    -  ourzero = poped.choose(popedInput$settings$ourzero, 1e-05),
    -  dSeed = poped.choose(popedInput$settings$dSeed, NULL),
    -  line_opta = poped.choose(popedInput$settings$line_opta, NULL),
    -  line_optx = poped.choose(popedInput$settings$line_optx, NULL),
    -  bShowGraphs = poped.choose(popedInput$settings$bShowGraphs, FALSE),
    -  use_logfile = poped.choose(popedInput$settings$use_logfile, FALSE),
    -  m1_switch = poped.choose(popedInput$settings$m1_switch, 1),
    -  m2_switch = poped.choose(popedInput$settings$m2_switch, 1),
    -  hle_switch = poped.choose(popedInput$settings$hle_switch, 1),
    -  gradff_switch = poped.choose(popedInput$settings$gradff_switch, 1),
    -  gradfg_switch = poped.choose(popedInput$settings$gradfg_switch, 1),
    -  grad_all_switch = poped.choose(popedInput$settings$grad_all_switch, 1),
    -  rsit_output = poped.choose(popedInput$settings$rsit_output, 5),
    -  sgit_output = poped.choose(popedInput$settings$sgit_output, 1),
    -  hm1 = poped.choose(popedInput$settings[["hm1"]], 1e-05),
    -  hlf = poped.choose(popedInput$settings[["hlf"]], 1e-05),
    -  hlg = poped.choose(popedInput$settings[["hlg"]], 1e-05),
    -  hm2 = poped.choose(popedInput$settings[["hm2"]], 1e-05),
    -  hgd = poped.choose(popedInput$settings[["hgd"]], 1e-05),
    -  hle = poped.choose(popedInput$settings[["hle"]], 1e-05),
    -  AbsTol = poped.choose(popedInput$settings$AbsTol, 1e-06),
    -  RelTol = poped.choose(popedInput$settings$RelTol, 1e-06),
    -  iDiffSolverMethod = poped.choose(popedInput$settings$iDiffSolverMethod, NULL),
    -  bUseMemorySolver = poped.choose(popedInput$settings$bUseMemorySolver, FALSE),
    -  rsit = poped.choose(popedInput$settings[["rsit"]], 300),
    -  sgit = poped.choose(popedInput$settings[["sgit"]], 150),
    -  intrsit = poped.choose(popedInput$settings$intrsit, 250),
    -  intsgit = poped.choose(popedInput$settings$intsgit, 50),
    -  maxrsnullit = poped.choose(popedInput$settings$maxrsnullit, 50),
    -  convergence_eps = poped.choose(popedInput$settings$convergence_eps, 1e-08),
    -  rslxt = poped.choose(popedInput$settings$rslxt, 10),
    -  rsla = poped.choose(popedInput$settings$rsla, 10),
    -  cfaxt = poped.choose(popedInput$settings$cfaxt, 0.001),
    -  cfaa = poped.choose(popedInput$settings$cfaa, 0.001),
    -  bGreedyGroupOpt = poped.choose(popedInput$settings$bGreedyGroupOpt, FALSE),
    -  EAStepSize = poped.choose(popedInput$settings$EAStepSize, 0.01),
    -  EANumPoints = poped.choose(popedInput$settings$EANumPoints, FALSE),
    -  EAConvergenceCriteria = poped.choose(popedInput$settings$EAConvergenceCriteria, 1e-20),
    -  bEANoReplicates = poped.choose(popedInput$settings$bEANoReplicates, FALSE),
    -  BFGSConvergenceCriteriaMinStep = NULL,
    -  BFGSProjectedGradientTol = poped.choose(popedInput$settings$BFGSProjectedGradientTol,
    -    1e-04),
    -  BFGSTolerancef = poped.choose(popedInput$settings$BFGSTolerancef, 0.001),
    -  BFGSToleranceg = poped.choose(popedInput$settings$BFGSToleranceg, 0.9),
    -  BFGSTolerancex = poped.choose(popedInput$settings$BFGSTolerancex, 0.1),
    -  ED_diff_it = poped.choose(popedInput$settings$ED_diff_it, 30),
    -  ED_diff_percent = poped.choose(popedInput$settings$ED_diff_percent, 10),
    -  line_search_it = poped.choose(popedInput$settings$ls_step_size, 50),
    -  Doptim_iter = poped.choose(popedInput$settings$iNumSearchIterationsIfNotLineSearch, 1),
    -  iCompileOption = poped.choose(popedInput$settings$parallel$iCompileOption, -1),
    -  iUseParallelMethod = poped.choose(popedInput$settings$parallel$iUseParallelMethod, 1),
    -  MCC_Dep = NULL,
    -  strExecuteName = poped.choose(popedInput$settings$parallel$strExecuteName,
    -    "calc_fim.exe"),
    -  iNumProcesses = poped.choose(popedInput$settings$parallel$iNumProcesses, 2),
    -  iNumChunkDesignEvals = poped.choose(popedInput$settings$parallel$iNumChunkDesignEvals,
    -    -2),
    -  Mat_Out_Pre = poped.choose(popedInput$settings$parallel$strMatFileOutputPrefix,
    -    "parallel_output"),
    -  strExtraRunOptions = poped.choose(popedInput$settings$parallel$strExtraRunOptions, ""),
    -  dPollResultTime = poped.choose(popedInput$settings$parallel$dPollResultTime, 0.1),
    -  strFunctionInputName = poped.choose(popedInput$settings$parallel$strFunctionInputName,
    -    "function_input"),
    -  bParallelRS = poped.choose(popedInput$settings$parallel$bParallelRS, FALSE),
    -  bParallelSG = poped.choose(popedInput$settings$parallel$bParallelSG, FALSE),
    -  bParallelMFEA = poped.choose(popedInput$settings$parallel$bParallelMFEA, FALSE),
    -  bParallelLS = poped.choose(popedInput$settings$parallel$bParallelLS, FALSE)
    -)
    -
    - -
    -

    Arguments

    -
    popedInput
    -

    A PopED database file or an empty list list(). List elements should match the values seen in -the Usage section (the defaults to function arguments).

    - - -
    ff_file
    -
    • ******START OF MODEL DEFINITION OPTIONS**********

    • -

    A string giving the function name or filename and path of the structural model. -The filename and the function name must be the same if giving a filename. -e.g. "ff.PK.1.comp.oral.md.KE"

    - - -
    ff_fun
    -

    Function describing the structural model. e.g. ff.PK.1.comp.oral.md.KE.

    - - -
    fg_file
    -

    A string giving the function name or filename and path of the -parameter model. -The filename and the function name must be the same if giving a filename. -e.g. "parameter.model"

    - - -
    fg_fun
    -

    Function describing the parameter model. e.g. parameter.model.

    - - -
    fError_file
    -

    A string giving the function name or filename and path of the -residual error model. -The filename and the function name must be the same if giving a filename. -e.g. "feps.prop".

    - - -
    fError_fun
    -

    Function describing the residual error model. e.g. feps.prop.

    - - -
    optsw
    -
    • ******WHAT TO OPTIMIZE**********

    • -

    Row vector of optimization tasks (1=TRUE,0=FALSE) in the following order: -(Samples per subject, Sampling schedule, Discrete design variable, Continuous design variable, Number of id per group). -All elements set to zero => only calculate the FIM with current design

    - - -
    xt
    -
    • ******START OF INITIAL DESIGN OPTIONS**********

    • -

    Matrix defining the initial sampling schedule. - Each row is a group/individual. - If only one vector is supplied, e.g. c(1,2,3,4), then all groups will -have the same initial design.

    - - -
    m
    -

    Number of groups in the study. Each individual in a group will have the same design.

    - - -
    x
    -

    A matrix defining the initial discrete values for the model -Each row is a group/individual.

    - - -
    nx
    -

    Number of discrete design variables.

    - - -
    a
    -

    Matrix defining the initial continuous covariate values. -n_rows=number of groups, n_cols=number of covariates. -If the number of rows is one and the number of groups > 1 then all groups are assigned the -same values.

    - - -
    groupsize
    -

    Vector defining the size of the different groups (num individuals in each group). -If only one number then the number will be the same in every group.

    - - -
    ni
    -

    Vector defining the number of samples for each group.

    - - -
    model_switch
    -

    Matrix defining which response a certain sampling time belongs to.

    - - -
    maxni
    -
    • ******START OF DESIGN SPACE OPTIONS**********

    • -

    Max number of samples per group/individual

    - - -
    minni
    -

    Min number of samples per group/individual

    - - -
    maxtotni
    -

    Number defining the maximum number of samples allowed in the experiment.

    - - -
    mintotni
    -

    Number defining the minimum number of samples allowed in the experiment.

    - - -
    maxgroupsize
    -

    Vector defining the max size of the different groups (max number of individuals in each group)

    - - -
    mingroupsize
    -

    Vector defining the min size of the different groups (min num individuals in each group) --

    - - -
    maxtotgroupsize
    -

    The total maximal groupsize over all groups

    - - -
    mintotgroupsize
    -

    The total minimal groupsize over all groups

    - - -
    maxxt
    -

    Matrix or single value defining the maximum value for each xt sample. If a single value is -supplied then all xt values are given the same maximum value.

    - - -
    minxt
    -

    Matrix or single value defining the minimum value for each xt sample. If a single value is -supplied then all xt values are given the same minimum value

    - - -
    discrete_xt
    -

    Cell array cell defining the discrete variables allowed for each xt value. - Can also be a list of values list(1:10) (same values allowed for all xt), or a list of lists -list(1:10, 2:23, 4:6) (one for each value in xt). See examples in create_design_space.

    - - -
    discrete_x
    -

    Cell array defining the discrete variables for each x value. -See examples in create_design_space.

    - - -
    maxa
    -

    Vector defining the max value for each covariate. If a single value is supplied then -all a values are given the same max value

    - - -
    mina
    -

    Vector defining the min value for each covariate. If a single value is supplied then -all a values are given the same max value

    - - -
    discrete_a
    -

    Cell array cell defining the discrete variables allowed for each a value. - Can also be a list of values list(1:10) (same values allowed for all a), or a list of lists -list(1:10, 2:23, 4:6) (one for each value in a). See examples in create_design_space.

    - - -
    bUseGrouped_xt
    -

    Use grouped time points (1=TRUE, 0=FALSE).

    - - -
    G_xt
    -

    Matrix defining the grouping of sample points. Matching integers mean that the points are matched.

    - - -
    bUseGrouped_a
    -

    Use grouped covariates (1=TRUE, 0=FALSE)

    - - -
    G_a
    -

    Matrix defining the grouping of covariates. Matching integers mean that the points are matched.

    - - -
    bUseGrouped_x
    -

    Use grouped discrete design variables (1=TRUE, 0=FALSE).

    - - -
    G_x
    -

    Matrix defining the grouping of discrete design variables. Matching integers mean that the points are matched.

    - - -
    iFIMCalculationType
    -
    • ******START OF FIM CALCULATION OPTIONS**********

    • -

    Fisher Information Matrix type

    • 0=Full FIM

    • -
    • 1=Reduced FIM

    • -
    • 2=weighted models

    • -
    • 3=Loc models

    • -
    • 4=reduced FIM with derivative of SD of sigma as in PFIM

    • -
    • 5=FULL FIM parameterized with A,B,C matrices & derivative of variance

    • -
    • 6=Calculate one model switch at a time, good for large matrices

    • -
    • 7=Reduced FIM parameterized with A,B,C matrices & derivative of variance

    • -
    - - -
    iApproximationMethod
    -

    Approximation method for model, 0=FO, 1=FOCE, 2=FOCEI, 3=FOI

    - - -
    iFOCENumInd
    -

    Num individuals in each step of FOCE

    - - -
    prior_fim
    -

    The prior FIM (added to calculated FIM)

    - - -
    strAutoCorrelationFile
    -

    Filename and path, or function name, for the Autocorrelation function, -empty string means no autocorrelation.

    - - -
    d_switch
    -
    • ******START OF CRITERION SPECIFICATION OPTIONS**********

    • -

    D-family design (1) or ED-family design (0) (with or without parameter uncertainty)

    - - -
    ofv_calc_type
    -

    OFV calculation type for FIM

    • 1 = "D-optimality". Determinant of the FIM: det(FIM)

    • -
    • 2 = "A-optimality". Inverse of the sum of the expected parameter variances: -1/trace_matrix(inv(FIM))

    • -
    • 4 = "lnD-optimality". Natural logarithm of the determinant of the FIM: log(det(FIM))

    • -
    • 6 = "Ds-optimality". Ratio of the Determinant of the FIM and the Determinant of the uninteresting -rows and columns of the FIM: det(FIM)/det(FIM_u)

    • -
    • 7 = Inverse of the sum of the expected parameter RSE: 1/sum(get_rse(FIM,poped.db,use_percent=FALSE))

    • -
    - - -
    ds_index
    -

    Ds_index is a vector set to 1 if a parameter is uninteresting, otherwise 0. -size=(1,num unfixed parameters). First unfixed bpop, then unfixed d, then unfixed docc and last unfixed sigma. -Default is the fixed effects being important, everything else not important. Used in conjunction with -ofv_calc_type=6.

    - - -
    strEDPenaltyFile
    -

    Penalty function name or path and filename, empty string means no penalty. -User defined criterion can be defined this way.

    - - -
    ofv_fun
    -

    User defined function used to compute the objective function. The function must have a poped database object as its first -argument and have "..." in its argument list. Can be referenced as a function or as a file name where the function defined in the file has the same name as the file. -e.g. "cost.txt" has a function named "cost" in it.

    - - -
    iEDCalculationType
    -
    • ******START OF E-FAMILY CRITERION SPECIFICATION OPTIONS**********

    • -

    ED Integral Calculation, 0=Monte-Carlo-Integration, 1=Laplace Approximation, 2=BFGS Laplace Approximation -- --

    - - -
    ED_samp_size
    -

    Sample size for E-family sampling

    - - -
    bLHS
    -

    How to sample from distributions in E-family calculations. 0=Random Sampling, 1=LatinHyperCube --

    - - -
    strUserDistributionFile
    -

    Filename and path, or function name, for user defined distributions for E-family designs

    - - -
    nbpop
    -
    • ******START OF Model parameters SPECIFICATION OPTIONS**********

    • -

    Number of typical values

    - - -
    NumRanEff
    -

    Number of IIV parameters. Typically can be computed from other values and not supplied.

    - - -
    NumDocc
    -

    Number of IOV variance parameters. Typically can be computed from other values and not supplied.

    - - -
    NumOcc
    -

    Number of occasions. Typically can be computed from other values and not supplied.

    - - -
    bpop
    -

    Matrix defining the fixed effects, per row (row number = parameter_number) we should have:

    • column 1 the type of the distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, - 3 = User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the distribution (or length of uniform distribution).

    • -

    Can also just supply the parameter values as a vector c() if no uncertainty around the -parameter value is to be used. The parameter order of 'bpop' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'bpop' then the order will be worked out automatically.

    - - -
    d
    -

    Matrix defining the diagonals of the IIV (same logic as for the fixed effects -matrix bpop to define uncertainty). One can also just supply the parameter values as a c(). -The parameter order of 'd' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'd' then the order will be worked out automatically.

    - - -
    covd
    -

    Column major vector defining the covariances of the IIV variances. -That is, from your full IIV matrix covd <- IIV[lower.tri(IIV)].

    - - -
    sigma
    -

    Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagonal parameter values (variances) as a c().

    - - -
    docc
    -

    Matrix defining the IOV, the IOV variances and the IOV distribution as for d and bpop.

    - - -
    covdocc
    -

    Column major vector defining the covariance of the IOV, as in covd.

    - - -
    notfixed_bpop
    -
    • ******START OF Model parameters fixed or not SPECIFICATION OPTIONS**********

    • -

    Vector defining if a typical value is fixed or not (1=not fixed, 0=fixed). -The parameter order of 'notfixed_bpop' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'notfixed_bpop' then the order will be worked out automatically.

    - - -
    notfixed_d
    -

    Vector defining if a IIV is fixed or not (1=not fixed, 0=fixed). -The parameter order of 'notfixed_d' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'notfixed_d' then the order will be worked out automatically.

    - - -
    notfixed_covd
    -

    Vector defining if a covariance IIV is fixed or not (1=not fixed, 0=fixed)

    - - -
    notfixed_docc
    -

    Vector defining if an IOV variance is fixed or not (1=not fixed, 0=fixed)

    - - -
    notfixed_covdocc
    -

    Vector row major order for lower triangular matrix defining if a covariance IOV is fixed or not (1=not fixed, 0=fixed)

    - - -
    notfixed_sigma
    -

    Vector defining if a residual error parameter is fixed or not (1=not fixed, 0=fixed)

    - - -
    notfixed_covsigma
    -

    Vector defining if a covariance residual error parameter is fixed or not (1=not fixed, 0=fixed). -Default is fixed.

    - - -
    bUseRandomSearch
    -
    • ******START OF Optimization algorithm SPECIFICATION OPTIONS**********

    • -

    Use random search (1=TRUE, 0=FALSE)

    - - -
    bUseStochasticGradient
    -

    Use Stochastic Gradient search (1=TRUE, 0=FALSE)

    - - -
    bUseLineSearch
    -

    Use Line search (1=TRUE, 0=FALSE)

    - - -
    bUseExchangeAlgorithm
    -

    Use Exchange algorithm (1=TRUE, 0=FALSE)

    - - -
    bUseBFGSMinimizer
    -

    Use BFGS Minimizer (1=TRUE, 0=FALSE)

    - - -
    EACriteria
    -

    Exchange Algorithm Criteria, 1 = Modified, 2 = Fedorov

    - - -
    strRunFile
    -

    Filename and path, or function name, for a run file that is used instead of the regular PopED call.

    - - -
    poped_version
    -
    • ******START OF Labeling and file names SPECIFICATION OPTIONS**********

    • -

    The current PopED version

    - - -
    modtit
    -

    The model title

    - - -
    output_file
    -

    Filename and path of the output file during search

    - - -
    output_function_file
    -

    Filename suffix of the result function file

    - - -
    strIterationFileName
    -

    Filename and path for storage of current optimal design

    - - -
    user_data
    -
    • ******START OF Miscellaneous SPECIFICATION OPTIONS**********

    • -

    User defined data structure that, for example could be used to send in data to the model

    - - -
    ourzero
    -

    Value to interpret as zero in design

    - - -
    dSeed
    -

    The seed number used for optimization and sampling -- integer or -1 which creates a random seed as.integer(Sys.time()) or NULL.

    - - -
    line_opta
    -

    Vector for line search on continuous design variables (1=TRUE,0=FALSE)

    - - -
    line_optx
    -

    Vector for line search on discrete design variables (1=TRUE,0=FALSE)

    - - -
    bShowGraphs
    -

    Use graph output during search

    - - -
    use_logfile
    -

    If a log file should be used (0=FALSE, 1=TRUE)

    - - -
    m1_switch
    -

    Method used to calculate M1 -(0=Complex difference, 1=Central difference, 20=Analytic derivative, 30=Automatic differentiation)

    - - -
    m2_switch
    -

    Method used to calculate M2 -(0=Central difference, 1=Central difference, 20=Analytic derivative, 30=Automatic differentiation)

    - - -
    hle_switch
    -

    Method used to calculate linearization of residual error -(0=Complex difference, 1=Central difference, 30=Automatic differentiation)

    - - -
    gradff_switch
    -

    Method used to calculate the gradient of the model -(0=Complex difference, 1=Central difference, 20=Analytic derivative, 30=Automatic differentiation)

    - - -
    gradfg_switch
    -

    Method used to calculate the gradient of the parameter vector g -(0=Complex difference, 1=Central difference, 20=Analytic derivative, 30=Automatic differentiation)

    - - -
    grad_all_switch
    -

    Method used to calculate all the gradients -(0=Complex difference, 1=Central difference)

    - - -
    rsit_output
    -

    Number of iterations in random search between screen output

    - - -
    sgit_output
    -

    Number of iterations in stochastic gradient search between screen output

    - - -
    hm1
    -

    Step length of derivative of linearized model w.r.t. typical values

    - - -
    hlf
    -

    Step length of derivative of model w.r.t. g

    - - -
    hlg
    -

    Step length of derivative of g w.r.t. b

    - - -
    hm2
    -

    Step length of derivative of variance w.r.t. typical values

    - - -
    hgd
    -

    Step length of derivative of OFV w.r.t. time

    - - -
    hle
    -

    Step length of derivative of model w.r.t. sigma

    - - -
    AbsTol
    -

    The absolute tolerance for the diff equation solver

    - - -
    RelTol
    -

    The relative tolerance for the diff equation solver

    - - -
    iDiffSolverMethod
    -

    The diff equation solver method, NULL as default.

    - - -
    bUseMemorySolver
    -

    If the differential equation results should be stored in memory (1) or not (0)

    - - -
    rsit
    -

    Number of Random search iterations

    - - -
    sgit
    -

    Number of stochastic gradient iterations

    - - -
    intrsit
    -

    Number of Random search iterations with discrete optimization.

    - - -
    intsgit
    -

    Number of Stochastic Gradient search iterations with discrete optimization

    - - -
    maxrsnullit
    -

    Iterations until adaptive narrowing in random search

    - - -
    convergence_eps
    -

    Stochastic Gradient convergence value, -(difference in OFV for D-optimal, difference in gradient for ED-optimal)

    - - -
    rslxt
    -

    Random search locality factor for sample times

    - - -
    rsla
    -

    Random search locality factor for covariates

    - - -
    cfaxt
    -

    Stochastic Gradient search first step factor for sample times

    - - -
    cfaa
    -

    Stochastic Gradient search first step factor for covariates

    - - -
    bGreedyGroupOpt
    -

    Use greedy algorithm for group assignment optimization

    - - -
    EAStepSize
    -

    Exchange Algorithm StepSize

    - - -
    EANumPoints
    -

    Exchange Algorithm NumPoints

    - - -
    EAConvergenceCriteria
    -

    Exchange Algorithm Convergence Limit/Criteria

    - - -
    bEANoReplicates
    -

    Avoid replicate samples when using Exchange Algorithm

    - - -
    BFGSConvergenceCriteriaMinStep
    -

    BFGS Minimizer Convergence Criteria Minimum Step

    - - -
    BFGSProjectedGradientTol
    -

    BFGS Minimizer Convergence Criteria Normalized Projected Gradient Tolerance

    - - -
    BFGSTolerancef
    -

    BFGS Minimizer Line Search Tolerance f

    - - -
    BFGSToleranceg
    -

    BFGS Minimizer Line Search Tolerance g

    - - -
    BFGSTolerancex
    -

    BFGS Minimizer Line Search Tolerance x

    - - -
    ED_diff_it
    -

    Number of iterations in ED-optimal design to calculate convergence criteria

    - - -
    ED_diff_percent
    -

    ED-optimal design convergence criteria in percent

    - - -
    line_search_it
    -

    Number of grid points in the line search

    - - -
    Doptim_iter
    -

    Number of iterations of full Random search and full Stochastic Gradient if line search is not used

    - - -
    iCompileOption
    -

    ******START OF PARALLEL OPTIONS********** Compile options for PopED

    • -1 = No compilation,

    • -
    • 0 or 3 = Full compilation,

    • -
    • 1 or 4 = Only using MCC (shared lib),

    • -
    • 2 or 5 = Only MPI,

    • -
    • Option 0,1,2 runs PopED and option 3,4,5 stops after compilation

    • -
    - - -
    iUseParallelMethod
    -

    Parallel method to use (0 = Matlab PCT, 1 = MPI)

    - - -
    MCC_Dep
    -

    Additional dependencies used in MCC compilation (mat-files), if several space separated

    - - -
    strExecuteName
    -

    Compilation output executable name

    - - -
    iNumProcesses
    -

    Number of processes to use when running in parallel (e.g. 3 = 2 workers, 1 job manager)

    - - -
    iNumChunkDesignEvals
    -

    Number of design evaluations that should be evaluated in each process before getting new work from job manager

    - - -
    Mat_Out_Pre
    -

    The prefix of the output mat file to communicate with the executable

    - - -
    strExtraRunOptions
    -

    Extra options send to e$g. the MPI executable or a batch script, see execute_parallel$m for more information and options

    - - -
    dPollResultTime
    -

    Polling time to check if the parallel execution is finished

    - - -
    strFunctionInputName
    -

    The file containing the popedInput structure that should be used to evaluate the designs

    - - -
    bParallelRS
    -

    If the random search is going to be executed in parallel

    - - -
    bParallelSG
    -

    If the stochastic gradient search is going to be executed in parallel

    - - -
    bParallelMFEA
    -

    If the modified exchange algorithm is going to be executed in parallel

    - - -
    bParallelLS
    -

    If the line search is going to be executed in parallel

    - -
    -
    -

    Value

    - - -

    A PopED database

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    ## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -library(PopED)
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.md.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         N = floor(xt/TAU) + 1
    -#>         y = (DOSE * Favail/V) * (KA/(KA - CL/V)) * (exp(-CL/V * 
    -#>             (xt - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - 
    -#>             exp(-CL/V * TAU)) - exp(-KA * (xt - (N - 1) * TAU)) * 
    -#>             (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU)))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1104c9b70>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -    return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_file="ff.PK.1.comp.oral.sd.CL",
    -                                  fg_file="sfg",
    -                                  fError_file="feps.prop",
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=0.01,
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0,
    -                                  maxxt=120,
    -                                  a=70)
    -#> Warning: cannot open file 'sfg': No such file or directory
    -#> Error in file(filename, "r", encoding = encoding): cannot open the connection
    -
    -
    -## evaluate initial design
    -evaluate_design(poped.db)
    -#> Error in eval(expr, envir, enclos): object 'poped.db' not found
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/create_design.html b/docs/reference/create_design.html deleted file mode 100644 index 1ab71001..00000000 --- a/docs/reference/create_design.html +++ /dev/null @@ -1,218 +0,0 @@ - -Create design variables for a full description of a design. — create_design • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Create design variables to fully describe a design. -If variables are supplied then these variables are checked for -consistency and, if possible, changed to sizes that make -sense if there are inconsistencies. -Returns a list of matricies compatible with PopED.

    -
    - -
    -
    create_design(
    -  xt,
    -  groupsize,
    -  m = NULL,
    -  x = NULL,
    -  a = NULL,
    -  ni = NULL,
    -  model_switch = NULL
    -)
    -
    - -
    -

    Arguments

    -
    xt
    -

    Matrix defining the sampling schedule. -Each row is a group.

    - - -
    groupsize
    -

    Vector defining the size of the different groups (number of individuals in each group).

    - - -
    m
    -

    A number defining the number of groups. Computed from xt if not defined.

    - - -
    x
    -

    A matrix defining the discrete design variables for the model -Each row is a group.

    - - -
    a
    -

    Matrix defining the continuous design variables. Each row is a group.

    - - -
    ni
    -

    Vector defining the number of samples for each group, computed as all elements of xt for each group by default.

    - - -
    model_switch
    -

    Matrix defining which response a certain sampling time belongs to. Defaults to one for all elements of xt.

    - -
    -
    -

    Details

    -

    If a value (or a vector/list of values) is supplied that corresponds to only one group and the design has -multiple groups then all groups will have the same value(s). If a matrix is expected then a list of lists can be supplied -instead, each list corresponding to a group.

    -
    - - -
    -

    Examples

    -
    library(PopED)
    -
    -xt1 <- list(c(1,2,3),c(1,2,3,4))
    -xt4 <- list(c(1,2,3,4,5),c(1,2,3,4))
    -xt2 <- rbind(c(1,2,3,4),c(1,2,3,4))
    -xt3 <- c(1,2,3,4)
    -
    -design_1 <- create_design(xt=xt1,groupsize=20)
    -design_2 <- create_design(xt=xt4,groupsize=20)
    -design_3 <- create_design(xt=xt2,groupsize=20)
    -design_4 <- create_design(xt=xt3,groupsize=20)
    -
    -design_5 <- create_design(xt=xt3,groupsize=20,m=3)
    -
    -design_6 <- create_design(xt=xt1,groupsize=20,model_switch=ones(2,4))
    -
    -design_7 <-create_design(xt=xt1,groupsize=20,a=c(2,3,4))
    -design_8 <-create_design(xt=xt1,groupsize=20,a=rbind(c(2,3,4),c(4,5,6)))
    -design_9 <-create_design(xt=xt1,groupsize=20,a=list(c(2,3,4,6),c(4,5,6)))
    -design_10 <-create_design(xt=xt1,groupsize=20,a=list(c(2,3,4),c(4,5,6)))
    -
    -design_11 <-create_design(xt=c(0,1,2,4,6,8,24),
    -                         groupsize=50,
    -                         a=c(WT=70,DOSE=1000))
    -
    -design_12 <-create_design(xt=c(0,1,2,4,6,8,24),
    -                         groupsize=50,
    -                         a=c(WT=70,DOSE=1000),m=2)
    -
    -design_13 <-create_design(xt=c(0,1,2,4,6,8,24),
    -                         groupsize=50,
    -                         a=list(c(WT=70,DOSE=1000),c(DOSE=90,WT=200,AGE=45)),m=2)
    -
    -design_14 <-create_design(xt=c(0,1,2,4,6,8,24),
    -                         groupsize=50,
    -                         a=list(list(WT=70,DOSE=1000),list(DOSE=90,WT=200,AGE=45)),m=2)
    -
    -design_15 <-create_design(xt=xt4,
    -                          groupsize=c(50,20),
    -                          a=rbind(c("DOSE"=2,"WT"=3,"AGE"=4),
    -                                  c(4,5,6)))
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/create_design_space.html b/docs/reference/create_design_space.html deleted file mode 100644 index ba1d4879..00000000 --- a/docs/reference/create_design_space.html +++ /dev/null @@ -1,348 +0,0 @@ - -Create design variables and a design space for a full description of an optimization problem. — create_design_space • PopED - - -
    -
    - - - -
    -
    - - -
    -

    create_design_space takes an initial design and arguments for a design space and -creates a design and design space for design optimization. -Checks the sizes of supplied design space variables and -changes them to sizes that make sense if there are inconsistencies. -Function arguments can use shorthand notation (single values, vectors, lists of vectors and -list of list) or matricies. -Returns a list of matricies compatible with PopED.

    -
    - -
    -
    create_design_space(
    -  design,
    -  maxni = NULL,
    -  minni = NULL,
    -  maxtotni = NULL,
    -  mintotni = NULL,
    -  maxgroupsize = NULL,
    -  mingroupsize = NULL,
    -  maxtotgroupsize = NULL,
    -  mintotgroupsize = NULL,
    -  maxxt = NULL,
    -  minxt = NULL,
    -  xt_space = NULL,
    -  maxa = NULL,
    -  mina = NULL,
    -  a_space = NULL,
    -  x_space = NULL,
    -  use_grouped_xt = FALSE,
    -  grouped_xt = NULL,
    -  use_grouped_a = FALSE,
    -  grouped_a = NULL,
    -  use_grouped_x = FALSE,
    -  grouped_x = NULL,
    -  our_zero = NULL
    -)
    -
    - -
    -

    Arguments

    -
    design
    -

    The output from a call to create_design.

    - - -
    maxni
    -

    Vector defining the maximum number of samples per group.

    - - -
    minni
    -

    Vector defining the minimum number of samples per group.

    - - -
    maxtotni
    -

    Number defining the maximum number of samples allowed in the experiment.

    - - -
    mintotni
    -

    Number defining the minimum number of samples allowed in the experiment.

    - - -
    maxgroupsize
    -

    Vector defining the maximum size of the different groups (maximum number of individuals in each group)

    - - -
    mingroupsize
    -

    Vector defining the minimum size of the different groups (minimum num individuals in each group)

    - - -
    maxtotgroupsize
    -

    The total maximal groupsize over all groups

    - - -
    mintotgroupsize
    -

    The total minimal groupsize over all groups

    - - -
    maxxt
    -

    Matrix or single value defining the maximum value for each xt sample. If a single value is -supplied then all xt values are given the same maximum value.

    - - -
    minxt
    -

    Matrix or single value defining the minimum value for each xt sample. If a single value is -supplied then all xt values are given the same minimum value

    - - -
    xt_space
    -

    Cell array cell defining the discrete variables allowed for each xt value. - Can also be a vector of values c(1:10) (same values allowed for all xt), or a list of lists -list(1:10, 2:23, 4:6) (one for each value in xt in row major order or just for one row in xt, -and all other rows will be duplicated).

    - - -
    maxa
    -

    Vector defining the maximum value for each covariate. IF a single value is supplied then -all a values are given the same maximum value

    - - -
    mina
    -

    Vector defining the minimum value for each covariate. IF a single value is supplied then -all a values are given the same minimum value

    - - -
    a_space
    -

    Cell array cell defining the discrete variables allowed for each a value. - Can also be a list of values list(1:10) (same values allowed for all a), or a list of lists -list(1:10, 2:23, 4:6) (one for each value in a).

    - - -
    x_space
    -

    Cell array cell defining the discrete variables for each x value.

    - - -
    use_grouped_xt
    -

    Group sampling times between groups so that each group has the same values (TRUE or FALSE).

    - - -
    grouped_xt
    -

    Matrix defining the grouping of sample points. Matching integers mean that the points are matched. -Allows for finer control than use_grouped_xt

    - - -
    use_grouped_a
    -

    Group continuous design variables between groups so that each group has the same values (TRUE or FALSE).

    - - -
    grouped_a
    -

    Matrix defining the grouping of continuous design variables. Matching integers mean that the values are matched. -Allows for finer control than use_grouped_a.

    - - -
    use_grouped_x
    -

    Group discrete design variables between groups so that each group has the same values (TRUE or FALSE).

    - - -
    grouped_x
    -

    Matrix defining the grouping of discrete design variables. Matching integers mean that the values are matched. -Allows for finer control than use_grouped_x.

    - - -
    our_zero
    -

    Value to interpret as zero in design.

    - -
    -
    -

    Details

    -

    If a value (or a vector or a list of values) is supplied that corresponds to only one group and the design has -multiple groups then all groups will have the same value(s). If a matrix is expected then a list of lists can be supplied -instead, each list corresponding to a group.

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -design_1 <- create_design(xt=list(c(1,2,3,4,5),
    -                                  c(1,2,3,4)),
    -                          groupsize=c(50,20),
    -                          a=list(c(WT=70,DOSE=1000),
    -                                 c(DOSE=1000,WT=35)))
    -
    -ds_1 <- create_design_space(design_1)
    -
    -ds_1_a <- create_design_space(design_1,our_zero = 1e-5)
    -
    -ds_2 <- create_design_space(design_1,maxni=10,maxxt=10,minxt=0)
    -
    -ds_3 <- create_design_space(design_1,maxni=10,mingroupsize=20,maxxt=10,minxt=0)
    -
    -ds_4 <- create_design_space(design_1,maxa=c(100,2000))
    -
    -ds_5 <- create_design_space(design_1,mina=c(10,20))
    -
    -design_2 <- create_design(xt=list(c(1,2,3,4,5),
    -                                  c(1,2,3,4)),
    -                          groupsize=c(50,20),
    -                          a=list(c(WT=70,DOSE=1000),
    -                                 c(WT=35,DOSE=1000)),
    -                          x=list(c(SEX=1,DOSE_discrete=100),
    -                                 c(SEX=2,DOSE_discrete=200)))
    -
    -ds_6 <- create_design_space(design_2) 
    -
    -ds_7 <- create_design_space(design_2,
    -                            x_space=list(SEX=c(1,2),
    -                                         DOSE_discrete=seq(100,400,by=20)))
    -
    -ds_8 <- create_design_space(design_2,
    -                            x_space=list(SEX=c(1,2),
    -                                         DOSE_discrete=seq(100,400,by=20)),
    -                            grouped_xt=c(1,2,3,4,5))
    -
    -ds_9 <- create_design_space(design_2,
    -                            x_space=list(SEX=c(1,2),
    -                                         DOSE_discrete=seq(100,400,by=20)),
    -                            use_grouped_xt=TRUE)
    -
    -design_3 <- create_design(xt=list(c(1,2,3,4,5),
    -                                  c(1,2,3,4)),
    -                          groupsize=c(50,20),
    -                          a=list(c(WT=35,DOSE=1000)),
    -                          x=list(c(SEX=1,DOSE_discrete=100)))
    -
    -ds_10 <- create_design_space(design_3,
    -                             x_space=list(SEX=c(1,2),DOSE_discrete=seq(100,400,by=20)),
    -                             use_grouped_a=TRUE)
    -
    -ds_11 <- create_design_space(design_2,
    -                             x_space=list(SEX=c(1,2),DOSE_discrete=seq(100,400,by=20)),
    -                             grouped_a=list(c(1,2),c(3,2)))
    -
    -ds_12 <- create_design_space(design_3,
    -                             x_space=list(SEX=c(1,2),DOSE_discrete=seq(100,400,by=20)),
    -                             use_grouped_x=TRUE)
    -
    -ds_13 <- create_design_space(design_3,
    -                             x_space=list(SEX=c(1,2),DOSE_discrete=seq(100,400,by=20)),
    -                             grouped_x=list(c(1,2),c(3,2)))
    -
    -seq_1 <- 1:10
    -ds_14 <- create_design_space(design_1,maxxt=10,minxt=0,
    -                             xt_space = list(seq_1,seq_1,seq_1,seq_1,seq_1))
    -ds_15 <- create_design_space(design_1,maxxt=10,minxt=0,xt_space = list(seq_1))
    -
    -possible_values <- as.matrix(cbind(list(0:10),list(0:10),list(0:10),list(0:20),list(0:20)))
    -xt_space <- as.matrix(rbind(possible_values,possible_values))
    -
    -ds_16 <- create_design_space(design_1,maxxt=10,minxt=0,xt_space = xt_space)
    -
    -ds_17 <- create_design_space(design_1,a_space = list(1:100,seq(1000,100000,by=1000)))
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/design_summary.html b/docs/reference/design_summary.html deleted file mode 100644 index a204edba..00000000 --- a/docs/reference/design_summary.html +++ /dev/null @@ -1,123 +0,0 @@ - -Display a summary of output from poped_db — design_summary • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Display a summary of output from poped_db

    -
    - -
    -
    design_summary(poped_db, file = "", ...)
    -
    - -
    -

    Arguments

    -
    poped_db
    -

    An object returned from create.poped.database to summarize.

    - - -
    file
    -

    A file handle to write to. Default is to the R console.

    - - -
    ...
    -

    Additional arguments. Passed to blockfinal.

    - -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/diag_matlab.html b/docs/reference/diag_matlab.html deleted file mode 100644 index fc00e852..00000000 --- a/docs/reference/diag_matlab.html +++ /dev/null @@ -1,182 +0,0 @@ - -Function written to match MATLAB's diag function — diag_matlab • PopED - - -
    -
    - - - -
    -
    - - -
    -

    There are some differences between tha MATLAB and the R version of diag. -Specifically, if a 1xN or a Nx1 matrix is supplied to the R -diag function then just the first element of this vector is -returned. This function tries to match the MATLAB version in handling vectors -(matricies with one dimension equal to one), and will return a diagonal -matrix in these situations.

    -
    - -
    -
    diag_matlab(mat)
    -
    - -
    -

    Arguments

    -
    mat
    -

    Either a vector to make into a diagonal matrix or a matrix you -want to extract the diagonal from

    - -
    -
    -

    Value

    - - -

    Either a diagonal matrix or the diagonal of a matrix.

    -
    -
    -

    See also

    -

    Other MATLAB: -cell(), -feval(), -fileparts(), -isempty(), -ones(), -randn(), -rand(), -size(), -tic(), -toc(), -zeros()

    -
    - -
    -

    Examples

    -
    
    -diag_matlab(3)
    -#>      [,1] [,2] [,3]
    -#> [1,]    1    0    0
    -#> [2,]    0    1    0
    -#> [3,]    0    0    1
    -diag_matlab(c(1,2,3))
    -#>      [,1] [,2] [,3]
    -#> [1,]    1    0    0
    -#> [2,]    0    2    0
    -#> [3,]    0    0    3
    -diag_matlab(cbind(1,2,3))
    -#>      [,1] [,2] [,3]
    -#> [1,]    1    0    0
    -#> [2,]    0    2    0
    -#> [3,]    0    0    3
    -diag_matlab(rbind(1,2,3))
    -#>      [,1] [,2] [,3]
    -#> [1,]    1    0    0
    -#> [2,]    0    2    0
    -#> [3,]    0    0    3
    -
    -diag_matlab(matrix(c(1, 2, 3),6,6))
    -#> [1] 1 2 3 1 2 3
    -
    -# here is where the R default does something different
    -diag(cbind(1,2,3))
    -#> [1] 1
    -diag(rbind(1,2,3))
    -#> [1] 1
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/downsizing_general_design.html b/docs/reference/downsizing_general_design.html deleted file mode 100644 index a0d7e4f9..00000000 --- a/docs/reference/downsizing_general_design.html +++ /dev/null @@ -1,150 +0,0 @@ - -Downsize a general design to a specific design — downsizing_general_design • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Function takes a design with potentially empty design -variables and rescues the design so that a FIM can be calculated using mftot.

    -
    - -
    -
    downsizing_general_design(poped.db)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database

    - -
    -
    -

    Value

    - - -

    A list containing:

    -
    ni
    -

    A vector of the number of samples in each group.

    - -
    xt
    -

    A matrix of sample times. Each row is a vector of sample times for a group.

    - -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - -
    a
    -

    A matrix of covariates. Each row is a group.

    - -
    bpop
    -

    A matrix of fixed effect parameter values.

    - -
    -
    -

    See also

    - -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/ed_laplace_ofv.html b/docs/reference/ed_laplace_ofv.html deleted file mode 100644 index c0f8bc49..00000000 --- a/docs/reference/ed_laplace_ofv.html +++ /dev/null @@ -1,421 +0,0 @@ - -Evaluate the expectation of determinant the Fisher Information Matrix (FIM) -using the Laplace approximation. — ed_laplace_ofv • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Compute the expectation of the det(FIM) using the Laplace -approximation to the expectation. Computations are made based on the model, -parameters, distributions of parameter uncertainty, design and methods -defined in the PopED database or as arguments to the function.

    -
    - -
    -
    ed_laplace_ofv(
    -  model_switch,
    -  groupsize,
    -  ni,
    -  xtopto,
    -  xopto,
    -  aopto,
    -  bpopdescr,
    -  ddescr,
    -  covd,
    -  sigma,
    -  docc,
    -  poped.db,
    -  method = 1,
    -  return_gradient = FALSE,
    -  optxt = poped.db$settings$optsw[2],
    -  opta = poped.db$settings$optsw[4],
    -  x = c(),
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    groupsize
    -

    A vector of the number of individuals in each group.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    xtopto
    -

    the sampling times

    - - -
    xopto
    -

    the discrete design variables

    - - -
    aopto
    -

    the continuous design variables

    - - -
    bpopdescr
    -

    Matrix defining the fixed effects, per row (row number = -parameter_number) we should have:

    • column 1 the type of the -distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, 3 = -User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the -distribution (or length of uniform distribution).

    • -
    - - -
    ddescr
    -

    Matrix defining the diagonals of the IIV (same logic as for -the bpopdescr).

    - - -
    covd
    -

    Column major vector defining the covariances of the IIV variances. -That is, from your full IIV matrix covd <- IIV[lower.tri(IIV)].

    - - -
    sigma
    -

    Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagonal parameter values (variances) as a c().

    - - -
    docc
    -

    Matrix defining the IOV, the IOV variances and the IOV distribution as for d and bpop.

    - - -
    poped.db
    -

    A PopED database.

    - - -
    method
    -

    If 0 then use an optimization routine translated from PopED code written in MATLAB to -optimize the parameters in the Laplace approximation. If 1 then use optim to compute both -k and the hessian of k (see Dodds et al, JPP, 2005 for more information). If 2 then use fdHess -to compute the hessian.

    - - -
    return_gradient
    -

    Should the gradient be returned.

    - - -
    optxt
    -

    If sampling times are optimized

    - - -
    opta
    -

    If continuous design variables are optimized

    - - -
    x
    -

    The design parameters to compute the gradient on.

    - - -
    ...
    -

    Arguments passed through from other functions, does not pass anything to another function.

    - -
    -
    -

    Value

    - - -

    The FIM and the hessian of the FIM.

    -
    -
    -

    Details

    -

    This computation follows the method outlined in Dodds et al, -"Robust Population Pharmacokinetic Experiment Design" JPP, 2005, equation 16.

    -

    Typically this function will not be run by the user. Instead use evaluate.e.ofv.fim.

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    ## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error to 
    -##   avoid sample times at very low concentrations (time 0 or very late samoples).
    -library(PopED)
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -######################
    -# Normal distribution
    -######################
    -bpop_vals <- c(CL=0.15, V=8, KA=1.0, Favail=1)
    -bpop_vals_ed_n <- cbind(ones(length(bpop_vals),1)*1, # normal distribution
    -                        bpop_vals,
    -                        ones(length(bpop_vals),1)*(bpop_vals*0.1)^2) # 10% of bpop value
    -bpop_vals_ed_n["Favail",]  <- c(0,1,0)
    -bpop_vals_ed_n
    -#>          bpop_vals         
    -#> CL     1      0.15 0.000225
    -#> V      1      8.00 0.640000
    -#> KA     1      1.00 0.010000
    -#> Favail 0      1.00 0.000000
    -
    -## -- Define initial design  and design space
    -poped.db.n <- create.poped.database(ff_file="ff.PK.1.comp.oral.sd.CL",
    -                                    fg_file="sfg",
    -                                    fError_file="feps.add.prop",
    -                                    bpop=bpop_vals_ed_n, 
    -                                    notfixed_bpop=c(1,1,1,0),
    -                                    d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                    sigma=c(0.01,0.25),
    -                                    groupsize=32,
    -                                    xt=c( 0.5,1,2,6,24,36,72,120),
    -                                    minxt=0,
    -                                    maxxt=120,
    -                                    a=70,
    -                                    mina=0,
    -                                    maxa=100)
    -#> Warning: cannot open file 'sfg': No such file or directory
    -#> Error in file(filename, "r", encoding = encoding): cannot open the connection
    -
    -
    -## ED evaluate using LaPlace approximation 
    -tic(); output <- evaluate.e.ofv.fim(poped.db.n,use_laplace=TRUE); toc()
    -#> Error in eval(expr, envir, enclos): object 'poped.db.n' not found
    -#> Elapsed time: 0 seconds.
    -output$E_ofv
    -#> Error in eval(expr, envir, enclos): object 'output' not found
    -
    -if (FALSE) {
    -  
    -  
    -  ## ED value using MC integration (roughly)
    -  tic();e_ofv_mc_n <- evaluate.e.ofv.fim(poped.db.n,ED_samp_size=500,ofv_calc_type = 1);toc()
    -  e_ofv_mc_n$E_ofv
    -  
    -  
    -  ## Using ed_laplce_ofv directly
    -  ed_laplace_ofv(model_switch=poped.db.n$design$model_switch,
    -                 groupsize=poped.db.n$design$groupsize,
    -                 ni=poped.db.n$design$ni,
    -                 xtopto=poped.db.n$design$xt,
    -                 xopto=poped.db.n$design$x,
    -                 aopto=poped.db.n$design$a,
    -                 bpopdescr=poped.db.n$parameters$bpop,
    -                 ddescr=poped.db.n$parameters$d,
    -                 covd=poped.db.n$parameters$covd,
    -                 sigma=poped.db.n$parameters$sigma,
    -                 docc=poped.db.n$parameters$docc, 
    -                 poped.db.n)
    -  
    -  
    -  ######################
    -  # Log-normal distribution
    -  ######################
    -  
    -  # Adding 10% log-normal Uncertainty to fixed effects (not Favail)
    -  bpop_vals <- c(CL=0.15, V=8, KA=1.0, Favail=1)
    -  bpop_vals_ed_ln <- cbind(ones(length(bpop_vals),1)*4, # log-normal distribution
    -                           bpop_vals,
    -                           ones(length(bpop_vals),1)*(bpop_vals*0.1)^2) # 10% of bpop value
    -  bpop_vals_ed_ln["Favail",]  <- c(0,1,0)
    -  bpop_vals_ed_ln
    -  
    -  ## -- Define initial design  and design space
    -  poped.db.ln <- create.poped.database(ff_file="ff.PK.1.comp.oral.sd.CL",
    -                                       fg_file="sfg",
    -                                       fError_file="feps.add.prop",
    -                                       bpop=bpop_vals_ed_ln, 
    -                                       notfixed_bpop=c(1,1,1,0),
    -                                       d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                       sigma=c(0.01,0.25),
    -                                       groupsize=32,
    -                                       xt=c( 0.5,1,2,6,24,36,72,120),
    -                                       minxt=0,
    -                                       maxxt=120,
    -                                       a=70,
    -                                       mina=0,
    -                                       maxa=100)
    -  
    -  
    -  
    -  ## ED evaluate using LaPlace approximation 
    -  tic()
    -  output <- evaluate.e.ofv.fim(poped.db.ln,use_laplace=TRUE)
    -  toc()
    -  output$E_ofv
    -  
    -  ## expected value (roughly)
    -  tic()
    -  e_ofv_mc_ln <- evaluate.e.ofv.fim(poped.db.ln,ED_samp_size=500,ofv_calc_type = 1)[["E_ofv"]]
    -  toc()
    -  e_ofv_mc_ln
    -  
    -  ## Using ed_laplce_ofv directly
    -  ed_laplace_ofv(model_switch=poped.db.ln$design$model_switch,
    -                 groupsize=poped.db.ln$design$groupsize,
    -                 ni=poped.db.ln$design$ni,
    -                 xtopto=poped.db.ln$design$xt,
    -                 xopto=poped.db.ln$design$x,
    -                 aopto=poped.db.ln$design$a,
    -                 bpopdescr=poped.db.ln$parameters$bpop,
    -                 ddescr=poped.db.ln$parameters$d,
    -                 covd=poped.db.ln$parameters$covd,
    -                 sigma=poped.db.ln$parameters$sigma,
    -                 docc=poped.db.ln$parameters$docc, 
    -                 poped.db.ln)
    -  
    -  
    -  
    -  
    -}
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/ed_mftot.html b/docs/reference/ed_mftot.html deleted file mode 100644 index 2341a153..00000000 --- a/docs/reference/ed_mftot.html +++ /dev/null @@ -1,322 +0,0 @@ - -Evaluate the expectation of the Fisher Information Matrix (FIM) and the expectation of the OFV(FIM). — ed_mftot • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Compute the expectation of the FIM given the model, parameters, distributions of parameter uncertainty, design and methods defined in the -PopED database.

    -
    - -
    -
    ed_mftot(
    -  model_switch,
    -  groupsize,
    -  ni,
    -  xtoptn,
    -  xoptn,
    -  aoptn,
    -  bpopdescr,
    -  ddescr,
    -  covd,
    -  sigma,
    -  docc,
    -  poped.db,
    -  calc_fim = TRUE,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    groupsize
    -

    A vector of the number of individuals in each group.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    xtoptn
    -

    The xtoptn value

    - - -
    xoptn
    -

    The xoptn

    - - -
    aoptn
    -

    The aoptn value

    - - -
    bpopdescr
    -

    Matrix defining the fixed effects, per row (row number = -parameter_number) we should have:

    • column 1 the type of the -distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, 3 = -User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the -distribution (or length of uniform distribution).

    • -
    - - -
    ddescr
    -

    Matrix defining the diagonals of the IIV (same logic as for -the bpopdescr).

    - - -
    covd
    -

    Column major vector defining the covariances of the IIV variances. -That is, from your full IIV matrix covd <- IIV[lower.tri(IIV)].

    - - -
    sigma
    -

    Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagonal parameter values (variances) as a c().

    - - -
    docc
    -

    Matrix defining the IOV, the IOV variances and the IOV distribution as for d and bpop.

    - - -
    poped.db
    -

    A PopED database.

    - - -
    calc_fim
    -

    Should the FIM be calculated or should we just use the user defined ed_penalty_pointer.

    - - -
    ...
    -

    Other arguments passed to the function.

    - -
    -
    -

    Value

    - - -

    A list containing the E(FIM) and E(OFV(FIM)) and the a poped.db.

    -
    - - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization
    -##  with parameter uncertainty)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error
    -## to avoid sample times at very low concentrations (time 0 or very late samoples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -# Adding 10% log-normal Uncertainty to fixed effects (not Favail)
    -bpop_vals <- c(CL=0.15, V=8, KA=1.0, Favail=1)
    -bpop_vals_ed_ln <- cbind(ones(length(bpop_vals),1)*4, # log-normal distribution
    -                         bpop_vals,
    -                         ones(length(bpop_vals),1)*(bpop_vals*0.1)^2) # 10% of bpop value
    -bpop_vals_ed_ln["Favail",]  <- c(0,1,0)
    -bpop_vals_ed_ln
    -#>          bpop_vals         
    -#> CL     4      0.15 0.000225
    -#> V      4      8.00 0.640000
    -#> KA     4      1.00 0.010000
    -#> Favail 0      1.00 0.000000
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=bpop_vals_ed_ln, 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(0.01,0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0,
    -                                  maxxt=120,
    -                                  a=70,
    -                                  mina=0,
    -                                  maxa=100)
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization
    -##  with parameter uncertainty)
    -#####################################
    -
    -
    -# very few samples
    -poped.db$settings$ED_samp_size=10
    -ed_mftot(model_switch=poped.db$design$model_switch,
    -         groupsize=poped.db$design$groupsize,
    -         ni=poped.db$design$ni,
    -         xtoptn=poped.db$design$xt,
    -         xoptn=poped.db$design$x,
    -         aoptn=poped.db$design$a,
    -         bpopdescr=poped.db$parameters$bpop,
    -         ddescr=poped.db$parameters$d,
    -         covd=poped.db$parameters$covd,
    -         sigma=poped.db$parameters$sigma,
    -         docc=poped.db$parameters$docc, 
    -         poped.db)["ED_ofv"]
    -#> $ED_ofv
    -#> [1] 55.39808
    -#> 
    -
    -  
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/efficiency.html b/docs/reference/efficiency.html deleted file mode 100644 index a45e0caf..00000000 --- a/docs/reference/efficiency.html +++ /dev/null @@ -1,190 +0,0 @@ - -Compute efficiency. — efficiency • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Efficiency calculation between two designs.

    -
    - -
    -
    efficiency(
    -  ofv_init,
    -  ofv_final,
    -  poped_db,
    -  npar = get_fim_size(poped_db),
    -  ofv_calc_type = poped_db$settings$ofv_calc_type,
    -  ds_index = poped_db$parameters$ds_index,
    -  use_log = TRUE,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    ofv_init
    -

    An initial objective function

    - - -
    ofv_final
    -

    A final objective function.

    - - -
    poped_db
    -

    a poped database

    - - -
    npar
    -

    The number of parameters to use for normalization.

    - - -
    ofv_calc_type
    -

    OFV calculation type for FIM

    • 1 = "D-optimality". Determinant of the FIM: det(FIM)

    • -
    • 2 = "A-optimality". Inverse of the sum of the expected parameter variances: -1/trace_matrix(inv(FIM))

    • -
    • 4 = "lnD-optimality". Natural logarithm of the determinant of the FIM: log(det(FIM))

    • -
    • 6 = "Ds-optimality". Ratio of the Determinant of the FIM and the Determinant of the uninteresting -rows and columns of the FIM: det(FIM)/det(FIM_u)

    • -
    • 7 = Inverse of the sum of the expected parameter RSE: 1/sum(get_rse(FIM,poped.db,use_percent=FALSE))

    • -
    - - -
    ds_index
    -

    Ds_index is a vector set to 1 if a parameter is uninteresting, otherwise 0. -size=(1,num unfixed parameters). First unfixed bpop, then unfixed d, then unfixed docc and last unfixed sigma. -Default is the fixed effects being important, everything else not important. Used in conjunction with -ofv_calc_type=6.

    - - -
    use_log
    -

    Are the `ofv` arguments in the log space?

    - - -
    ...
    -

    arguments passed to evaluate.fim and ofv_fim.

    - -
    -
    -

    Value

    - - -

    The specified efficiency value depending on the ofv_calc_type. -The attribute "description" tells you how the calculation was made -attr(return_vale,"description")

    - - -
    -
    -

    See also

    - -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/evaluate.e.ofv.fim.html b/docs/reference/evaluate.e.ofv.fim.html deleted file mode 100644 index a92fa9b9..00000000 --- a/docs/reference/evaluate.e.ofv.fim.html +++ /dev/null @@ -1,402 +0,0 @@ - -Evaluate the expectation of the Fisher Information Matrix (FIM) and the expectation of the OFV(FIM). — evaluate.e.ofv.fim • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Compute the expectation of the FIM and OFV(FIM) given the model, parameters, distributions of parameter uncertainty, design and methods defined in the -PopED database. Some of the arguments coming from the PopED database can be overwritten; -by default these arguments are NULL in the -function, if they are supplied then they are used instead of the arguments from the PopED database.

    -
    - -
    -
    evaluate.e.ofv.fim(
    -  poped.db,
    -  fim.calc.type = NULL,
    -  bpop = poped.db$parameters$bpop,
    -  d = poped.db$parameters$d,
    -  covd = poped.db$parameters$covd,
    -  docc = poped.db$parameters$docc,
    -  sigma = poped.db$parameters$sigma,
    -  model_switch = NULL,
    -  ni = NULL,
    -  xt = NULL,
    -  x = NULL,
    -  a = NULL,
    -  groupsize = poped.db$design$groupsize,
    -  deriv.type = NULL,
    -  bLHS = poped.db$settings$bLHS,
    -  ofv_calc_type = poped.db$settings$ofv_calc_type,
    -  ED_samp_size = poped.db$settings$ED_samp_size,
    -  use_laplace = poped.db$settings$iEDCalculationType,
    -  laplace.fim = FALSE,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    fim.calc.type
    -

    The method used for calculating the FIM. Potential values:

    • 0 = Full FIM. No assumption that fixed and random effects are uncorrelated.

    • -
    • 1 = Reduced FIM. Assume that there is no correlation in the FIM between the fixed and random effects, and set these elements in -the FIM to zero.

    • -
    • 2 = weighted models (placeholder).

    • -
    • 3 = Not currently used.

    • -
    • 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). -This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the residual unexplained variation by default).

    • -
    • 5 = Full FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    • 6 = Calculate one model switch at a time, good for large matrices.

    • -
    • 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    - - -
    bpop
    -

    Matrix defining the fixed effects, per row (row number = parameter_number) we should have:

    • column 1 the type of the distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, - 3 = User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the distribution (or length of uniform distribution).

    • -

    Can also just supply the parameter values as a vector c() if no uncertainty around the -parameter value is to be used. The parameter order of 'bpop' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'bpop' then the order will be worked out automatically.

    - - -
    d
    -

    Matrix defining the diagonals of the IIV (same logic as for the fixed effects -matrix bpop to define uncertainty). One can also just supply the parameter values as a c(). -The parameter order of 'd' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'd' then the order will be worked out automatically.

    - - -
    covd
    -

    Column major vector defining the covariances of the IIV variances. -That is, from your full IIV matrix covd <- IIV[lower.tri(IIV)].

    - - -
    docc
    -

    Matrix defining the IOV, the IOV variances and the IOV distribution as for d and bpop.

    - - -
    sigma
    -

    Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagonal parameter values (variances) as a c().

    - - -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    xt
    -

    A matrix of sample times. Each row is a vector of sample times for a group.

    - - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    a
    -

    A matrix of covariates. Each row is a group.

    - - -
    groupsize
    -

    A vector of the number of individuals in each group.

    - - -
    deriv.type
    -

    A number indicating the type of derivative to use:

    • 0=Complex difference

    • -
    • 1=Central difference

    • -
    • 20=Analytic derivative (placeholder)

    • -
    • 30=Automatic differentiation (placeholder)

    • -
    - - -
    bLHS
    -

    How to sample from distributions in E-family calculations. 0=Random Sampling, 1=LatinHyperCube --

    - - -
    ofv_calc_type
    -

    OFV calculation type for FIM

    • 1 = "D-optimality". Determinant of the FIM: det(FIM)

    • -
    • 2 = "A-optimality". Inverse of the sum of the expected parameter variances: -1/trace_matrix(inv(FIM))

    • -
    • 4 = "lnD-optimality". Natural logarithm of the determinant of the FIM: log(det(FIM))

    • -
    • 6 = "Ds-optimality". Ratio of the Determinant of the FIM and the Determinant of the uninteresting -rows and columns of the FIM: det(FIM)/det(FIM_u)

    • -
    • 7 = Inverse of the sum of the expected parameter RSE: 1/sum(get_rse(FIM,poped.db,use_percent=FALSE))

    • -
    - - -
    ED_samp_size
    -

    Sample size for E-family sampling

    - - -
    use_laplace
    -

    Should the Laplace method be used in calculating the expectation of the OFV?

    - - -
    laplace.fim
    -

    Should an E(FIM) be calculated when computing the Laplace approximated E(OFV). Typically -the FIM does not need to be computed and, if desired, this calculation -is done using the standard MC integration technique, so can be slow.

    - - -
    ...
    -

    Other arguments passed to the function.

    - -
    -
    -

    Value

    - - -

    A list containing the E(FIM) and E(OFV(FIM)) and the a poped.db updated according to the function arguments.

    -
    -
    -

    See also

    -

    Other FIM: -LinMatrixH(), -LinMatrixLH(), -LinMatrixL_occ(), -calc_ofv_and_fim(), -ed_laplace_ofv(), -ed_mftot(), -efficiency(), -evaluate.fim(), -gradf_eps(), -mf3(), -mf7(), -mftot(), -ofv_criterion(), -ofv_fim()

    -

    Other E-family: -calc_ofv_and_fim(), -ed_laplace_ofv(), -ed_mftot()

    -

    Other evaluate_FIM: -calc_ofv_and_fim(), -evaluate.fim(), -ofv_fim()

    -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization
    -##  with parameter uncertainty)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error
    -## to avoid sample times at very low concentrations (time 0 or very late samoples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -# Adding 10% log-normal Uncertainty to fixed effects (not Favail)
    -bpop_vals <- c(CL=0.15, V=8, KA=1.0, Favail=1)
    -bpop_vals_ed_ln <- cbind(ones(length(bpop_vals),1)*4, # log-normal distribution
    -                         bpop_vals,
    -                         ones(length(bpop_vals),1)*(bpop_vals*0.1)^2) # 10% of bpop value
    -bpop_vals_ed_ln["Favail",]  <- c(0,1,0)
    -bpop_vals_ed_ln
    -#>          bpop_vals         
    -#> CL     4      0.15 0.000225
    -#> V      4      8.00 0.640000
    -#> KA     4      1.00 0.010000
    -#> Favail 0      1.00 0.000000
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=bpop_vals_ed_ln, 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(0.01,0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0,
    -                                  maxxt=120,
    -                                  a=70,
    -                                  mina=0,
    -                                  maxa=100)
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization
    -##  with parameter uncertainty)
    -#####################################
    -
    -
    -## ED evaluate (with very few samples)
    -output <- evaluate.e.ofv.fim(poped.db,ED_samp_size=10)
    -output$E_ofv
    -#> [1] 55.46269
    -
    -## API evaluate (with very few samples)
    -output <- evaluate.e.ofv.fim(poped.db,ED_samp_size=10,ofv_calc_type=4)
    -output$E_ofv
    -#> [1] 55.41279
    -
    -## ED evaluate using Laplace approximation 
    -tic()
    -output <- evaluate.e.ofv.fim(poped.db,use_laplace=TRUE)
    -toc()
    -#> Elapsed time: 0.429 seconds.
    -output$E_ofv
    -#> [1] 1.302805e+24
    -
    -if (FALSE) {
    -
    -  ## ED expected value with more precision. 
    -  ## Compare time and value to Laplace approximation.
    -  ## Run a couple of times to see stochasticity of calculation.
    -  tic()
    -  e_ofv_mc <- evaluate.e.ofv.fim(poped.db,ED_samp_size=500)
    -  toc()
    -  e_ofv_mc$E_ofv
    -  
    -  # If you want to get an E(FIM) from the laplace approximation you have to ask for it
    -  # and it will take more time.
    -  output <- evaluate.e.ofv.fim(poped.db,use_laplace=TRUE,laplace.fim=TRUE)
    -  output$E_fim
    -  
    - 
    -
    -}
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/evaluate.fim.html b/docs/reference/evaluate.fim.html deleted file mode 100644 index d78404e4..00000000 --- a/docs/reference/evaluate.fim.html +++ /dev/null @@ -1,445 +0,0 @@ - -Evaluate the Fisher Information Matrix (FIM) — evaluate.fim • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Compute the FIM given the model, parameters, design and methods defined in the -PopED database. Some of the arguments coming from the PopED database can be overwritten; -by default these arguments are NULL in the -function, if they are supplied then they are used instead of the arguments from the PopED database.

    -
    - -
    -
    evaluate.fim(
    -  poped.db,
    -  fim.calc.type = NULL,
    -  approx.method = NULL,
    -  FOCE.num = NULL,
    -  bpop.val = NULL,
    -  d_full = NULL,
    -  docc_full = NULL,
    -  sigma_full = NULL,
    -  model_switch = NULL,
    -  ni = NULL,
    -  xt = NULL,
    -  x = NULL,
    -  a = NULL,
    -  groupsize = NULL,
    -  deriv.type = NULL,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    fim.calc.type
    -

    The method used for calculating the FIM. Potential values:

    • 0 = Full FIM. No assumption that fixed and random effects are uncorrelated.

    • -
    • 1 = Reduced FIM. Assume that there is no correlation in the FIM between the fixed and random effects, and set these elements in -the FIM to zero.

    • -
    • 2 = weighted models (placeholder).

    • -
    • 3 = Not currently used.

    • -
    • 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). -This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the residual unexplained variation by default).

    • -
    • 5 = Full FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    • 6 = Calculate one model switch at a time, good for large matrices.

    • -
    • 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    - - -
    approx.method
    -

    Approximation method for model, 0=FO, 1=FOCE, 2=FOCEI, 3=FOI

    - - -
    FOCE.num
    -

    Number individuals in each step of FOCE approximation method

    - - -
    bpop.val
    -

    The fixed effects parameter values. Supplied as a vector.

    - - -
    d_full
    -

    A between subject variability matrix (OMEGA in NONMEM).

    - - -
    docc_full
    -

    A between occasion variability matrix.

    - - -
    sigma_full
    -

    A residual unexplained variability matrix (SIGMA in NONMEM).

    - - -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    xt
    -

    A matrix of sample times. Each row is a vector of sample times for a group.

    - - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    a
    -

    A matrix of covariates. Each row is a group.

    - - -
    groupsize
    -

    A vector of the number of individuals in each group.

    - - -
    deriv.type
    -

    A number indicating the type of derivative to use:

    • 0=Complex difference

    • -
    • 1=Central difference

    • -
    • 20=Analytic derivative (placeholder)

    • -
    • 30=Automatic differentiation (placeholder)

    • -
    - - -
    ...
    -

    Other arguments passed to the function.

    - -
    -
    -

    Value

    - - -

    The FIM.

    -
    - - -
    -

    Examples

    -
    ## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -library(PopED)
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.md.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         N = floor(xt/TAU) + 1
    -#>         y = (DOSE * Favail/V) * (KA/(KA - CL/V)) * (exp(-CL/V * 
    -#>             (xt - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - 
    -#>             exp(-CL/V * TAU)) - exp(-KA * (xt - (N - 1) * TAU)) * 
    -#>             (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU)))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1104c9b70>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -    return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun = ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun = sfg,
    -                                  fError_fun = feps.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  # notfixed_bpop=c(1,1,1,0),
    -                                  notfixed_bpop=c(CL=1,V=1,KA=1,Favail=0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=0.01,
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0,
    -                                  maxxt=120,
    -                                  a=70)
    -
    -
    -## evaluate initial design with the reduced FIM
    -FIM.1 <- evaluate.fim(poped.db) 
    -FIM.1
    -#>             [,1]       [,2]      [,3]         [,4]         [,5]        [,6]
    -#> [1,] 19821.28445 -21.836551 -8.622140 0.000000e+00     0.000000  0.00000000
    -#> [2,]   -21.83655  20.656071 -1.807099 0.000000e+00     0.000000  0.00000000
    -#> [3,]    -8.62214  -1.807099 51.729039 0.000000e+00     0.000000  0.00000000
    -#> [4,]     0.00000   0.000000  0.000000 3.107768e+03    10.728786  0.02613561
    -#> [5,]     0.00000   0.000000  0.000000 1.072879e+01 27307.089308  3.26560786
    -#> [6,]     0.00000   0.000000  0.000000 2.613561e-02     3.265608 41.81083599
    -#> [7,]     0.00000   0.000000  0.000000 5.215403e+02 11214.210707 71.08763902
    -#>              [,7]
    -#> [1,]      0.00000
    -#> [2,]      0.00000
    -#> [3,]      0.00000
    -#> [4,]    521.54030
    -#> [5,]  11214.21071
    -#> [6,]     71.08764
    -#> [7,] 806176.95068
    -det(FIM.1)
    -#> [1] 5.996147e+22
    -det(FIM.1)^(1/7)
    -#> [1] 1794.658
    -get_rse(FIM.1,poped.db)
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   4.738266   2.756206  13.925829  25.627205  30.344316  25.777327  11.170784 
    -
    -## evaluate initial design with the full FIM
    -FIM.0 <- evaluate.fim(poped.db,fim.calc.type=0) 
    -FIM.0
    -#>               [,1]         [,2]        [,3]          [,4]         [,5]
    -#> [1,]  47625.234145  -341.996566   35.504624 -2.073844e+03 -5899.486674
    -#> [2,]   -341.996566    30.887205  -12.589615 -1.686280e+01   -54.629529
    -#> [3,]     35.504624   -12.589615  452.758773 -8.336530e-01   -43.619195
    -#> [4,]  -2073.844369   -16.862802   -0.833653  3.107768e+03    10.728786
    -#> [5,]  -5899.486674   -54.629529  -43.619195  1.072879e+01 27307.089308
    -#> [6,]      4.490538    -6.550313   18.653863  2.613561e-02     3.265608
    -#> [7,] -54419.723543 -1070.933661 2955.924225  5.215403e+02 11214.210707
    -#>             [,6]         [,7]
    -#> [1,]  4.49053810 -54419.72354
    -#> [2,] -6.55031322  -1070.93366
    -#> [3,] 18.65386273   2955.92422
    -#> [4,]  0.02613561    521.54030
    -#> [5,]  3.26560786  11214.21071
    -#> [6,] 41.81083599     71.08764
    -#> [7,] 71.08763902 806176.95068
    -det(FIM.0)
    -#> [1] 1.220371e+24
    -det(FIM.0)^(1/7)
    -#> [1] 2760.117
    -get_rse(FIM.0,poped.db)
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   3.560994   2.560413   4.811952  26.270324  30.901555  26.503936  12.409516 
    -
    -## evaluate initial design with the reduced FIM 
    -## computing all derivatives with respect to the 
    -## standard deviation of the residual unexplained variation 
    -FIM.4 <- evaluate.fim(poped.db,fim.calc.type=4) 
    -FIM.4
    -#>             [,1]       [,2]      [,3]         [,4]         [,5]        [,6]
    -#> [1,] 19821.28445 -21.836551 -8.622140 0.000000e+00     0.000000  0.00000000
    -#> [2,]   -21.83655  20.656071 -1.807099 0.000000e+00     0.000000  0.00000000
    -#> [3,]    -8.62214  -1.807099 51.729039 0.000000e+00     0.000000  0.00000000
    -#> [4,]     0.00000   0.000000  0.000000 3.107768e+03    10.728786  0.02613561
    -#> [5,]     0.00000   0.000000  0.000000 1.072879e+01 27307.089308  3.26560786
    -#> [6,]     0.00000   0.000000  0.000000 2.613561e-02     3.265608 41.81083599
    -#> [7,]     0.00000   0.000000  0.000000 1.043081e+02  2242.842141 14.21752780
    -#>             [,7]
    -#> [1,]     0.00000
    -#> [2,]     0.00000
    -#> [3,]     0.00000
    -#> [4,]   104.30806
    -#> [5,]  2242.84214
    -#> [6,]    14.21753
    -#> [7,] 32247.07803
    -det(FIM.4)
    -#> [1] 2.398459e+21
    -get_rse(FIM.4,poped.db,fim.calc.type=4)
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   4.738266   2.756206  13.925829  25.627205  30.344316  25.777327   5.585392 
    -
    -## evaluate initial design with the full FIM with A,B,C matricies
    -## should give same answer as fim.calc.type=0
    -FIM.5 <- evaluate.fim(poped.db,fim.calc.type=5) 
    -FIM.5
    -#>               [,1]         [,2]        [,3]          [,4]         [,5]
    -#> [1,]  47625.234145  -341.996566   35.504624 -2.073844e+03 -5899.486674
    -#> [2,]   -341.996566    30.887205  -12.589615 -1.686280e+01   -54.629529
    -#> [3,]     35.504624   -12.589615  452.758773 -8.336530e-01   -43.619195
    -#> [4,]  -2073.844369   -16.862802   -0.833653  3.107768e+03    10.728786
    -#> [5,]  -5899.486674   -54.629529  -43.619195  1.072879e+01 27307.089308
    -#> [6,]      4.490538    -6.550313   18.653863  2.613561e-02     3.265608
    -#> [7,] -54419.723543 -1070.933661 2955.924225  5.215403e+02 11214.210707
    -#>             [,6]         [,7]
    -#> [1,]  4.49053810 -54419.72354
    -#> [2,] -6.55031322  -1070.93366
    -#> [3,] 18.65386273   2955.92422
    -#> [4,]  0.02613561    521.54030
    -#> [5,]  3.26560786  11214.21071
    -#> [6,] 41.81083599     71.08764
    -#> [7,] 71.08763902 806176.95068
    -det(FIM.5)
    -#> [1] 1.220371e+24
    -get_rse(FIM.5,poped.db,fim.calc.type=5)
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   3.560994   2.560413   4.811952  26.270324  30.901555  26.503936  12.409516 
    -
    -## evaluate initial design with the reduced FIM with 
    -## A,B,C matricies and derivative of variance
    -## should give same answer as fim.calc.type=1 (default)
    -FIM.7 <- evaluate.fim(poped.db,fim.calc.type=7) 
    -FIM.7
    -#>             [,1]       [,2]      [,3]         [,4]         [,5]        [,6]
    -#> [1,] 19821.28445 -21.836551 -8.622140 0.000000e+00     0.000000  0.00000000
    -#> [2,]   -21.83655  20.656071 -1.807099 0.000000e+00     0.000000  0.00000000
    -#> [3,]    -8.62214  -1.807099 51.729039 0.000000e+00     0.000000  0.00000000
    -#> [4,]     0.00000   0.000000  0.000000 3.107768e+03    10.728786  0.02613561
    -#> [5,]     0.00000   0.000000  0.000000 1.072879e+01 27307.089308  3.26560786
    -#> [6,]     0.00000   0.000000  0.000000 2.613561e-02     3.265608 41.81083599
    -#> [7,]     0.00000   0.000000  0.000000 5.215403e+02 11214.210707 71.08763902
    -#>              [,7]
    -#> [1,]      0.00000
    -#> [2,]      0.00000
    -#> [3,]      0.00000
    -#> [4,]    521.54030
    -#> [5,]  11214.21071
    -#> [6,]     71.08764
    -#> [7,] 806176.95068
    -det(FIM.7)
    -#> [1] 5.996147e+22
    -get_rse(FIM.7,poped.db,fim.calc.type=7)
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   4.738266   2.756206  13.925829  25.627205  30.344316  25.777327  11.170784 
    -
    -## evaluate FIM and rse with prior FIM.1
    -poped.db.prior = create.poped.database(poped.db, prior_fim = FIM.1)
    -FIM.1.prior <- evaluate.fim(poped.db.prior)
    -all.equal(FIM.1.prior,FIM.1) # the FIM is only computed from the design in the poped.db
    -#> [1] TRUE
    -get_rse(FIM.1.prior,poped.db.prior) # the RSE is computed with the prior information
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   3.350460   1.948932   9.847048  18.121170  21.456671  18.227322   7.898937 
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/evaluate_design.html b/docs/reference/evaluate_design.html deleted file mode 100644 index 99a2e660..00000000 --- a/docs/reference/evaluate_design.html +++ /dev/null @@ -1,221 +0,0 @@ - -Evaluate a design — evaluate_design • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This function evaluates the design defined in a poped database.

    -
    - -
    -
    evaluate_design(poped.db, ...)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A poped database

    - - -
    ...
    -

    Extra parameters passed to calc_ofv_and_fim and get_rse

    - -
    -
    -

    Value

    - - -

    A list of elements evaluating the current design.

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin example)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define model, parameters, initial design
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  a=c(DOSE=70))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin example)
    -#####################################
    -
    -evaluate_design(poped.db)
    -#> $ofv
    -#> [1] 52.44799
    -#> 
    -#> $fim
    -#>                   CL          V        KA         d_CL          d_V        d_KA
    -#> CL       19821.28445 -21.836551 -8.622140 0.000000e+00     0.000000  0.00000000
    -#> V          -21.83655  20.656071 -1.807099 0.000000e+00     0.000000  0.00000000
    -#> KA          -8.62214  -1.807099 51.729039 0.000000e+00     0.000000  0.00000000
    -#> d_CL         0.00000   0.000000  0.000000 3.107768e+03    10.728786  0.02613561
    -#> d_V          0.00000   0.000000  0.000000 1.072879e+01 27307.089308  3.26560786
    -#> d_KA         0.00000   0.000000  0.000000 2.613561e-02     3.265608 41.81083599
    -#> sig_prop     0.00000   0.000000  0.000000 5.215403e+02 11214.210707 71.08763902
    -#>              sig_prop
    -#> CL            0.00000
    -#> V             0.00000
    -#> KA            0.00000
    -#> d_CL        521.54030
    -#> d_V       11214.21071
    -#> d_KA         71.08764
    -#> sig_prop 806176.95068
    -#> 
    -#> $rse
    -#>        CL         V        KA      d_CL       d_V      d_KA  sig_prop 
    -#>  4.738266  2.756206 13.925829 25.627205 30.344316 25.777327 11.170784 
    -#> 
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/evaluate_fim_map.html b/docs/reference/evaluate_fim_map.html deleted file mode 100644 index 36149b75..00000000 --- a/docs/reference/evaluate_fim_map.html +++ /dev/null @@ -1,235 +0,0 @@ - -Compute the Bayesian Fisher information matrix — evaluate_fim_map • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Computation of the Bayesian Fisher information matrix for -individual parameters of a population model based on -Maximum A Posteriori (MAP) estimation of the empirical Bayes estimates (EBEs) in a population model

    -
    - -
    -
    evaluate_fim_map(
    -  poped.db,
    -  use_mc = FALSE,
    -  num_sim_ids = 1000,
    -  use_purrr = FALSE,
    -  shrink_mat = F
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database

    - - -
    use_mc
    -

    Should the calculation be based on monte-carlo simulations. If -not then then a first order approximation is used

    - - -
    num_sim_ids
    -

    If use_mc=TRUE, how many individuals should be -simulated to make the computations.

    - - -
    use_purrr
    -

    If use_mc=TRUE then should the method use the package -purrr in calculations? This may speed up computations (potentially).

    - - -
    shrink_mat
    -

    Should the shrinkage matrix be returned. Calculated as the -inverse of the Bayesian Fisher information matrix times the inverse of the -omega matrix (variance matrix of the between-subject variability).

    - -
    -
    -

    Value

    - - -

    The Bayesian Fisher information matrix for each design group

    -
    -
    -

    References

    - -
    1. Combes, F. P., Retout, S., - Frey, N., & Mentre, F. (2013). Prediction of shrinkage of individual - parameters using the Bayesian information matrix in non-linear mixed effect - models with evaluation in pharmacokinetics. Pharmaceutical Research, 30(9), - 2355-67. doi:10.1007/s11095-013-1079-3 -.

    2. -
    3. Hennig, S., Nyberg, J., Fanta, S., Backman, J. - T., Hoppu, K., Hooker, A. C., & Karlsson, M. O. (2012). Application of the - optimal design approach to improve a pretransplant drug dose finding design - for ciclosporin. Journal of Clinical Pharmacology, 52(3), 347-360. - doi:10.1177/0091270010397731 -.

    4. -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin example)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define model, parameters, initial design
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  a=c(DOSE=70))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin example)
    -#####################################
    -
    -shrinkage(poped.db)
    -#> # A tibble: 3 × 5
    -#>     d_CL    d_V   d_KA type       group
    -#>    <dbl>  <dbl>  <dbl> <chr>      <chr>
    -#> 1 0.0244 0.174  0.0301 shrink_var grp_1
    -#> 2 0.0123 0.0910 0.0152 shrink_sd  grp_1
    -#> 3 0.0413 0.0590 0.134  se         grp_1
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/evaluate_power-1.png b/docs/reference/evaluate_power-1.png deleted file mode 100644 index 64b8bb10..00000000 Binary files a/docs/reference/evaluate_power-1.png and /dev/null differ diff --git a/docs/reference/evaluate_power-2.png b/docs/reference/evaluate_power-2.png deleted file mode 100644 index 97a6efe7..00000000 Binary files a/docs/reference/evaluate_power-2.png and /dev/null differ diff --git a/docs/reference/evaluate_power.html b/docs/reference/evaluate_power.html deleted file mode 100644 index 9b07ac2c..00000000 --- a/docs/reference/evaluate_power.html +++ /dev/null @@ -1,362 +0,0 @@ - -Power of a design to estimate a parameter. — evaluate_power • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Evaluate the power of a design to estimate a parameter value different than -some assumed value (often the assumed value is zero). The power is calculated -using the linear Wald test and the the design is defined in a poped database.

    -
    - -
    -
    evaluate_power(
    -  poped.db,
    -  bpop_idx,
    -  h0 = 0,
    -  alpha = 0.05,
    -  power = 0.8,
    -  twoSided = TRUE,
    -  find_min_n = TRUE,
    -  fim = NULL,
    -  out = NULL,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A poped database

    - - -
    bpop_idx
    -

    Index for an unfixed population parameter (bpop) for -which the power should be -evaluated for being different than the null hypothesis (h0).

    - - -
    h0
    -

    The null hypothesized value for the parameter.

    - - -
    alpha
    -

    Type 1 error.

    - - -
    power
    -

    Targeted power.

    - - -
    twoSided
    -

    Is this a two-sided test.

    - - -
    find_min_n
    -

    Should the function compute the minimum n needed (given the -current design) to achieve the desired power?

    - - -
    fim
    -

    Provide the FIM from a previous calculation

    - - -
    out
    -

    provide output from a previous calculation (e.g., -calc_ofv_and_fim, ...)

    - - -
    ...
    -

    Extra parameters passed to calc_ofv_and_fim and -get_rse

    - -
    -
    -

    Value

    - - -

    A list of elements evaluating the current design including the power.

    -
    -
    -

    References

    - -
    1. Retout, S., Comets, E., Samson, A., and Mentre, - F. (2007). Design in nonlinear mixed effects models: Optimization using the - Fedorov-Wynn algorithm and power of the Wald test for binary covariates. - Statistics in Medicine, 26(28), 5162-5179. - doi:10.1002/sim.2910 -.

    2. -
    3. Ueckert, S., Hennig, S., - Nyberg, J., Karlsson, M. O., and Hooker, A. C. (2013). Optimizing disease - progression study designs for drug effect discrimination. Journal of - Pharmacokinetics and Pharmacodynamics, 40(5), 587-596. - doi:10.1007/s10928-013-9331-3 -.

    4. -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    # Folowing the examples presented in Retout, 2007
    -
    -ff <- function(model_switch,xt,parameters,poped.db){
    -  with(as.list(parameters),{
    -    
    -    lambda1 <- lam1a
    -    if(TREAT==2) lambda1 <- lam1b
    -    
    -    y=log10(P1*exp(-lambda1*xt)+P2*exp(-lam2*xt))
    -    
    -    return(list(y=y,poped.db=poped.db))
    -  })
    -}
    -
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(P1=exp(bpop[1]+b[1]),
    -               P2=exp(bpop[2]+b[2]),
    -               lam1a=exp(bpop[3]+b[3]),
    -               lam1b=exp(bpop[3]+bpop[4]+b[3]),
    -               lam2=exp(bpop[5]+b[4]),
    -               TREAT=a[1])
    -  return(parameters) 
    -}
    -  
    -
    -poped.db <- create.poped.database(ff_fun = ff,
    -                                  fg_fun = sfg,
    -                                  fError_fun = feps.add,
    -                                  bpop=c(P1=12, P2=8,
    -                                         lam1=-0.7,beta=0,lam2=-3.0),
    -                                  d=c(P1=0.3, P2=0.3,
    -                                      lam1=0.3,lam2=0.3), 
    -                                  sigma=c(0.065^2),
    -                                  groupsize=100,
    -                                  m=2,
    -                                  xt=c(1, 3, 7, 14, 28, 56),
    -                                  minxt=0,
    -                                  maxxt=100,
    -                                  a=list(c(TREAT=1),c(TREAT=2)))
    -
    -plot_model_prediction(poped.db)
    -
    -evaluate_design(poped.db)
    -#> $ofv
    -#> [1] 74.52441
    -#> 
    -#> $fim
    -#>                    P1         P2       lam1       beta       lam2         d_P1
    -#> P1         611.712173 -12.723468 -24.210864 -12.105432  -5.109809 0.000000e+00
    -#> P2         -12.723468 580.838635 -16.202945  -8.101473 -39.342222 0.000000e+00
    -#> lam1       -24.210864 -16.202945 648.887537 324.443769  -6.742703 0.000000e+00
    -#> beta       -12.105432  -8.101473 324.443769 324.443769  -3.371351 0.000000e+00
    -#> lam2        -5.109809 -39.342222  -6.742703  -3.371351 643.716238 0.000000e+00
    -#> d_P1         0.000000   0.000000   0.000000   0.000000   0.000000 9.354418e+02
    -#> d_P2         0.000000   0.000000   0.000000   0.000000   0.000000 4.051226e-01
    -#> d_lam1       0.000000   0.000000   0.000000   0.000000   0.000000 1.465796e+00
    -#> d_lam2       0.000000   0.000000   0.000000   0.000000   0.000000 6.533665e-02
    -#> SIGMA[1,1]   0.000000   0.000000   0.000000   0.000000   0.000000 5.831126e+03
    -#>                    d_P2       d_lam1       d_lam2   SIGMA[1,1]
    -#> P1            0.0000000    0.0000000 0.000000e+00        0.000
    -#> P2            0.0000000    0.0000000 0.000000e+00        0.000
    -#> lam1          0.0000000    0.0000000 0.000000e+00        0.000
    -#> beta          0.0000000    0.0000000 0.000000e+00        0.000
    -#> lam2          0.0000000    0.0000000 0.000000e+00        0.000
    -#> d_P1          0.4051226    1.4657963 6.533665e-02     5831.126
    -#> d_P2        843.4338997    0.6563403 3.869526e+00     8499.377
    -#> d_lam1        0.6563403 1052.6375905 1.136601e-01     1889.172
    -#> d_lam2        3.8695261    0.1136601 1.035926e+03     2335.057
    -#> SIGMA[1,1] 8499.3770552 1889.1722061 2.335057e+03 11411954.974
    -#> 
    -#> $rse
    -#>          P1          P2        lam1        beta        lam2        d_P1 
    -#>  0.33728477  0.52006496  7.93579642  0.07851367  1.31669814 10.91610610 
    -#>        d_P2      d_lam1      d_lam2  SIGMA[1,1] 
    -#> 11.52111962 10.27552547 10.35895352  7.04673895 
    -#> 
    -
    -poped.db_2 <- create.poped.database(poped.db,bpop=c(P1=12, P2=8,
    -                                      lam1=-0.7,beta=0.262,lam2=-3.0))
    -
    -plot_model_prediction(poped.db_2)
    -
    -evaluate_design(poped.db_2)
    -#> $ofv
    -#> [1] 74.54742
    -#> 
    -#> $fim
    -#>                    P1         P2      lam1       beta       lam2         d_P1
    -#> P1         606.082950 -12.698834 -26.35693 -14.251496  -5.275302 0.000000e+00
    -#> P2         -12.698834 590.575894 -15.71391  -7.612439 -35.363104 0.000000e+00
    -#> lam1       -26.356928 -15.713911 647.69637 323.252599  -6.706090 0.000000e+00
    -#> beta       -14.251496  -7.612439 323.25260 323.252599  -3.334739 0.000000e+00
    -#> lam2        -5.275302 -35.363104  -6.70609  -3.334739 645.343252 0.000000e+00
    -#> d_P1         0.000000   0.000000   0.00000   0.000000   0.000000 9.184102e+02
    -#> d_P2         0.000000   0.000000   0.00000   0.000000   0.000000 4.034200e-01
    -#> d_lam1       0.000000   0.000000   0.00000   0.000000   0.000000 1.748309e+00
    -#> d_lam2       0.000000   0.000000   0.00000   0.000000   0.000000 6.967871e-02
    -#> SIGMA[1,1]   0.000000   0.000000   0.00000   0.000000   0.000000 6.355107e+03
    -#>                    d_P2       d_lam1       d_lam2   SIGMA[1,1]
    -#> P1            0.0000000    0.0000000 0.000000e+00        0.000
    -#> P2            0.0000000    0.0000000 0.000000e+00        0.000
    -#> lam1          0.0000000    0.0000000 0.000000e+00        0.000
    -#> beta          0.0000000    0.0000000 0.000000e+00        0.000
    -#> lam2          0.0000000    0.0000000 0.000000e+00        0.000
    -#> d_P1          0.4034200    1.7483086 6.967871e-02     6355.107
    -#> d_P2        872.1867153    0.6179178 3.165957e+00     7662.897
    -#> d_lam1        0.6179178 1048.7800081 1.124325e-01     2004.872
    -#> d_lam2        3.1659572    0.1124325 1.041176e+03     2204.565
    -#> SIGMA[1,1] 7662.8965806 2004.8718676 2.204565e+03 11396937.363
    -#> 
    -#> $rse
    -#>         P1         P2       lam1       beta       lam2       d_P1       d_P2 
    -#>  0.3388993  0.5155216  7.9357907 29.9948348  1.3144681 11.0205784 11.3204964 
    -#>     d_lam1     d_lam2 SIGMA[1,1] 
    -#> 10.2946079 10.3325269  7.0480558 
    -#> 
    -
    -evaluate_power(poped.db_2,bpop_idx = 4)
    -#> $ofv
    -#> [1] 74.54742
    -#> 
    -#> $fim
    -#>             [,1]       [,2]      [,3]       [,4]       [,5]         [,6]
    -#>  [1,] 606.082950 -12.698834 -26.35693 -14.251496  -5.275302 0.000000e+00
    -#>  [2,] -12.698834 590.575894 -15.71391  -7.612439 -35.363104 0.000000e+00
    -#>  [3,] -26.356928 -15.713911 647.69637 323.252599  -6.706090 0.000000e+00
    -#>  [4,] -14.251496  -7.612439 323.25260 323.252599  -3.334739 0.000000e+00
    -#>  [5,]  -5.275302 -35.363104  -6.70609  -3.334739 645.343252 0.000000e+00
    -#>  [6,]   0.000000   0.000000   0.00000   0.000000   0.000000 9.184102e+02
    -#>  [7,]   0.000000   0.000000   0.00000   0.000000   0.000000 4.034200e-01
    -#>  [8,]   0.000000   0.000000   0.00000   0.000000   0.000000 1.748309e+00
    -#>  [9,]   0.000000   0.000000   0.00000   0.000000   0.000000 6.967871e-02
    -#> [10,]   0.000000   0.000000   0.00000   0.000000   0.000000 6.355107e+03
    -#>               [,7]         [,8]         [,9]        [,10]
    -#>  [1,]    0.0000000    0.0000000 0.000000e+00        0.000
    -#>  [2,]    0.0000000    0.0000000 0.000000e+00        0.000
    -#>  [3,]    0.0000000    0.0000000 0.000000e+00        0.000
    -#>  [4,]    0.0000000    0.0000000 0.000000e+00        0.000
    -#>  [5,]    0.0000000    0.0000000 0.000000e+00        0.000
    -#>  [6,]    0.4034200    1.7483086 6.967871e-02     6355.107
    -#>  [7,]  872.1867153    0.6179178 3.165957e+00     7662.897
    -#>  [8,]    0.6179178 1048.7800081 1.124325e-01     2004.872
    -#>  [9,]    3.1659572    0.1124325 1.041176e+03     2204.565
    -#> [10,] 7662.8965806 2004.8718676 2.204565e+03 11396937.363
    -#> 
    -#> $rse
    -#>         P1         P2       lam1       beta       lam2       d_P1       d_P2 
    -#>  0.3388993  0.5155216  7.9357907 29.9948348  1.3144681 11.0205784 11.3204964 
    -#>     d_lam1     d_lam2 SIGMA[1,1] 
    -#> 10.2946079 10.3325269  7.0480558 
    -#> 
    -#> $power
    -#>      Value      RSE power_pred power_want need_rse min_N_tot
    -#> beta 0.262 29.99483   91.52704         80 35.69408       142
    -#> 
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/extract_norm_group_fim.html b/docs/reference/extract_norm_group_fim.html deleted file mode 100644 index 59f87bec..00000000 --- a/docs/reference/extract_norm_group_fim.html +++ /dev/null @@ -1,125 +0,0 @@ - -Extract a normalized group FIM — extract_norm_group_fim • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Extract an individual FIM for each group in a design

    -
    - -
    -
    extract_norm_group_fim(poped.db, ...)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database

    - - -
    ...
    -

    Arguments passed to evaluate.fim

    - -
    -
    -

    Value

    - - -

    A list of FIMs, one for each group in a design.

    -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/feps.add-1.png b/docs/reference/feps.add-1.png deleted file mode 100644 index 6f2d439c..00000000 Binary files a/docs/reference/feps.add-1.png and /dev/null differ diff --git a/docs/reference/feps.add.html b/docs/reference/feps.add.html deleted file mode 100644 index f943e1be..00000000 --- a/docs/reference/feps.add.html +++ /dev/null @@ -1,238 +0,0 @@ - -RUV model: -Additive . — feps.add • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This is a residual unexplained variability (RUV) model function that encodes the model described above. -The function is suitable for input to the create.poped.database function using the - fError_file argument.

    -
    - -
    -
    feps.add(model_switch, xt, parameters, epsi, poped.db)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    a vector of values, the same size as xt, identifying which model -response should be computed for the -corresponding xt value. Used for multiple response models.

    - - -
    xt
    -

    a vector of independent variable values (often time).

    - - -
    parameters
    -

    A named list of parameter values.

    - - -
    epsi
    -

    A matrix with the same number of rows as the xt vector, columns match the numbers defined in this -function.

    - - -
    poped.db
    -

    a poped database. This can be used to extract information that may be needed in the model file.

    - -
    -
    -

    Value

    - - -

    A list consisting of:

    1. y the values of the model at the specified points.

    2. -
    3. poped.db A (potentially modified) poped database.

    4. -
    - - -
    -

    Examples

    -
    
    -library(PopED)
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.KE
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - KE))) * (exp(-KE * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x113f468e0>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(KE=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.KE,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add,
    -                                  bpop=c(KE=0.15/8, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(KE=0.07, V=0.02, KA=0.6), 
    -                                  sigma=1,
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0,
    -                                  maxxt=120,
    -                                  a=70)
    -
    -##  create plot of model without variability 
    -plot_model_prediction(poped.db)
    -
    -
    -## evaluate initial design
    -FIM <- evaluate.fim(poped.db) 
    -FIM
    -#>             [,1]        [,2]       [,3]        [,4]        [,5]      [,6]
    -#> [1,] 746643.9218 1031.526838 485.621863    0.000000     0.00000  0.000000
    -#> [2,]   1031.5268   16.667994  -3.901736    0.000000     0.00000  0.000000
    -#> [3,]    485.6219   -3.901736  47.787464    0.000000     0.00000  0.000000
    -#> [4,]      0.0000    0.000000   0.000000 1076.594563   374.07924  1.295445
    -#> [5,]      0.0000    0.000000   0.000000  374.079240 17780.60889 15.223541
    -#> [6,]      0.0000    0.000000   0.000000    1.295445    15.22354 35.681901
    -#> [7,]      0.0000    0.000000   0.000000   47.625531   142.44395  2.089439
    -#>            [,7]
    -#> [1,]   0.000000
    -#> [2,]   0.000000
    -#> [3,]   0.000000
    -#> [4,]  47.625531
    -#> [5,] 142.443949
    -#> [6,]   2.089439
    -#> [7,]  86.372695
    -det(FIM)
    -#> [1] 2.960928e+19
    -get_rse(FIM,poped.db)
    -#>         KE          V         KA       d_KE        d_V       d_KA SIGMA[1,1] 
    -#>   6.508287   3.248953  14.728214  44.184490  37.841158  27.924203  10.959023 
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/feps.add.prop-1.png b/docs/reference/feps.add.prop-1.png deleted file mode 100644 index ddf2e54a..00000000 Binary files a/docs/reference/feps.add.prop-1.png and /dev/null differ diff --git a/docs/reference/feps.add.prop-4.png b/docs/reference/feps.add.prop-4.png deleted file mode 100644 index 58e1d229..00000000 Binary files a/docs/reference/feps.add.prop-4.png and /dev/null differ diff --git a/docs/reference/feps.add.prop.html b/docs/reference/feps.add.prop.html deleted file mode 100644 index 5be0ba08..00000000 --- a/docs/reference/feps.add.prop.html +++ /dev/null @@ -1,237 +0,0 @@ - -RUV model: -Additive and Proportional. — feps.add.prop • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This is a residual unexplained variability (RUV) model function that encodes the model described above. -The function is suitable for input to the create.poped.database function using the - fError_file argument.

    -
    - -
    -
    feps.add.prop(model_switch, xt, parameters, epsi, poped.db)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    a vector of values, the same size as xt, identifying which model -response should be computed for the -corresponding xt value. Used for multiple response models.

    - - -
    xt
    -

    a vector of independent variable values (often time).

    - - -
    parameters
    -

    A named list of parameter values.

    - - -
    epsi
    -

    A matrix with the same number of rows as the xt vector, columns match the numbers defined in this -function.

    - - -
    poped.db
    -

    a poped database. This can be used to extract information that may be needed in the model file.

    - -
    -
    -

    Value

    - - -

    A list consisting of:

    1. y the values of the model at the specified points.

    2. -
    3. poped.db A (potentially modified) poped database.

    4. -
    - - -
    -

    Examples

    -
    library(PopED)
    -
    -## find the parameters that are needed to define in the structural model
    -ff.PK.1.comp.oral.md.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         N = floor(xt/TAU) + 1
    -#>         y = (DOSE * Favail/V) * (KA/(KA - CL/V)) * (exp(-CL/V * 
    -#>             (xt - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - 
    -#>             exp(-CL/V * TAU)) - exp(-KA * (xt - (N - 1) * TAU)) * 
    -#>             (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU)))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1104c9b70>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c( V=bpop[1]*exp(b[1]),
    -                KA=bpop[2]*exp(b[2]),
    -                CL=bpop[3]*exp(b[3]),
    -                Favail=bpop[4],
    -                DOSE=a[1],
    -                TAU=a[2])
    -  return( parameters ) 
    -}
    -
    -## -- Define design and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.md.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  groupsize=20,
    -                                  m=2,
    -                                  sigma=c(0.04,5e-6),
    -                                  bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9), 
    -                                  d=c(V=0.09,KA=0.09,CL=0.25^2), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  notfixed_sigma=c(0,0),
    -                                  xt=c( 1,2,8,240,245),
    -                                  minxt=c(0,0,0,240,240),
    -                                  maxxt=c(10,10,10,248,248),
    -                                  a=cbind(c(20,40),c(24,24)),
    -                                  bUseGrouped_xt=1,
    -                                  maxa=c(200,24),
    -                                  mina=c(0,24))
    -
    -##  create plot of model without variability 
    -plot_model_prediction(poped.db)
    -
    -
    -## evaluate initial design
    -FIM <- evaluate.fim(poped.db) 
    -FIM
    -#>             [,1]        [,2]         [,3]       [,4]       [,5]        [,6]
    -#> [1,]  0.05336692   -8.683963  -0.05863412   0.000000   0.000000    0.000000
    -#> [2,] -8.68396266 2999.851007 -14.43058560   0.000000   0.000000    0.000000
    -#> [3,] -0.05863412  -14.430586  37.15243290   0.000000   0.000000    0.000000
    -#> [4,]  0.00000000    0.000000   0.00000000 999.953587 312.240246    3.202847
    -#> [5,]  0.00000000    0.000000   0.00000000 312.240246 439.412556    2.287838
    -#> [6,]  0.00000000    0.000000   0.00000000   3.202847   2.287838 3412.005199
    -det(FIM)
    -#> [1] 3.627987e+12
    -get_rse(FIM,poped.db)
    -#>         V        KA        CL       d_V      d_KA      d_CL 
    -#>  8.215338 10.090955  4.400304 39.833230 60.089601 27.391518 
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/feps.prop-1.png b/docs/reference/feps.prop-1.png deleted file mode 100644 index 00f7fe32..00000000 Binary files a/docs/reference/feps.prop-1.png and /dev/null differ diff --git a/docs/reference/feps.prop-4.png b/docs/reference/feps.prop-4.png deleted file mode 100644 index 57b77e26..00000000 Binary files a/docs/reference/feps.prop-4.png and /dev/null differ diff --git a/docs/reference/feps.prop.html b/docs/reference/feps.prop.html deleted file mode 100644 index 376495e8..00000000 --- a/docs/reference/feps.prop.html +++ /dev/null @@ -1,251 +0,0 @@ - -RUV model: -Proportional. — feps.prop • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This is a residual unexplained variability (RUV) model function that encodes the model described above. -The function is suitable for input to the create.poped.database function using the - fError_file argument.

    -
    - -
    -
    feps.prop(model_switch, xt, parameters, epsi, poped.db)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    a vector of values, the same size as xt, identifying which model -response should be computed for the -corresponding xt value. Used for multiple response models.

    - - -
    xt
    -

    a vector of independent variable values (often time).

    - - -
    parameters
    -

    A named list of parameter values.

    - - -
    epsi
    -

    A matrix with the same number of rows as the xt vector, columns match the numbers defined in this -function.

    - - -
    poped.db
    -

    a poped database. This can be used to extract information that may be needed in the model file.

    - -
    -
    -

    Value

    - - -

    A list consisting of:

    1. y the values of the model at the specified points.

    2. -
    3. poped.db A (potentially modified) poped database.

    4. -
    - - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin example)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define model, parameters, initial design
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  a=c(DOSE=70))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin example)
    -#####################################
    -
    -
    -##  create plot of model without variability 
    -plot_model_prediction(poped.db)
    -
    -
    -## evaluate initial design
    -FIM <- evaluate.fim(poped.db) 
    -FIM
    -#>             [,1]       [,2]      [,3]         [,4]         [,5]        [,6]
    -#> [1,] 19821.28445 -21.836551 -8.622140 0.000000e+00     0.000000  0.00000000
    -#> [2,]   -21.83655  20.656071 -1.807099 0.000000e+00     0.000000  0.00000000
    -#> [3,]    -8.62214  -1.807099 51.729039 0.000000e+00     0.000000  0.00000000
    -#> [4,]     0.00000   0.000000  0.000000 3.107768e+03    10.728786  0.02613561
    -#> [5,]     0.00000   0.000000  0.000000 1.072879e+01 27307.089308  3.26560786
    -#> [6,]     0.00000   0.000000  0.000000 2.613561e-02     3.265608 41.81083599
    -#> [7,]     0.00000   0.000000  0.000000 5.215403e+02 11214.210707 71.08763902
    -#>              [,7]
    -#> [1,]      0.00000
    -#> [2,]      0.00000
    -#> [3,]      0.00000
    -#> [4,]    521.54030
    -#> [5,]  11214.21071
    -#> [6,]     71.08764
    -#> [7,] 806176.95068
    -det(FIM)
    -#> [1] 5.996147e+22
    -get_rse(FIM,poped.db)
    -#>        CL         V        KA      d_CL       d_V      d_KA  sig_prop 
    -#>  4.738266  2.756206 13.925829 25.627205 30.344316 25.777327 11.170784 
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/feval.html b/docs/reference/feval.html deleted file mode 100644 index 13fe9c70..00000000 --- a/docs/reference/feval.html +++ /dev/null @@ -1,148 +0,0 @@ - -MATLAB feval function — feval • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This is just a wrapper for the do.call function to behave like the feval function in MATLAB.

    -
    - -
    -
    feval(file.name, ...)
    -
    - -
    -

    Arguments

    -
    file.name
    -

    A function or a string that is the name of a function.

    - - -
    ...
    -

    Arguments for the function. Multiple arguments separated by a comma.

    - -
    -
    -

    Value

    - - -

    Output from the defined function.

    -
    -
    -

    See also

    -

    Other MATLAB: -cell(), -diag_matlab(), -fileparts(), -isempty(), -ones(), -randn(), -rand(), -size(), -tic(), -toc(), -zeros()

    -
    - -
    -

    Examples

    -
    
    -feval("sin",pi/2)
    -#> [1] 1
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/ff.PK.1.comp.oral.md.CL-1.png b/docs/reference/ff.PK.1.comp.oral.md.CL-1.png deleted file mode 100644 index ddf2e54a..00000000 Binary files a/docs/reference/ff.PK.1.comp.oral.md.CL-1.png and /dev/null differ diff --git a/docs/reference/ff.PK.1.comp.oral.md.CL-4.png b/docs/reference/ff.PK.1.comp.oral.md.CL-4.png deleted file mode 100644 index 58e1d229..00000000 Binary files a/docs/reference/ff.PK.1.comp.oral.md.CL-4.png and /dev/null differ diff --git a/docs/reference/ff.PK.1.comp.oral.md.CL.html b/docs/reference/ff.PK.1.comp.oral.md.CL.html deleted file mode 100644 index 2c281286..00000000 --- a/docs/reference/ff.PK.1.comp.oral.md.CL.html +++ /dev/null @@ -1,234 +0,0 @@ - -Structural model: one-compartment, oral absorption, multiple bolus dose, parameterized using CL. — ff.PK.1.comp.oral.md.CL • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This is a structural model function that encodes a model that is -one-compartment, oral absorption, multiple bolus dose, parameterized using CL. -The function is suitable for input to the create.poped.database function using the - ff_file argument.

    -
    - -
    -
    ff.PK.1.comp.oral.md.CL(model_switch, xt, parameters, poped.db)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    a vector of values, the same size as xt, identifying which model -response should be computed for the -corresponding xt value. Used for multiple response models.

    - - -
    xt
    -

    a vector of independent variable values (often time).

    - - -
    parameters
    -

    A named list of parameter values.

    - - -
    poped.db
    -

    a poped database. This can be used to extract information that may be needed in the model file.

    - -
    -
    -

    Value

    - - -

    A list consisting of:

    1. y the values of the model at the specified points.

    2. -
    3. poped.db A (potentially modified) poped database.

    4. -
    - - -
    -

    Examples

    -
    library(PopED)
    -
    -## find the parameters that are needed to define in the structural model
    -ff.PK.1.comp.oral.md.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         N = floor(xt/TAU) + 1
    -#>         y = (DOSE * Favail/V) * (KA/(KA - CL/V)) * (exp(-CL/V * 
    -#>             (xt - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - 
    -#>             exp(-CL/V * TAU)) - exp(-KA * (xt - (N - 1) * TAU)) * 
    -#>             (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU)))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1104c9b70>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c( V=bpop[1]*exp(b[1]),
    -                KA=bpop[2]*exp(b[2]),
    -                CL=bpop[3]*exp(b[3]),
    -                Favail=bpop[4],
    -                DOSE=a[1],
    -                TAU=a[2])
    -  return( parameters ) 
    -}
    -
    -## -- Define design and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.md.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  groupsize=20,
    -                                  m=2,
    -                                  sigma=c(0.04,5e-6),
    -                                  bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9), 
    -                                  d=c(V=0.09,KA=0.09,CL=0.25^2), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  notfixed_sigma=c(0,0),
    -                                  xt=c( 1,2,8,240,245),
    -                                  minxt=c(0,0,0,240,240),
    -                                  maxxt=c(10,10,10,248,248),
    -                                  a=cbind(c(20,40),c(24,24)),
    -                                  bUseGrouped_xt=1,
    -                                  maxa=c(200,24),
    -                                  mina=c(0,24))
    -
    -##  create plot of model without variability 
    -plot_model_prediction(poped.db)
    -
    -
    -## evaluate initial design
    -FIM <- evaluate.fim(poped.db) 
    -FIM
    -#>             [,1]        [,2]         [,3]       [,4]       [,5]        [,6]
    -#> [1,]  0.05336692   -8.683963  -0.05863412   0.000000   0.000000    0.000000
    -#> [2,] -8.68396266 2999.851007 -14.43058560   0.000000   0.000000    0.000000
    -#> [3,] -0.05863412  -14.430586  37.15243290   0.000000   0.000000    0.000000
    -#> [4,]  0.00000000    0.000000   0.00000000 999.953587 312.240246    3.202847
    -#> [5,]  0.00000000    0.000000   0.00000000 312.240246 439.412556    2.287838
    -#> [6,]  0.00000000    0.000000   0.00000000   3.202847   2.287838 3412.005199
    -det(FIM)
    -#> [1] 3.627987e+12
    -get_rse(FIM,poped.db)
    -#>         V        KA        CL       d_V      d_KA      d_CL 
    -#>  8.215338 10.090955  4.400304 39.833230 60.089601 27.391518 
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/ff.PK.1.comp.oral.md.KE-1.png b/docs/reference/ff.PK.1.comp.oral.md.KE-1.png deleted file mode 100644 index ddf2e54a..00000000 Binary files a/docs/reference/ff.PK.1.comp.oral.md.KE-1.png and /dev/null differ diff --git a/docs/reference/ff.PK.1.comp.oral.md.KE-4.png b/docs/reference/ff.PK.1.comp.oral.md.KE-4.png deleted file mode 100644 index 58e1d229..00000000 Binary files a/docs/reference/ff.PK.1.comp.oral.md.KE-4.png and /dev/null differ diff --git a/docs/reference/ff.PK.1.comp.oral.md.KE.html b/docs/reference/ff.PK.1.comp.oral.md.KE.html deleted file mode 100644 index a9707833..00000000 --- a/docs/reference/ff.PK.1.comp.oral.md.KE.html +++ /dev/null @@ -1,235 +0,0 @@ - -Structural model: one-compartment, oral absorption, multiple bolus dose, parameterized using KE. — ff.PK.1.comp.oral.md.KE • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This is a structural model function that encodes a model that is -one-compartment, oral absorption, multiple bolus dose, parameterized using KE. -The function is suitable for input to the create.poped.database function using the - ff_file argument.

    -
    - -
    -
    ff.PK.1.comp.oral.md.KE(model_switch, xt, parameters, poped.db)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    a vector of values, the same size as xt, identifying which model -response should be computed for the -corresponding xt value. Used for multiple response models.

    - - -
    xt
    -

    a vector of independent variable values (often time).

    - - -
    parameters
    -

    A named list of parameter values.

    - - -
    poped.db
    -

    a poped database. This can be used to extract information that may be needed in the model file.

    - -
    -
    -

    Value

    - - -

    A list consisting of:

    1. y the values of the model at the specified points.

    2. -
    3. poped.db A (potentially modified) poped database.

    4. -
    - - -
    -

    Examples

    -
    library(PopED)
    -
    -## find the parameters that are needed to define in the structural model
    -ff.PK.1.comp.oral.md.KE
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         N = floor(xt/TAU) + 1
    -#>         y = (DOSE * Favail/V) * (KA/(KA - KE)) * (exp(-KE * (xt - 
    -#>             (N - 1) * TAU)) * (1 - exp(-N * KE * TAU))/(1 - exp(-KE * 
    -#>             TAU)) - exp(-KA * (xt - (N - 1) * TAU)) * (1 - exp(-N * 
    -#>             KA * TAU))/(1 - exp(-KA * TAU)))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x133e26ed8>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  ## -- parameter definition function 
    -  parameters=c( V=bpop[1]*exp(b[1]),
    -                KA=bpop[2]*exp(b[2]), 
    -                KE=bpop[3]*exp(b[3]),
    -                Favail=bpop[4],
    -                DOSE=a[1],
    -                TAU=a[2])
    -  return( parameters ) 
    -}
    -
    -## -- Define design and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.md.KE,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  groupsize=20,
    -                                  m=2,
    -                                  sigma=c(0.04,5e-6),
    -                                  bpop=c(V=72.8,KA=0.25,KE=3.75/72.8,Favail=0.9), 
    -                                  d=c(V=0.09,KA=0.09,KE=0.25^2), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  notfixed_sigma=c(0,0),
    -                                  xt=c( 1,2,8,240,245),
    -                                  minxt=c(0,0,0,240,240),
    -                                  maxxt=c(10,10,10,248,248),
    -                                  a=cbind(c(20,40),c(24,24)),
    -                                  bUseGrouped_xt=1,
    -                                  maxa=c(200,40),
    -                                  mina=c(0,2))
    -
    -##  create plot of model without variability 
    -plot_model_prediction(poped.db)
    -
    -
    -## evaluate initial design
    -FIM <- evaluate.fim(poped.db) 
    -FIM
    -#>             [,1]        [,2]         [,3]      [,4]     [,5]      [,6]
    -#> [1,]  0.06138421   -6.369454     34.30738    0.0000   0.0000    0.0000
    -#> [2,] -6.36945403 3667.860710   9887.52379    0.0000   0.0000    0.0000
    -#> [3,] 34.30737724 9887.523789 145132.13111    0.0000   0.0000    0.0000
    -#> [4,]  0.00000000    0.000000      0.00000 1322.9667 167.9800  206.8939
    -#> [5,]  0.00000000    0.000000      0.00000  167.9800 656.8986  202.6588
    -#> [6,]  0.00000000    0.000000      0.00000  206.8939 202.6588 1853.6889
    -det(FIM)
    -#> [1] 1.810534e+16
    -get_rse(FIM,poped.db)
    -#>         V        KA        KE       d_V      d_KA      d_KE 
    -#>  8.215338 10.090955  7.566975 31.220520 44.677836 38.005067 
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/ff.PK.1.comp.oral.sd.CL-1.png b/docs/reference/ff.PK.1.comp.oral.sd.CL-1.png deleted file mode 100644 index 00f7fe32..00000000 Binary files a/docs/reference/ff.PK.1.comp.oral.sd.CL-1.png and /dev/null differ diff --git a/docs/reference/ff.PK.1.comp.oral.sd.CL-4.png b/docs/reference/ff.PK.1.comp.oral.sd.CL-4.png deleted file mode 100644 index 57b77e26..00000000 Binary files a/docs/reference/ff.PK.1.comp.oral.sd.CL-4.png and /dev/null differ diff --git a/docs/reference/ff.PK.1.comp.oral.sd.CL.html b/docs/reference/ff.PK.1.comp.oral.sd.CL.html deleted file mode 100644 index 76aa98bb..00000000 --- a/docs/reference/ff.PK.1.comp.oral.sd.CL.html +++ /dev/null @@ -1,248 +0,0 @@ - -Structural model: one-compartment, oral absorption, single bolus dose, parameterized using CL. — ff.PK.1.comp.oral.sd.CL • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This is a structural model function that encodes a model that is -one-compartment, oral absorption, single bolus dose, parameterized using CL. -The function is suitable for input to the create.poped.database function using the - ff_file argument.

    -
    - -
    -
    ff.PK.1.comp.oral.sd.CL(model_switch, xt, parameters, poped.db)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    a vector of values, the same size as xt, identifying which model -response should be computed for the -corresponding xt value. Used for multiple response models.

    - - -
    xt
    -

    a vector of independent variable values (often time).

    - - -
    parameters
    -

    A named list of parameter values.

    - - -
    poped.db
    -

    a poped database. This can be used to extract information that may be needed in the model file.

    - -
    -
    -

    Value

    - - -

    A list consisting of:

    1. y the values of the model at the specified points.

    2. -
    3. poped.db A (potentially modified) poped database.

    4. -
    - - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin example)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define model, parameters, initial design
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  a=c(DOSE=70))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin example)
    -#####################################
    -
    -
    -##  create plot of model without variability 
    -plot_model_prediction(poped.db)
    -
    -
    -## evaluate initial design
    -FIM <- evaluate.fim(poped.db) 
    -FIM
    -#>             [,1]       [,2]      [,3]         [,4]         [,5]        [,6]
    -#> [1,] 19821.28445 -21.836551 -8.622140 0.000000e+00     0.000000  0.00000000
    -#> [2,]   -21.83655  20.656071 -1.807099 0.000000e+00     0.000000  0.00000000
    -#> [3,]    -8.62214  -1.807099 51.729039 0.000000e+00     0.000000  0.00000000
    -#> [4,]     0.00000   0.000000  0.000000 3.107768e+03    10.728786  0.02613561
    -#> [5,]     0.00000   0.000000  0.000000 1.072879e+01 27307.089308  3.26560786
    -#> [6,]     0.00000   0.000000  0.000000 2.613561e-02     3.265608 41.81083599
    -#> [7,]     0.00000   0.000000  0.000000 5.215403e+02 11214.210707 71.08763902
    -#>              [,7]
    -#> [1,]      0.00000
    -#> [2,]      0.00000
    -#> [3,]      0.00000
    -#> [4,]    521.54030
    -#> [5,]  11214.21071
    -#> [6,]     71.08764
    -#> [7,] 806176.95068
    -det(FIM)
    -#> [1] 5.996147e+22
    -get_rse(FIM,poped.db)
    -#>        CL         V        KA      d_CL       d_V      d_KA  sig_prop 
    -#>  4.738266  2.756206 13.925829 25.627205 30.344316 25.777327 11.170784 
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/ff.PK.1.comp.oral.sd.KE-1.png b/docs/reference/ff.PK.1.comp.oral.sd.KE-1.png deleted file mode 100644 index 6f2d439c..00000000 Binary files a/docs/reference/ff.PK.1.comp.oral.sd.KE-1.png and /dev/null differ diff --git a/docs/reference/ff.PK.1.comp.oral.sd.KE-4.png b/docs/reference/ff.PK.1.comp.oral.sd.KE-4.png deleted file mode 100644 index 57b77e26..00000000 Binary files a/docs/reference/ff.PK.1.comp.oral.sd.KE-4.png and /dev/null differ diff --git a/docs/reference/ff.PK.1.comp.oral.sd.KE.html b/docs/reference/ff.PK.1.comp.oral.sd.KE.html deleted file mode 100644 index 10fd312b..00000000 --- a/docs/reference/ff.PK.1.comp.oral.sd.KE.html +++ /dev/null @@ -1,235 +0,0 @@ - -Structural model: one-compartment, oral absorption, single bolus dose, parameterized using KE. — ff.PK.1.comp.oral.sd.KE • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This is a structural model function that encodes a model that is -one-compartment, oral absorption, single bolus dose, parameterized using KE. -The function is suitable for input to the create.poped.database function using the - ff_file argument.

    -
    - -
    -
    ff.PK.1.comp.oral.sd.KE(model_switch, xt, parameters, poped.db)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    a vector of values, the same size as xt, identifying which model -response should be computed for the -corresponding xt value. Used for multiple response models.

    - - -
    xt
    -

    a vector of independent variable values (often time).

    - - -
    parameters
    -

    A named list of parameter values.

    - - -
    poped.db
    -

    a poped database. This can be used to extract information that may be needed in the model file.

    - -
    -
    -

    Value

    - - -

    A list consisting of:

    1. y the values of the model at the specified points.

    2. -
    3. poped.db A (potentially modified) poped database.

    4. -
    - - -
    -

    Examples

    -
    
    -library(PopED)
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.KE
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - KE))) * (exp(-KE * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x113f468e0>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(KE=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.KE,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.prop,
    -                                  bpop=c(KE=0.15/8, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(KE=0.07, V=0.02, KA=0.6), 
    -                                  sigma=0.01,
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0,
    -                                  maxxt=120,
    -                                  a=70)
    -
    -##  create plot of model without variability 
    -plot_model_prediction(poped.db)
    -
    -
    -## evaluate initial design
    -FIM <- evaluate.fim(poped.db) 
    -FIM
    -#>              [,1]       [,2]       [,3]         [,4]         [,5]       [,6]
    -#> [1,] 1248651.3457 339.370439 144.758375    0.0000000     0.000000  0.0000000
    -#> [2,]     339.3704  20.724252  -1.777254    0.0000000     0.000000  0.0000000
    -#> [3,]     144.7584  -1.777254  51.742071    0.0000000     0.000000  0.0000000
    -#> [4,]       0.0000   0.000000   0.000000 3010.9773834    40.490260  0.1151092
    -#> [5,]       0.0000   0.000000   0.000000   40.4902598 27487.656006  3.1586320
    -#> [6,]       0.0000   0.000000   0.000000    0.1151092     3.158632 41.8319046
    -#> [7,]       0.0000   0.000000   0.000000  784.2206814 10869.344969 70.0662365
    -#>              [,7]
    -#> [1,]      0.00000
    -#> [2,]      0.00000
    -#> [3,]      0.00000
    -#> [4,]    784.22068
    -#> [5,]  10869.34497
    -#> [6,]     70.06624
    -#> [7,] 807063.71904
    -det(FIM)
    -#> [1] 3.690649e+24
    -get_rse(FIM,poped.db)
    -#>         KE          V         KA       d_KE        d_V       d_KA SIGMA[1,1] 
    -#>   4.784638   2.756206  13.925829  26.037875  30.238758  25.770773  11.163214 
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax-1.png b/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax-1.png deleted file mode 100644 index 6e06daa9..00000000 Binary files a/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax-1.png and /dev/null differ diff --git a/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax-6.png b/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax-6.png deleted file mode 100644 index dc7dd432..00000000 Binary files a/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax-6.png and /dev/null differ diff --git a/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax-8.png b/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax-8.png deleted file mode 100644 index 3b44e447..00000000 Binary files a/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax-8.png and /dev/null differ diff --git a/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax.html b/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax.html deleted file mode 100644 index 04cb6a55..00000000 --- a/docs/reference/ff.PKPD.1.comp.oral.md.CL.imax.html +++ /dev/null @@ -1,299 +0,0 @@ - -Structural model: one-compartment, oral absorption, multiple bolus dose, -parameterized using CL driving an inhibitory IMAX model with a direct effect. — ff.PKPD.1.comp.oral.md.CL.imax • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This is a structural model function that encodes the model described above. -The function is suitable for input to the create.poped.database function using the - ff_file argument.

    -
    - -
    -
    ff.PKPD.1.comp.oral.md.CL.imax(model_switch, xt, parameters, poped.db)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    a vector of values, the same size as xt, identifying which model -response should be computed for the -corresponding xt value. Used for multiple response models.

    - - -
    xt
    -

    a vector of independent variable values (often time).

    - - -
    parameters
    -

    A named list of parameter values.

    - - -
    poped.db
    -

    a poped database. This can be used to extract information that may be needed in the model file.

    - -
    -
    -

    Value

    - - -

    A list consisting of:

    1. y the values of the model at the specified points.

    2. -
    3. poped.db A (potentially modified) poped database.

    4. -
    - - -
    -

    Examples

    -
    
    -library(PopED)
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PKPD.1.comp.oral.md.CL.imax
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         MS <- model_switch
    -#>         returnArgs = ff.PK.1.comp.oral.md.CL(model_switch, xt, 
    -#>             parameters, poped.db)
    -#>         CONC = returnArgs$y
    -#>         EFF = E0 * (1 - CONC * IMAX/(IC50 + CONC))
    -#>         y[MS == 1] = CONC[MS == 1]
    -#>         y[MS == 2] = EFF[MS == 2]
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x110514c58>
    -#> <environment: namespace:PopED>
    -ff.PK.1.comp.oral.md.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         N = floor(xt/TAU) + 1
    -#>         y = (DOSE * Favail/V) * (KA/(KA - CL/V)) * (exp(-CL/V * 
    -#>             (xt - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - 
    -#>             exp(-CL/V * TAU)) - exp(-KA * (xt - (N - 1) * TAU)) * 
    -#>             (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU)))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1104c9b70>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  ## -- parameter definition function 
    -  parameters=c( V=bpop[1]*exp(b[1]),
    -                KA=bpop[2]*exp(b[2]),
    -                CL=bpop[3]*exp(b[3]),
    -                Favail=bpop[4],
    -                DOSE=a[1],
    -                TAU = a[2],
    -                E0=bpop[5]*exp(b[4]),
    -                IMAX=bpop[6],
    -                IC50=bpop[7])
    -  return( parameters ) 
    -}
    -
    -
    -
    -feps <- function(model_switch,xt,parameters,epsi,poped.db){
    -  ## -- Residual Error function
    -  returnArgs <- do.call(poped.db$model$ff_pointer,list(model_switch,xt,parameters,poped.db)) 
    -  y <- returnArgs[[1]]
    -  poped.db <- returnArgs[[2]]
    -  
    -  MS <- model_switch
    -  
    -  pk.dv <- y*(1+epsi[,1])+epsi[,2]
    -  pd.dv <-  y*(1+epsi[,3])+epsi[,4]
    -  
    -  y[MS==1] = pk.dv[MS==1]
    -  y[MS==2] = pd.dv[MS==2]
    -  
    -  return(list( y= y,poped.db =poped.db )) 
    -}
    -
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PKPD.1.comp.oral.md.CL.imax,
    -                                  fError_fun=feps,
    -                                  fg_fun=sfg,
    -                                  groupsize=20,
    -                                  m=3,
    -                                  bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9,
    -                                         E0=1120,IMAX=0.807,IC50=0.0993),  
    -                                  notfixed_bpop=c(1,1,1,0,1,1,1),
    -                                  d=c(V=0.09,KA=0.09,CL=0.25^2,E0=0.09), 
    -                                  sigma=c(0.04,5e-6,0.09,100),
    -                                  notfixed_sigma=c(0,0,0,0),
    -                                  xt=c( 1,2,8,240,240,1,2,8,240,240),
    -                                  minxt=c(0,0,0,240,240,0,0,0,240,240),
    -                                  maxxt=c(10,10,10,248,248,10,10,10,248,248),
    -                                  G_xt=c(1,2,3,4,5,1,2,3,4,5),
    -                                  model_switch=c(1,1,1,1,1,2,2,2,2,2),
    -                                  a=cbind(c(20,40,0),c(24,24,24)),
    -                                  bUseGrouped_xt=1,
    -                                  ourzero=0,
    -                                  maxa=c(200,40),
    -                                  mina=c(0,2))
    -
    -
    -##  create plot of model without variability 
    -plot_model_prediction(poped.db,facet_scales="free")
    -
    -
    -## evaluate initial design
    -FIM <- evaluate.fim(poped.db) 
    -FIM
    -#>                [,1]          [,2]          [,3]          [,4]          [,5]
    -#>  [1,]  5.382083e-02   -8.55463620  -0.115087642  8.293963e-05    -0.2103527
    -#>  [2,] -8.554636e+00 3038.24916173 -14.769854387 -1.351406e-02   -69.0609684
    -#>  [3,] -1.150876e-01  -14.76985439  39.394916550  3.372827e-03    -7.0857453
    -#>  [4,]  8.293963e-05   -0.01351406   0.003372827  4.403253e-04    -0.4017382
    -#>  [5,] -2.103527e-01  -69.06096842  -7.085745293 -4.017382e-01   821.9499022
    -#>  [6,]  3.704090e-01    5.89767799  16.302391418  1.181080e+00 -1818.6277909
    -#>  [7,]  0.000000e+00    0.00000000   0.000000000  0.000000e+00     0.0000000
    -#>  [8,]  0.000000e+00    0.00000000   0.000000000  0.000000e+00     0.0000000
    -#>  [9,]  0.000000e+00    0.00000000   0.000000000  0.000000e+00     0.0000000
    -#> [10,]  0.000000e+00    0.00000000   0.000000000  0.000000e+00     0.0000000
    -#>               [,6]         [,7]       [,8]        [,9]        [,10]
    -#>  [1,]     0.370409    0.0000000   0.000000    0.000000    0.0000000
    -#>  [2,]     5.897678    0.0000000   0.000000    0.000000    0.0000000
    -#>  [3,]    16.302391    0.0000000   0.000000    0.000000    0.0000000
    -#>  [4,]     1.181080    0.0000000   0.000000    0.000000    0.0000000
    -#>  [5,] -1818.627791    0.0000000   0.000000    0.000000    0.0000000
    -#>  [6,]  5030.928571    0.0000000   0.000000    0.000000    0.0000000
    -#>  [7,]     0.000000 1017.0362159 303.009671   12.339375    0.5721641
    -#>  [8,]     0.000000  303.0096709 450.738936    2.396824    0.1852950
    -#>  [9,]     0.000000   12.3393753   2.396824 3836.326713    2.5117794
    -#> [10,]     0.000000    0.5721641   0.185295    2.511779 2542.4091838
    -det(FIM)
    -#> [1] 1.593643e+18
    -get_rse(FIM,poped.db)
    -#>         V        KA        CL        E0      IMAX      IC50       d_V      d_KA 
    -#>  8.119842  9.968612  4.304635  7.076883  9.895340 39.478269 38.960998 58.523188 
    -#>      d_CL      d_E0 
    -#> 25.832775 22.036110 
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/ff.PKPD.1.comp.sd.CL.emax-1.png b/docs/reference/ff.PKPD.1.comp.sd.CL.emax-1.png deleted file mode 100644 index 9a9bed21..00000000 Binary files a/docs/reference/ff.PKPD.1.comp.sd.CL.emax-1.png and /dev/null differ diff --git a/docs/reference/ff.PKPD.1.comp.sd.CL.emax-4.png b/docs/reference/ff.PKPD.1.comp.sd.CL.emax-4.png deleted file mode 100644 index 3ea33e85..00000000 Binary files a/docs/reference/ff.PKPD.1.comp.sd.CL.emax-4.png and /dev/null differ diff --git a/docs/reference/ff.PKPD.1.comp.sd.CL.emax-6.png b/docs/reference/ff.PKPD.1.comp.sd.CL.emax-6.png deleted file mode 100644 index 3b44e447..00000000 Binary files a/docs/reference/ff.PKPD.1.comp.sd.CL.emax-6.png and /dev/null differ diff --git a/docs/reference/ff.PKPD.1.comp.sd.CL.emax.html b/docs/reference/ff.PKPD.1.comp.sd.CL.emax.html deleted file mode 100644 index 5af05372..00000000 --- a/docs/reference/ff.PKPD.1.comp.sd.CL.emax.html +++ /dev/null @@ -1,288 +0,0 @@ - -Structural model: one-compartment, single bolus IV dose, parameterized using CL driving an EMAX model with a direct effect. — ff.PKPD.1.comp.sd.CL.emax • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This is a structural model function that encodes the model described above. -The function is suitable for input to the create.poped.database function using the - ff_file argument.

    -
    - -
    -
    ff.PKPD.1.comp.sd.CL.emax(model_switch, xt, parameters, poped.db)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    a vector of values, the same size as xt, identifying which model -response should be computed for the -corresponding xt value. Used for multiple response models.

    - - -
    xt
    -

    a vector of independent variable values (often time).

    - - -
    parameters
    -

    A named list of parameter values.

    - - -
    poped.db
    -

    a poped database. This can be used to extract information that may be needed in the model file.

    - -
    -
    -

    Value

    - - -

    A list consisting of:

    1. y the values of the model at the specified points.

    2. -
    3. poped.db A (potentially modified) poped database.

    4. -
    - - -
    -

    Examples

    -
    
    -library(PopED)
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PKPD.1.comp.sd.CL.emax
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         MS <- model_switch
    -#>         CONC = DOSE/V * exp(-CL/V * xt)
    -#>         EFF = E0 + CONC * EMAX/(EC50 + CONC)
    -#>         y[MS == 1] = CONC[MS == 1]
    -#>         y[MS == 2] = EFF[MS == 2]
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x115efa528>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  ## -- parameter definition function
    -  parameters=c( 
    -    CL=bpop[1]*exp(b[1])  ,
    -    V=bpop[2]*exp(b[2])  ,
    -    E0=bpop[3]*exp(b[3])  ,
    -    EMAX=bpop[4]*exp(b[4])  ,
    -    EC50=bpop[5]*exp(b[5])  ,
    -    DOSE=a[1]
    -  )
    -  return( parameters ) 
    -}
    -
    -feps <- function(model_switch,xt,parameters,epsi,poped.db){
    -  ## -- Residual Error function
    -  ## -- Proportional PK + additive PD
    -  returnArgs <- do.call(poped.db$model$ff_pointer,list(model_switch,xt,parameters,poped.db)) 
    -  y <- returnArgs[[1]]
    -  poped.db <- returnArgs[[2]]
    -  
    -  MS <- model_switch
    -  
    -  prop.err <- y*(1+epsi[,1])
    -  add.err <- y+epsi[,2]
    -  
    -  y[MS==1] = prop.err[MS==1]
    -  y[MS==2] = add.err[MS==2]
    -  
    -  return(list( y= y,poped.db =poped.db )) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PKPD.1.comp.sd.CL.emax,
    -                                  fError_fun=feps,
    -                                  fg_fun=sfg,
    -                                  groupsize=20,
    -                                  m=3,
    -                                  sigma=diag(c(0.15,0.15)),
    -                                  bpop=c(CL=0.5,V=0.2,E0=1,EMAX=1,EC50=1),  
    -                                  d=c(CL=0.01,V=0.01,E0=0.01,EMAX=0.01,EC50=0.01), 
    -                                  xt=c( 0.33,0.66,0.9,5,0.1,1,2,5),
    -                                  model_switch=c( 1,1,1,1,2,2,2,2),
    -                                  minxt=0,
    -                                  maxxt=5,
    -                                  a=rbind(2.75,5,10),
    -                                  bUseGrouped_xt=1,
    -                                  maxa=10,
    -                                  mina=0.1)
    -
    -
    -##  create plot of model without variability 
    -plot_model_prediction(poped.db,facet_scales="free")
    -
    -
    -## evaluate initial design
    -FIM <- evaluate.fim(poped.db) 
    -FIM
    -#>               [,1]         [,2]      [,3]       [,4]       [,5]         [,6]
    -#>  [1,]  13423.83149 -26148.43438 -104.9746  -55.87794   20.58619 0.000000e+00
    -#>  [2,] -26148.43438  70314.08833 -137.2793 -103.59890   26.32348 0.000000e+00
    -#>  [3,]   -104.97460   -137.27932 1209.7986  516.06655 -116.00915 0.000000e+00
    -#>  [4,]    -55.87794   -103.59890  516.0666  449.35861  -62.47406 0.000000e+00
    -#>  [5,]     20.58619     26.32348 -116.0092  -62.47406   22.73598 0.000000e+00
    -#>  [6,]      0.00000      0.00000    0.0000    0.00000    0.00000 9.385378e+04
    -#>  [7,]      0.00000      0.00000    0.0000    0.00000    0.00000 5.697839e+04
    -#>  [8,]      0.00000      0.00000    0.0000    0.00000    0.00000 2.298710e+01
    -#>  [9,]      0.00000      0.00000    0.0000    0.00000    0.00000 6.524561e+00
    -#> [10,]      0.00000      0.00000    0.0000    0.00000    0.00000 8.880407e-01
    -#> [11,]      0.00000      0.00000    0.0000    0.00000    0.00000 1.115568e+03
    -#> [12,]      0.00000      0.00000    0.0000    0.00000    0.00000 1.345372e+01
    -#>               [,7]         [,8]         [,9]       [,10]        [,11]
    -#>  [1,] 0.000000e+00     0.000000    0.0000000   0.0000000    0.0000000
    -#>  [2,] 0.000000e+00     0.000000    0.0000000   0.0000000    0.0000000
    -#>  [3,] 0.000000e+00     0.000000    0.0000000   0.0000000    0.0000000
    -#>  [4,] 0.000000e+00     0.000000    0.0000000   0.0000000    0.0000000
    -#>  [5,] 0.000000e+00     0.000000    0.0000000   0.0000000    0.0000000
    -#>  [6,] 5.697839e+04    22.987097    6.5245606   0.8880407 1115.5680152
    -#>  [7,] 6.592095e+04     6.586597    3.6779636   0.2558559 1176.6041001
    -#>  [8,] 6.586597e+00 12197.738218 2243.7358555 112.3394149    4.8902658
    -#>  [9,] 3.677964e+00  2243.735855 1714.4795989  32.6395909    0.5891989
    -#> [10,] 2.558559e-01   112.339415   32.6395909   4.3373414    0.1964359
    -#> [11,] 1.176604e+03     4.890266    0.5891989   0.1964359 3811.1481605
    -#> [12,] 4.616968e+00  3055.546022 1230.5356715  65.5594938    3.8335502
    -#>             [,12]
    -#>  [1,]    0.000000
    -#>  [2,]    0.000000
    -#>  [3,]    0.000000
    -#>  [4,]    0.000000
    -#>  [5,]    0.000000
    -#>  [6,]   13.453723
    -#>  [7,]    4.616968
    -#>  [8,] 3055.546022
    -#>  [9,] 1230.535671
    -#> [10,]   65.559494
    -#> [11,]    3.833550
    -#> [12,] 4658.810828
    -det(FIM)
    -#> [1] 1.421054e+39
    -get_rse(FIM,poped.db)
    -#>          CL           V          E0        EMAX        EC50        d_CL 
    -#>    3.306524    3.610227    4.575451    6.825531   30.397923   47.350220 
    -#>         d_V        d_E0      d_EMAX      d_EC50  SIGMA[1,1]  SIGMA[2,2] 
    -#>   56.556024  113.036005  291.542904 5854.936456   10.829134   11.705173 
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/figures/logo.png b/docs/reference/figures/logo.png deleted file mode 100644 index d0133857..00000000 Binary files a/docs/reference/figures/logo.png and /dev/null differ diff --git a/docs/reference/fileparts.html b/docs/reference/fileparts.html deleted file mode 100644 index 086c0bd5..00000000 --- a/docs/reference/fileparts.html +++ /dev/null @@ -1,165 +0,0 @@ - -MATLAB fileparts function — fileparts • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Get the various parts of a file with path string.

    -
    - -
    -
    fileparts(filename.with.path)
    -
    - -
    -

    Arguments

    -
    filename.with.path
    -

    A string of a filename with a path

    - -
    -
    -

    Value

    - - -

    A list with the following components:

    -
    pathname
    -

    The path name

    - -
    filename
    -

    The file name

    - -
    fileext
    -

    The file extension

    - -
    -
    -

    Note

    -

    This is a modified version of the same function in the matlab R-package.

    -
    -
    -

    See also

    -

    Other MATLAB: -cell(), -diag_matlab(), -feval(), -isempty(), -ones(), -randn(), -rand(), -size(), -tic(), -toc(), -zeros()

    -
    - -
    -

    Examples

    -
    
    -fileparts("ggg/ttt/lll.R")
    -#> $pathname
    -#> [1] "ggg/ttt"
    -#> 
    -#> $filename
    -#> [1] "lll"
    -#> 
    -#> $fileext
    -#> [1] ".R"
    -#> 
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/getTruncatedNormal.html b/docs/reference/getTruncatedNormal.html deleted file mode 100644 index 5a1064a0..00000000 --- a/docs/reference/getTruncatedNormal.html +++ /dev/null @@ -1,135 +0,0 @@ - -Generate a random sample from a truncated normal distribution. — getTruncatedNormal • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Generate a random sample from a truncated normal distribution.

    -
    - -
    -
    getTruncatedNormal(mean, variance)
    -
    - -
    -

    Arguments

    -
    mean
    -

    the mean of the normal distribution

    - - -
    variance
    -

    The variance of the normal distribution

    - -
    -
    -

    Value

    - - -

    A random sample from the specified truncated normal distribution

    -
    - -
    -

    Examples

    -
    
    -getTruncatedNormal(mean=3,variance=100)
    -#>          [,1]
    -#> [1,] 5.223929
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/get_all_params.html b/docs/reference/get_all_params.html deleted file mode 100644 index 1b1335cb..00000000 --- a/docs/reference/get_all_params.html +++ /dev/null @@ -1,252 +0,0 @@ - -Extract all model parameters from the PopED database. — get_all_params • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Extract all model parameters from the PopED database.

    -
    - -
    -
    get_all_params(poped.db)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - -
    -
    -

    Value

    - - -

    A list containing:

    -
    bpop
    -

    A vector of fixed effect parameter values.

    - -
    d
    -

    A vector of between subject variability parameters

    - -
    covd
    -

    A vector of the covariances of the between subject variability parameters. Row major format of the lower triangular portion of the D (OMEGA) matrix

    - -
    docc
    -

    A vector of the between occasion variability (BOV) terms in the model

    - -
    covdocc
    -

    A vector of the covariances between the BOV terms. Row major of the lower triangular portion of the BOV matrix.

    - -
    sigma
    -

    A vector of the residual unexplained variances (RUV)

    - -
    covsigma
    -

    A vector of the covariances between the RUV terms

    - -
    all
    -

    A vector with all of the above, in the order of this list.

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin example)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define model, parameters, initial design
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  a=c(DOSE=70))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin example)
    -#####################################
    -
    -
    -get_all_params(poped.db)
    -#> $bpop
    -#>        [,1]
    -#> CL     0.15
    -#> V      8.00
    -#> KA     1.00
    -#> Favail 1.00
    -#> 
    -#> $d
    -#>    [,1]
    -#> CL 0.07
    -#> V  0.02
    -#> KA 0.60
    -#> 
    -#> $covd
    -#>      [,1] [,2] [,3]
    -#> [1,]    0    0    0
    -#> 
    -#> $docc
    -#>      [,1]
    -#> 
    -#> $covdocc
    -#>     
    -#> [1,]
    -#> 
    -#> $sigma
    -#> [1] 0.01
    -#> 
    -#> $covsigma
    -#>     
    -#> [1,]
    -#> 
    -#> $all
    -#>       [,1]
    -#>  [1,] 0.15
    -#>  [2,] 8.00
    -#>  [3,] 1.00
    -#>  [4,] 1.00
    -#>  [5,] 0.07
    -#>  [6,] 0.02
    -#>  [7,] 0.60
    -#>  [8,] 0.00
    -#>  [9,] 0.00
    -#> [10,] 0.00
    -#> [11,] 0.01
    -#> 
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/get_rse.html b/docs/reference/get_rse.html deleted file mode 100644 index 629b9632..00000000 --- a/docs/reference/get_rse.html +++ /dev/null @@ -1,390 +0,0 @@ - -Compute the expected parameter relative standard errors — get_rse • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This function computes the expected relative standard errors of a model given a design and a previously computed -FIM.

    -
    - -
    -
    get_rse(
    -  fim,
    -  poped.db,
    -  bpop = poped.db$parameters$bpop[, 2],
    -  d = poped.db$parameters$d[, 2],
    -  docc = poped.db$parameters$docc,
    -  sigma = poped.db$parameters$sigma,
    -  use_percent = TRUE,
    -  fim.calc.type = poped.db$settings$iFIMCalculationType,
    -  prior_fim = poped.db$settings$prior_fim,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    fim
    -

    A Fisher Information Matrix (FIM).

    - - -
    poped.db
    -

    A PopED database.

    - - -
    bpop
    -

    A vector containing the values of the fixed effects used to compute the fim.

    - - -
    d
    -

    A vector containing the values of the diagonals of the between subject variability matrix.

    - - -
    docc
    -

    Matrix defining the IOV, the IOV variances and the IOV distribution as for d and bpop.

    - - -
    sigma
    -

    Matrix defining the variances can covariances of the residual variability terms of the model. -can also just supply the diagonal parameter values (variances) as a c().

    - - -
    use_percent
    -

    Should RSE be reported as percent?

    - - -
    fim.calc.type
    -

    The method used for calculating the FIM. Potential values:

    • 0 = Full FIM. No assumption that fixed and random effects are uncorrelated.

    • -
    • 1 = Reduced FIM. Assume that there is no correlation in the FIM between the fixed and random effects, and set these elements in -the FIM to zero.

    • -
    • 2 = weighted models (placeholder).

    • -
    • 3 = Not currently used.

    • -
    • 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). -This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the residual unexplained variation by default).

    • -
    • 5 = Full FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    • 6 = Calculate one model switch at a time, good for large matrices.

    • -
    • 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    - - -
    prior_fim
    -

    A prior FIM to be added to the fim. Should be the same size as the fim.

    - - -
    ...
    -

    Additional arguments passed to inv.

    - -
    -
    -

    Value

    - - -

    A named list of RSE values. If the estimated parameter is assumed to be zero then for that - parameter the standard error is returned.

    -
    - - -
    -

    Examples

    -
    ## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -library(PopED)
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.md.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         N = floor(xt/TAU) + 1
    -#>         y = (DOSE * Favail/V) * (KA/(KA - CL/V)) * (exp(-CL/V * 
    -#>             (xt - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - 
    -#>             exp(-CL/V * TAU)) - exp(-KA * (xt - (N - 1) * TAU)) * 
    -#>             (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU)))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1104c9b70>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -    return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun = ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun = sfg,
    -                                  fError_fun = feps.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  # notfixed_bpop=c(1,1,1,0),
    -                                  notfixed_bpop=c(CL=1,V=1,KA=1,Favail=0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=0.01,
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0,
    -                                  maxxt=120,
    -                                  a=70)
    -
    -
    -## evaluate initial design with the reduced FIM
    -FIM.1 <- evaluate.fim(poped.db) 
    -FIM.1
    -#>             [,1]       [,2]      [,3]         [,4]         [,5]        [,6]
    -#> [1,] 19821.28445 -21.836551 -8.622140 0.000000e+00     0.000000  0.00000000
    -#> [2,]   -21.83655  20.656071 -1.807099 0.000000e+00     0.000000  0.00000000
    -#> [3,]    -8.62214  -1.807099 51.729039 0.000000e+00     0.000000  0.00000000
    -#> [4,]     0.00000   0.000000  0.000000 3.107768e+03    10.728786  0.02613561
    -#> [5,]     0.00000   0.000000  0.000000 1.072879e+01 27307.089308  3.26560786
    -#> [6,]     0.00000   0.000000  0.000000 2.613561e-02     3.265608 41.81083599
    -#> [7,]     0.00000   0.000000  0.000000 5.215403e+02 11214.210707 71.08763902
    -#>              [,7]
    -#> [1,]      0.00000
    -#> [2,]      0.00000
    -#> [3,]      0.00000
    -#> [4,]    521.54030
    -#> [5,]  11214.21071
    -#> [6,]     71.08764
    -#> [7,] 806176.95068
    -det(FIM.1)
    -#> [1] 5.996147e+22
    -det(FIM.1)^(1/7)
    -#> [1] 1794.658
    -get_rse(FIM.1,poped.db)
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   4.738266   2.756206  13.925829  25.627205  30.344316  25.777327  11.170784 
    -
    -## evaluate initial design with the full FIM
    -FIM.0 <- evaluate.fim(poped.db,fim.calc.type=0) 
    -FIM.0
    -#>               [,1]         [,2]        [,3]          [,4]         [,5]
    -#> [1,]  47625.234145  -341.996566   35.504624 -2.073844e+03 -5899.486674
    -#> [2,]   -341.996566    30.887205  -12.589615 -1.686280e+01   -54.629529
    -#> [3,]     35.504624   -12.589615  452.758773 -8.336530e-01   -43.619195
    -#> [4,]  -2073.844369   -16.862802   -0.833653  3.107768e+03    10.728786
    -#> [5,]  -5899.486674   -54.629529  -43.619195  1.072879e+01 27307.089308
    -#> [6,]      4.490538    -6.550313   18.653863  2.613561e-02     3.265608
    -#> [7,] -54419.723543 -1070.933661 2955.924225  5.215403e+02 11214.210707
    -#>             [,6]         [,7]
    -#> [1,]  4.49053810 -54419.72354
    -#> [2,] -6.55031322  -1070.93366
    -#> [3,] 18.65386273   2955.92422
    -#> [4,]  0.02613561    521.54030
    -#> [5,]  3.26560786  11214.21071
    -#> [6,] 41.81083599     71.08764
    -#> [7,] 71.08763902 806176.95068
    -det(FIM.0)
    -#> [1] 1.220371e+24
    -det(FIM.0)^(1/7)
    -#> [1] 2760.117
    -get_rse(FIM.0,poped.db)
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   3.560994   2.560413   4.811952  26.270324  30.901555  26.503936  12.409516 
    -
    -## evaluate initial design with the reduced FIM 
    -## computing all derivatives with respect to the 
    -## standard deviation of the residual unexplained variation 
    -FIM.4 <- evaluate.fim(poped.db,fim.calc.type=4) 
    -FIM.4
    -#>             [,1]       [,2]      [,3]         [,4]         [,5]        [,6]
    -#> [1,] 19821.28445 -21.836551 -8.622140 0.000000e+00     0.000000  0.00000000
    -#> [2,]   -21.83655  20.656071 -1.807099 0.000000e+00     0.000000  0.00000000
    -#> [3,]    -8.62214  -1.807099 51.729039 0.000000e+00     0.000000  0.00000000
    -#> [4,]     0.00000   0.000000  0.000000 3.107768e+03    10.728786  0.02613561
    -#> [5,]     0.00000   0.000000  0.000000 1.072879e+01 27307.089308  3.26560786
    -#> [6,]     0.00000   0.000000  0.000000 2.613561e-02     3.265608 41.81083599
    -#> [7,]     0.00000   0.000000  0.000000 1.043081e+02  2242.842141 14.21752780
    -#>             [,7]
    -#> [1,]     0.00000
    -#> [2,]     0.00000
    -#> [3,]     0.00000
    -#> [4,]   104.30806
    -#> [5,]  2242.84214
    -#> [6,]    14.21753
    -#> [7,] 32247.07803
    -det(FIM.4)
    -#> [1] 2.398459e+21
    -get_rse(FIM.4,poped.db,fim.calc.type=4)
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   4.738266   2.756206  13.925829  25.627205  30.344316  25.777327   5.585392 
    -
    -## evaluate initial design with the full FIM with A,B,C matricies
    -## should give same answer as fim.calc.type=0
    -FIM.5 <- evaluate.fim(poped.db,fim.calc.type=5) 
    -FIM.5
    -#>               [,1]         [,2]        [,3]          [,4]         [,5]
    -#> [1,]  47625.234145  -341.996566   35.504624 -2.073844e+03 -5899.486674
    -#> [2,]   -341.996566    30.887205  -12.589615 -1.686280e+01   -54.629529
    -#> [3,]     35.504624   -12.589615  452.758773 -8.336530e-01   -43.619195
    -#> [4,]  -2073.844369   -16.862802   -0.833653  3.107768e+03    10.728786
    -#> [5,]  -5899.486674   -54.629529  -43.619195  1.072879e+01 27307.089308
    -#> [6,]      4.490538    -6.550313   18.653863  2.613561e-02     3.265608
    -#> [7,] -54419.723543 -1070.933661 2955.924225  5.215403e+02 11214.210707
    -#>             [,6]         [,7]
    -#> [1,]  4.49053810 -54419.72354
    -#> [2,] -6.55031322  -1070.93366
    -#> [3,] 18.65386273   2955.92422
    -#> [4,]  0.02613561    521.54030
    -#> [5,]  3.26560786  11214.21071
    -#> [6,] 41.81083599     71.08764
    -#> [7,] 71.08763902 806176.95068
    -det(FIM.5)
    -#> [1] 1.220371e+24
    -get_rse(FIM.5,poped.db,fim.calc.type=5)
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   3.560994   2.560413   4.811952  26.270324  30.901555  26.503936  12.409516 
    -
    -## evaluate initial design with the reduced FIM with 
    -## A,B,C matricies and derivative of variance
    -## should give same answer as fim.calc.type=1 (default)
    -FIM.7 <- evaluate.fim(poped.db,fim.calc.type=7) 
    -FIM.7
    -#>             [,1]       [,2]      [,3]         [,4]         [,5]        [,6]
    -#> [1,] 19821.28445 -21.836551 -8.622140 0.000000e+00     0.000000  0.00000000
    -#> [2,]   -21.83655  20.656071 -1.807099 0.000000e+00     0.000000  0.00000000
    -#> [3,]    -8.62214  -1.807099 51.729039 0.000000e+00     0.000000  0.00000000
    -#> [4,]     0.00000   0.000000  0.000000 3.107768e+03    10.728786  0.02613561
    -#> [5,]     0.00000   0.000000  0.000000 1.072879e+01 27307.089308  3.26560786
    -#> [6,]     0.00000   0.000000  0.000000 2.613561e-02     3.265608 41.81083599
    -#> [7,]     0.00000   0.000000  0.000000 5.215403e+02 11214.210707 71.08763902
    -#>              [,7]
    -#> [1,]      0.00000
    -#> [2,]      0.00000
    -#> [3,]      0.00000
    -#> [4,]    521.54030
    -#> [5,]  11214.21071
    -#> [6,]     71.08764
    -#> [7,] 806176.95068
    -det(FIM.7)
    -#> [1] 5.996147e+22
    -get_rse(FIM.7,poped.db,fim.calc.type=7)
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   4.738266   2.756206  13.925829  25.627205  30.344316  25.777327  11.170784 
    -
    -## evaluate FIM and rse with prior FIM.1
    -poped.db.prior = create.poped.database(poped.db, prior_fim = FIM.1)
    -FIM.1.prior <- evaluate.fim(poped.db.prior)
    -all.equal(FIM.1.prior,FIM.1) # the FIM is only computed from the design in the poped.db
    -#> [1] TRUE
    -get_rse(FIM.1.prior,poped.db.prior) # the RSE is computed with the prior information
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   3.350460   1.948932   9.847048  18.121170  21.456671  18.227322   7.898937 
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/get_unfixed_params.html b/docs/reference/get_unfixed_params.html deleted file mode 100644 index 9001dbcd..00000000 --- a/docs/reference/get_unfixed_params.html +++ /dev/null @@ -1,135 +0,0 @@ - -Return all the unfixed parameters — get_unfixed_params • PopED - - -
    -
    - - - -
    -
    - - -
    -

    all = vector of all unfixed params var derivative is a vector of 1 and 0, 1 -means derivative of parameter is taken w.r.t. variance otherwise w.r.t. sd If -params is supplied then the parameter is taken from this vector instead of -poped.db

    -
    - -
    -
    get_unfixed_params(poped.db, params = NULL)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    a PopED database.

    - - -
    params
    -

    If params is supplied then the parameters are taken from this vector.

    - -
    -
    -

    Value

    - - -

    A list with the parameters. All unfixed parameters are also - returned in the "all output with the specified order - (bpop,d,covd,docc,covdocc,sigma,covsigma). var_derivative is a - vector of 1's or 0's, 1 means derivative of parameter is taken with respect - to the variance otherwise with respect to standard deviation.

    -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/getfulld.html b/docs/reference/getfulld.html deleted file mode 100644 index 9a39fbea..00000000 --- a/docs/reference/getfulld.html +++ /dev/null @@ -1,148 +0,0 @@ - -Create a full D (between subject variability) matrix given a vector of variances and covariances. -Note, this does not test matching vector lengths. — getfulld • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Create a full D (between subject variability) matrix given a vector of variances and covariances. -Note, this does not test matching vector lengths.

    -
    - -
    -
    getfulld(variance_vector, covariance_vector = NULL)
    -
    - -
    -

    Arguments

    -
    variance_vector
    -

    The vector of the variances.

    - - -
    covariance_vector
    -

    A vector of the covariances. Written in column major -order for the lower triangular matrix.

    - -
    -
    -

    Value

    - - -

    The full matrix of variances for the between subject variances

    -
    - -
    -

    Examples

    -
    
    -getfulld(c(1,2,3))
    -#>      [,1] [,2] [,3]
    -#> [1,]    1    0    0
    -#> [2,]    0    2    0
    -#> [3,]    0    0    3
    -
    -getfulld(c(1,2,3),c(7,6,5))
    -#>      [,1] [,2] [,3]
    -#> [1,]    1    7    6
    -#> [2,]    7    2    5
    -#> [3,]    6    5    3
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/gradf_eps.html b/docs/reference/gradf_eps.html deleted file mode 100644 index 23c9633d..00000000 --- a/docs/reference/gradf_eps.html +++ /dev/null @@ -1,261 +0,0 @@ - -Model linearization with respect to epsilon. — gradf_eps • PopED - - -
    -
    - - - -
    -
    - - -
    -

    The function performs a linearization of the model with respect to the residual variability. -Derivative of model w.r.t. eps evaluated at eps=0 and b=b_ind.

    -
    - -
    -
    gradf_eps(model_switch, xt_ind, x, a, bpop, b_ind, bocc_ind, num_eps, poped.db)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    xt_ind
    -

    A vector of the individual/group sample times

    - - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    a
    -

    A matrix of covariates. Each row is a group.

    - - -
    bpop
    -

    The fixed effects parameter values. Supplied as a vector.

    - - -
    b_ind
    -

    vector of individual realization of the BSV terms b

    - - -
    bocc_ind
    -

    Vector of individual realizations of the BOV terms bocc

    - - -
    num_eps
    -

    The number of eps() in the model.

    - - -
    poped.db
    -

    A PopED database.

    - -
    -
    -

    Value

    - - -

    A matrix of size (samples per individual x number of epsilons)

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -#for the FO approximation
    -ind=1
    -gradf_eps(model_switch=t(poped.db$design$model_switch[ind,,drop=FALSE]),
    -          xt_ind=t(poped.db$design$xt[ind,,drop=FALSE]),
    -          x=zeros(0,1),
    -          a=t(poped.db$design$a[ind,,drop=FALSE]),
    -          bpop=poped.db$parameters$bpop[,2,drop=FALSE],
    -          b_ind=zeros(poped.db$parameters$NumRanEff,1),
    -          bocc_ind=zeros(poped.db$parameters$NumDocc,1),
    -          num_eps=size(poped.db$parameters$sigma,1),
    -          poped.db)["dfeps_de0"]
    -#> $dfeps_de0
    -#>           [,1] [,2]
    -#> [1,] 3.4254357    1
    -#> [2,] 5.4711041    1
    -#> [3,] 7.3821834    1
    -#> [4,] 7.9462805    1
    -#> [5,] 5.6858561    1
    -#> [6,] 4.5402483    1
    -#> [7,] 2.3116966    1
    -#> [8,] 0.9398657    1
    -#> 
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/index.html b/docs/reference/index.html deleted file mode 100644 index 0ed95dd1..00000000 --- a/docs/reference/index.html +++ /dev/null @@ -1,343 +0,0 @@ - -Function reference • PopED - - -
    -
    - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    General information

    -

    -
    -

    PopED poped PopED-package

    -

    PopED - Population (and individual) optimal Experimental Design.

    -

    Predefined structural models

    -

    -
    -

    ff.PK.1.comp.oral.md.CL()

    -

    Structural model: one-compartment, oral absorption, multiple bolus dose, parameterized using CL.

    -

    ff.PK.1.comp.oral.md.KE()

    -

    Structural model: one-compartment, oral absorption, multiple bolus dose, parameterized using KE.

    -

    ff.PK.1.comp.oral.sd.CL()

    -

    Structural model: one-compartment, oral absorption, single bolus dose, parameterized using CL.

    -

    ff.PK.1.comp.oral.sd.KE()

    -

    Structural model: one-compartment, oral absorption, single bolus dose, parameterized using KE.

    -

    ff.PKPD.1.comp.oral.md.CL.imax()

    -

    Structural model: one-compartment, oral absorption, multiple bolus dose, -parameterized using CL driving an inhibitory IMAX model with a direct effect.

    -

    ff.PKPD.1.comp.sd.CL.emax()

    -

    Structural model: one-compartment, single bolus IV dose, parameterized using CL driving an EMAX model with a direct effect.

    -

    Between subject variability models

    -

    -
    -

    build_sfg()

    -

    Build PopED parameter function from a model function

    -

    Predefined residual error models

    -

    Define a residual unexplained variability (RUV) model.

    -
    -

    feps.add()

    -

    RUV model: -Additive .

    -

    feps.add.prop()

    -

    RUV model: -Additive and Proportional.

    -

    feps.prop()

    -

    RUV model: -Proportional.

    -

    Create an initial study design and design space

    -

    Create an initial study design, and design space, if optimizing. Input the design and model information into a format that PopED understands.

    -
    -

    create.poped.database()

    -

    Create a PopED database

    -

    create_design()

    -

    Create design variables for a full description of a design.

    -

    create_design_space()

    -

    Create design variables and a design space for a full description of an optimization problem.

    -

    Simulate from the model and design

    -

    -
    -

    plot_model_prediction()

    -

    Plot model predictions

    -

    model_prediction()

    -

    Model predictions

    -

    Evaluate or summarize the design(s)

    -

    -
    -

    evaluate.e.ofv.fim()

    -

    Evaluate the expectation of the Fisher Information Matrix (FIM) and the expectation of the OFV(FIM).

    -

    evaluate.fim()

    -

    Evaluate the Fisher Information Matrix (FIM)

    -

    evaluate_design()

    -

    Evaluate a design

    -

    evaluate_fim_map()

    -

    Compute the Bayesian Fisher information matrix

    -

    evaluate_power()

    -

    Power of a design to estimate a parameter.

    -

    shrinkage()

    -

    Predict shrinkage of empirical Bayes estimates (EBEs) in a population model

    -

    calc_ofv_and_fim()

    -

    Calculate the Fisher Information Matrix (FIM) and the OFV(FIM) for either point values or parameters or distributions.

    -

    ofv_fim()

    -

    Evaluate a criterion of the Fisher Information Matrix (FIM)

    -

    ofv_criterion()

    -

    Normalize an objective function by the size of the FIM matrix

    -

    get_rse()

    -

    Compute the expected parameter relative standard errors

    -

    plot_efficiency_of_windows()

    -

    Plot the efficiency of windows

    -

    efficiency()

    -

    Compute efficiency.

    -

    design_summary()

    -

    Display a summary of output from poped_db

    -

    Optimize a design

    -

    Optimize a design given a model, design and design space.

    -
    -

    poped_optim()

    -

    Optimize a design defined in a PopED database

    -

    summary(<poped_optim>)

    -

    Display a summary of output from poped_optim

    -

    optim_ARS()

    -

    Optimize a function using adaptive random search.

    -

    optim_LS()

    -

    Optimize a function using a line search algorithm.

    -

    optimize_groupsize()

    -

    Title Optimize the proportion of individuals in the design groups

    -

    optimize_n_eff()

    -

    Translate efficiency to number of subjects

    -

    optimize_n_rse()

    -

    Optimize the number of subjects based on desired uncertainty of a parameter.

    -

    LEDoptim()

    -

    Optimization function for D-family, E-family and Laplace approximated ED designs

    -

    RS_opt()

    -

    Optimize the objective function using an adaptive random search algorithm for D-family and E-family designs.

    -

    a_line_search()

    -

    Optimize using line search

    -

    poped_optimize()

    -

    Retired optimization module for PopED

    -

    Miscellaneous

    -

    -
    -

    cell()

    -

    Create a cell array (a matrix of lists)

    -

    mc_mean()

    -

    Compute the monte-carlo mean of a function

    -

    median_hilow_poped()

    -

    Wrap summary functions from Hmisc and ggplot to work with stat_summary in ggplot

    -

    ones()

    -

    Create a matrix of ones

    -

    pargen()

    -

    Parameter simulation

    -

    poped_gui()

    -

    Run the graphical interface for PopED

    -

    size()

    -

    Function written to match MATLAB's size function

    -

    start_parallel()

    -

    Start parallel computational processes

    -

    tic()

    -

    Timer function (as in MATLAB)

    -

    toc()

    -

    Timer function (as in MATLAB)

    -

    zeros()

    -

    Create a matrix of zeros.

    - - -
    - - -
    - - - - - - - - diff --git a/docs/reference/inv.html b/docs/reference/inv.html deleted file mode 100644 index 6cf01a3e..00000000 --- a/docs/reference/inv.html +++ /dev/null @@ -1,138 +0,0 @@ - -Compute the inverse of a matrix — inv • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Function computes the inverse of a matrix.

    -
    - -
    -
    inv(mat, method = 1, tol = .Machine$double.eps, pseudo_on_fail = TRUE, ...)
    -
    - -
    -

    Arguments

    -
    mat
    -

    A matrix

    - - -
    method
    -

    Which method to use. 1 is Cholesky chol2inv(chol(mat), -2 is using solve(mat) and 3 is the Moore-Penrose generalized inverse (pseudoinverse).

    - - -
    tol
    -

    The tolerance at which we should identify a singular value as zero (used in pseudoinverse calculation).

    - - -
    pseudo_on_fail
    -

    If another method fails should the Moore-Penrose generalized inverse (pseudoinverse) be used?

    - - -
    ...
    -

    Not used.

    - -
    -
    -

    Value

    - - -

    The inverse matrix

    -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/isempty.html b/docs/reference/isempty.html deleted file mode 100644 index d533c0cc..00000000 --- a/docs/reference/isempty.html +++ /dev/null @@ -1,150 +0,0 @@ - -Function written to match MATLAB's isempty function — isempty • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Function written to match MATLAB's isempty function

    -
    - -
    -
    isempty(...)
    -
    - -
    -

    Arguments

    -
    ...
    -

    arguments to pass to the function. Typically a matrix.

    - -
    -
    -

    Value

    - - -

    Logical. True if the passed object has any dimension that is zero.

    -
    -
    -

    See also

    -

    Other MATLAB: -cell(), -diag_matlab(), -feval(), -fileparts(), -ones(), -randn(), -rand(), -size(), -tic(), -toc(), -zeros()

    -
    - -
    -

    Examples

    -
    
    -isempty(zeros(2,3))
    -#> [1] FALSE
    -
    -isempty(zeros(2,0))
    -#> [1] TRUE
    -
    -isempty(c(1,2,3))
    -#> [1] FALSE
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/isfield.html b/docs/reference/isfield.html deleted file mode 100644 index 37a1863d..00000000 --- a/docs/reference/isfield.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - -Function written to match MATLAB's isfield function — isfield • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Check if a list or dataframe has an element with a specific name.

    - - -
    isfield(obj, sub.obj.str)
    - -

    Arguments

    -
    -
    obj
    -
    A list or dataframe
    -
    sub.obj.str
    -
    A string giving the name of the sub-object you want to check for.
    -
    - -

    Value

    - -

    Logical. True if the element exists.

    - -

    See also

    - -

    Other MATLAB: cell, - diag_matlab, feval, - fileparts, isempty, - ones, randn, - randperm, rand, - size, tic, toc, - zeros

    - - -

    Examples

    -
    -foo <- list("fff"=8,"ggg"=9) - -isfield(foo,"fff")
    #> [1] TRUE
    isfield(foo,"lll")
    #> [1] FALSE
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/log_prior_pdf.html b/docs/reference/log_prior_pdf.html deleted file mode 100644 index 0101cb57..00000000 --- a/docs/reference/log_prior_pdf.html +++ /dev/null @@ -1,145 +0,0 @@ - -Compute the natural log of the PDF for the parameters in an E-family design — log_prior_pdf • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Compute the natural log of the PDF for the parameters in an E-family design

    -
    - -
    -
    log_prior_pdf(
    -  alpha,
    -  bpopdescr,
    -  ddescr,
    -  return_gradient = F,
    -  return_hessian = F
    -)
    -
    - -
    -

    Arguments

    -
    alpha
    -

    A parameter vector.

    - - -
    bpopdescr
    -

    Matrix defining the fixed effects, per row (row number = -parameter_number) we should have:

    • column 1 the type of the -distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, 3 = -User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the -distribution (or length of uniform distribution).

    • -
    - - -
    ddescr
    -

    Matrix defining the diagonals of the IIV (same logic as for -the bpopdescr).

    - - -
    return_gradient
    -

    Should the gradient be returned.

    - - -
    return_hessian
    -

    Should the hessian be returned?

    - -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/mc_mean.html b/docs/reference/mc_mean.html deleted file mode 100644 index fbdb2aa4..00000000 --- a/docs/reference/mc_mean.html +++ /dev/null @@ -1,176 +0,0 @@ - -Compute the monte-carlo mean of a function — mc_mean • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Function computes the monte-carlo mean of a function by varying the parameter inputs to the function

    -
    - -
    -
    mc_mean(
    -  ofv_fcn,
    -  poped.db,
    -  bpopdescr = poped.db$parameters$bpop,
    -  ddescr = poped.db$parameters$d,
    -  doccdescr = poped.db$parameters$d,
    -  user_distribution_pointer = poped.db$model$user_distribution_pointer,
    -  ED_samp_size = poped.db$settings$ED_samp_size,
    -  bLHS = poped.db$settings$bLHS,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    ofv_fcn
    -

    A function with poped.db as the first input

    - - -
    poped.db
    -

    A PopED database.

    - - -
    bpopdescr
    -

    Matrix defining the fixed effects, per row (row number = -parameter_number) we should have:

    • column 1 the type of the -distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, 3 = -User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the -distribution (or length of uniform distribution).

    • -
    - - -
    ddescr
    -

    Matrix defining the diagonals of the IIV (same logic as for -the bpopdescr).

    - - -
    doccdescr
    -

    Matrix defining the IOV. -per row (row number = parameter_number) we should have:

    • column 1 the type of the distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, - 3 = User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean of the variance.

    • -
    • column 3 defines the variance of the distribution (or length of uniform distribution).

    • -
    - - -
    user_distribution_pointer
    -

    Function name for user defined distributions for E-family designs

    - - -
    ED_samp_size
    -

    Sample size for E-family sampling

    - - -
    bLHS
    -

    How to sample from distributions in E-family calculations. 0=Random Sampling, 1=LatinHyperCube --

    - - -
    ...
    -

    Other arguments passed to the function.

    - -
    -
    -

    Value

    - - -

    The mean of the function evaluated at different parameter values.

    -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/median_hilow_poped.html b/docs/reference/median_hilow_poped.html deleted file mode 100644 index 8db016ea..00000000 --- a/docs/reference/median_hilow_poped.html +++ /dev/null @@ -1,122 +0,0 @@ - -Wrap summary functions from Hmisc and ggplot to work with stat_summary in ggplot — median_hilow_poped • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Created for back compatibility with older versions of ggplot, and so that -PopED does not have to load ggplot when started.

    -
    - -
    -
    median_hilow_poped(x, ...)
    -
    - -
    -

    Arguments

    -
    x
    -

    A numeric vector

    - - -
    ...
    -

    Additional arguments passed to Hmisc's smedian.hilow function or -ggplot2's median_hilow function, depending on your version of ggplot.

    - -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/mf.html b/docs/reference/mf.html deleted file mode 100644 index 94fb04e7..00000000 --- a/docs/reference/mf.html +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - - -The full Fisher Information Matrix (FIM) for one individual — mf • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Compute the full FIM for one individual given specific model(s), parameters, design and methods. -This computation makes no assumption that fixed and random effects are uncorrelated.

    - - -
    mf(model_switch, xt_ind, x, a, bpop, d, sigma, docc, poped.db)
    - -

    Arguments

    -
    -
    model_switch
    -
    A vector that is the same size as xt, specifying which model each sample belongs to.
    -
    xt_ind
    -
    A vector of sample times.
    -
    x
    -
    A vector for the discrete design variables.
    -
    a
    -
    A vector of covariates.
    -
    bpop
    -
    The fixed effects parameter values. Supplied as a vector.
    -
    d
    -
    A between subject variability matrix (OMEGA in NONMEM).
    -
    sigma
    -
    A residual unexplained variability matrix (SIGMA in NONMEM).
    -
    docc
    -
    A between occasion variability matrix.
    -
    poped.db
    -
    A PopED database.
    -
    - -

    Value

    - -

    As a list:

    - -

    See also

    - -

    Used by mftot0.

    -

    Other FIM: LinMatrixH, - LinMatrixLH, LinMatrixL_occ, - calc_ofv_and_fim, - ed_laplace_ofv, ed_mftot, - efficiency, - evaluate.e.ofv.fim, - evaluate.fim, gradf_eps, - mf3, mf5, mf6, - mf7, mf8, - mftot0, mftot1, - mftot2, mftot3, - mftot4, mftot5, - mftot6, mftot7, - mftot, ofv_criterion, - ofv_fim

    - - -

    Examples

    -
    library(PopED) - -############# START ################# -## Create PopED database -## (warfarin example) -##################################### - -## Warfarin example from software comparison in: -## Nyberg et al., "Methods and software tools for design evaluation -## for population pharmacokinetics-pharmacodynamics studies", -## Br. J. Clin. Pharm., 2014. - -## find the parameters that are needed to define from the structural model -ff.PK.1.comp.oral.sd.CL
    #> function(model_switch,xt,parameters,poped.db){ -#> ##-- Model: One comp first order absorption -#> with(as.list(parameters),{ -#> y=xt -#> y=(DOSE*Favail*KA/(V*(KA-CL/V)))*(exp(-CL/V*xt)-exp(-KA*xt)) -#> return(list( y= y,poped.db=poped.db)) -#> }) -#> } -#> <environment: namespace:PopED>
    -## -- parameter definition function -## -- names match parameters in function ff -sfg <- function(x,a,bpop,b,bocc){ - parameters=c(CL=bpop[1]*exp(b[1]), - V=bpop[2]*exp(b[2]), - KA=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1]) - return(parameters) -} - -## -- Define initial design and design space -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, - fg_fun=sfg, - fError_fun=feps.prop, - bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), - notfixed_bpop=c(1,1,1,0), - d=c(CL=0.07, V=0.02, KA=0.6), - sigma=0.01, - groupsize=32, - xt=c( 0.5,1,2,6,24,36,72,120), - minxt=0, - maxxt=120, - a=70) - -############# END ################### -## Create PopED database -## (warfarin example) -##################################### - - -#for the FO approximation -ind=1 - -# no occasion defined in this example, so result is zero -output <- mf(model_switch=t(poped.db$design$model_switch[ind,,drop=FALSE]), - xt_ind=t(poped.db$design$xt[ind,,drop=FALSE]), - x=zeros(0,1), - a=t(poped.db$design$a[ind,,drop=FALSE]), - bpop=poped.db$parameters$bpop[,2,drop=FALSE], - d=poped.db$parameters$param.pt.val$d, - sigma=poped.db$parameters$sigma, - docc=poped.db$parameters$param.pt.val$docc, - poped.db) - -# in this simple case the full FIM is just the sum of the individual FIMs -# and all the individual FIMs are the same -det(output$ret*32) == det(evaluate.fim(poped.db,fim.calc.type=0))
    #> [1] TRUE
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/mf3.html b/docs/reference/mf3.html deleted file mode 100644 index 6c9afb3b..00000000 --- a/docs/reference/mf3.html +++ /dev/null @@ -1,177 +0,0 @@ - -The Fisher Information Matrix (FIM) for one individual — mf3 • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Compute the FIM for one individual given specific model(s), parameters, design and methods.

    -
    - -
    -
    mf3(model_switch, xt, x, a, bpop, d, sigma, docc, poped.db)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    A vector that is the same size as xt, specifying which model each sample belongs to.

    - - -
    xt
    -

    A vector of sample times.

    - - -
    x
    -

    A vector for the discrete design variables.

    - - -
    a
    -

    A vector of covariates.

    - - -
    bpop
    -

    The fixed effects parameter values. Supplied as a vector.

    - - -
    d
    -

    A between subject variability matrix (OMEGA in NONMEM).

    - - -
    sigma
    -

    A residual unexplained variability matrix (SIGMA in NONMEM).

    - - -
    docc
    -

    A between occasion variability matrix.

    - - -
    poped.db
    -

    A PopED database.

    - -
    -
    -

    Value

    - - -

    As a list:

    -
    ret
    -

    The FIM for one individual

    - -
    poped.db
    -

    A PopED database

    - -
    - - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/mf5.html b/docs/reference/mf5.html deleted file mode 100644 index 99ab2042..00000000 --- a/docs/reference/mf5.html +++ /dev/null @@ -1,240 +0,0 @@ - - - - - - - - -The reduced Fisher Information Matrix (FIM) for one individual, using the SD of RUV as a parameter. — mf5 • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Compute the reduced FIM for one individual using the standard deviation of the residual unexplained variability (RUV) terms as a parameter, -given specific model(s), parameters, design and methods. -This computation -assumes that there is no correlation in the FIM between the fixed and random effects, -and set these elements in the FIM to zero. -In addition all derivatives in the computation are made -with respect to the standard deviation of the RUV terms (sqrt(SIGMA) in NONMEM). -This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the resudual unexplained variation by default).

    - - -
    mf5(model_switch, xt, x, a, bpop, d, sigma, docc, poped.db)
    - -

    Arguments

    -
    -
    model_switch
    -
    A vector that is the same size as xt, specifying which model each sample belongs to.
    -
    xt
    -
    A vector of sample times.
    -
    x
    -
    A vector for the discrete design variables.
    -
    a
    -
    A vector of covariates.
    -
    bpop
    -
    The fixed effects parameter values. Supplied as a vector.
    -
    d
    -
    A between subject variability matrix (OMEGA in NONMEM).
    -
    sigma
    -
    A residual unexplained variability matrix (SIGMA in NONMEM).
    -
    docc
    -
    A between occasion variability matrix.
    -
    poped.db
    -
    A PopED database.
    -
    - -

    Value

    - -

    As a list:

    - -

    See also

    - -

    Used by mftot4.

    -

    Other FIM: LinMatrixH, - LinMatrixLH, LinMatrixL_occ, - calc_ofv_and_fim, - ed_laplace_ofv, ed_mftot, - efficiency, - evaluate.e.ofv.fim, - evaluate.fim, gradf_eps, - mf3, mf6, mf7, - mf8, mftot0, - mftot1, mftot2, - mftot3, mftot4, - mftot5, mftot6, - mftot7, mftot, - mf, ofv_criterion, - ofv_fim

    - - -

    Examples

    -
    library(PopED) - -############# START ################# -## Create PopED database -## (warfarin example) -##################################### - -## Warfarin example from software comparison in: -## Nyberg et al., "Methods and software tools for design evaluation -## for population pharmacokinetics-pharmacodynamics studies", -## Br. J. Clin. Pharm., 2014. - -## find the parameters that are needed to define from the structural model -ff.PK.1.comp.oral.sd.CL
    #> function(model_switch,xt,parameters,poped.db){ -#> ##-- Model: One comp first order absorption -#> with(as.list(parameters),{ -#> y=xt -#> y=(DOSE*Favail*KA/(V*(KA-CL/V)))*(exp(-CL/V*xt)-exp(-KA*xt)) -#> return(list( y= y,poped.db=poped.db)) -#> }) -#> } -#> <environment: namespace:PopED>
    -## -- parameter definition function -## -- names match parameters in function ff -sfg <- function(x,a,bpop,b,bocc){ - parameters=c(CL=bpop[1]*exp(b[1]), - V=bpop[2]*exp(b[2]), - KA=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1]) - return(parameters) -} - -## -- Define initial design and design space -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, - fg_fun=sfg, - fError_fun=feps.prop, - bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), - notfixed_bpop=c(1,1,1,0), - d=c(CL=0.07, V=0.02, KA=0.6), - sigma=0.01, - groupsize=32, - xt=c( 0.5,1,2,6,24,36,72,120), - minxt=0, - maxxt=120, - a=70) - -############# END ################### -## Create PopED database -## (warfarin example) -##################################### - - -#for the FO approximation -ind=1 - -# no occasion defined in this example, so result is zero -output <- mf5(model_switch=t(poped.db$design$model_switch[ind,,drop=FALSE]), - xt=t(poped.db$design$xt[ind,,drop=FALSE]), - x=zeros(0,1), - a=t(poped.db$design$a[ind,,drop=FALSE]), - bpop=poped.db$parameters$bpop[,2,drop=FALSE], - d=poped.db$parameters$param.pt.val$d, - sigma=poped.db$parameters$sigma, - docc=poped.db$parameters$param.pt.val$docc, - poped.db) - -# in this simple case the full FIM is just the sum of the individual FIMs -# and all the individual FIMs are the same -det(output$ret*32) == det(evaluate.fim(poped.db,fim.calc.type=4))
    #> [1] TRUE
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/mf6.html b/docs/reference/mf6.html deleted file mode 100644 index 9b1a1baa..00000000 --- a/docs/reference/mf6.html +++ /dev/null @@ -1,242 +0,0 @@ - - - - - - - - -The full Fisher Information Matrix (FIM) for one individual parameterized with A,B,C matrices & using the derivative of variance. — mf6 • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Compute the full FIM for one individual given specific model(s), parameters, design and methods. -This computation parameterizes the FIM calculation using -A,B,C matrices (as in Retout et al.) but uses the derivative of variances. -Should give the same answer as mf but computation times may be different.

    - - -
    mf6(model_switch, xt_ind, x, a, bpop, d, sigma, docc, poped.db)
    - -

    Arguments

    -
    -
    model_switch
    -
    A vector that is the same size as xt, specifying which model each sample belongs to.
    -
    xt_ind
    -
    A vector of sample times.
    -
    x
    -
    A vector for the discrete design variables.
    -
    a
    -
    A vector of covariates.
    -
    bpop
    -
    The fixed effects parameter values. Supplied as a vector.
    -
    d
    -
    A between subject variability matrix (OMEGA in NONMEM).
    -
    sigma
    -
    A residual unexplained variability matrix (SIGMA in NONMEM).
    -
    docc
    -
    A between occasion variability matrix.
    -
    poped.db
    -
    A PopED database.
    -
    - -

    Value

    - -

    As a list:

    - -

    References

    - -

    S. Retout and F. Mentre, "Further developments of the Fisher Information Matrix in -nonlinear mixed effects models with evaluation in population pharmacokinetics", J. of Biopharm. Stats., 13(2), 2003.

    - -

    See also

    - -

    Used by mftot5.

    -

    Other FIM: LinMatrixH, - LinMatrixLH, LinMatrixL_occ, - calc_ofv_and_fim, - ed_laplace_ofv, ed_mftot, - efficiency, - evaluate.e.ofv.fim, - evaluate.fim, gradf_eps, - mf3, mf5, mf7, - mf8, mftot0, - mftot1, mftot2, - mftot3, mftot4, - mftot5, mftot6, - mftot7, mftot, - mf, ofv_criterion, - ofv_fim

    - - -

    Examples

    -
    library(PopED) - -############# START ################# -## Create PopED database -## (warfarin example) -##################################### - -## Warfarin example from software comparison in: -## Nyberg et al., "Methods and software tools for design evaluation -## for population pharmacokinetics-pharmacodynamics studies", -## Br. J. Clin. Pharm., 2014. - -## find the parameters that are needed to define from the structural model -ff.PK.1.comp.oral.sd.CL
    #> function(model_switch,xt,parameters,poped.db){ -#> ##-- Model: One comp first order absorption -#> with(as.list(parameters),{ -#> y=xt -#> y=(DOSE*Favail*KA/(V*(KA-CL/V)))*(exp(-CL/V*xt)-exp(-KA*xt)) -#> return(list( y= y,poped.db=poped.db)) -#> }) -#> } -#> <environment: namespace:PopED>
    -## -- parameter definition function -## -- names match parameters in function ff -sfg <- function(x,a,bpop,b,bocc){ - parameters=c(CL=bpop[1]*exp(b[1]), - V=bpop[2]*exp(b[2]), - KA=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1]) - return(parameters) -} - -## -- Define initial design and design space -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, - fg_fun=sfg, - fError_fun=feps.prop, - bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), - notfixed_bpop=c(1,1,1,0), - d=c(CL=0.07, V=0.02, KA=0.6), - sigma=0.01, - groupsize=32, - xt=c( 0.5,1,2,6,24,36,72,120), - minxt=0, - maxxt=120, - a=70) - -############# END ################### -## Create PopED database -## (warfarin example) -##################################### - - -#for the FO approximation -ind=1 - -# no occasion defined in this example, so result is zero -output <- mf6(model_switch=t(poped.db$design$model_switch[ind,,drop=FALSE]), - xt=t(poped.db$design$xt[ind,,drop=FALSE]), - x=zeros(0,1), - a=t(poped.db$design$a[ind,,drop=FALSE]), - bpop=poped.db$parameters$bpop[,2,drop=FALSE], - d=poped.db$parameters$param.pt.val$d, - sigma=poped.db$parameters$sigma, - docc=poped.db$parameters$param.pt.val$docc, - poped.db) - -# in this simple case the full FIM is just the sum of the individual FIMs -# and all the individual FIMs are the same -det(output$ret*32) == det(evaluate.fim(poped.db,fim.calc.type=5))
    #> [1] TRUE
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/mf7.html b/docs/reference/mf7.html deleted file mode 100644 index 5939a5dc..00000000 --- a/docs/reference/mf7.html +++ /dev/null @@ -1,175 +0,0 @@ - -The full Fisher Information Matrix (FIM) for one individual Calculating one model switch at a time, good for large matrices. — mf7 • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Compute the full FIM for one individual given specific model(s), parameters, design and methods. -This computation calculates the FIM for each model switch separately. Correlations between the models parameters are assumed to be zero.

    -
    - -
    -
    mf7(model_switch, xt_ind, x, a, bpop, d, sigma, docc, poped.db)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    A vector that is the same size as xt, specifying which model each sample belongs to.

    - - -
    x
    -

    A vector for the discrete design variables.

    - - -
    a
    -

    A vector of covariates.

    - - -
    bpop
    -

    The fixed effects parameter values. Supplied as a vector.

    - - -
    d
    -

    A between subject variability matrix (OMEGA in NONMEM).

    - - -
    sigma
    -

    A residual unexplained variability matrix (SIGMA in NONMEM).

    - - -
    docc
    -

    A between occasion variability matrix.

    - - -
    poped.db
    -

    A PopED database.

    - -
    -
    -

    Value

    - - -

    As a list:

    -
    ret
    -

    The FIM for one individual

    - -
    poped.db
    -

    A PopED database

    - -
    - - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/mf8.html b/docs/reference/mf8.html deleted file mode 100644 index 272856af..00000000 --- a/docs/reference/mf8.html +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - -The reduced Fisher Information Matrix (FIM) for one individual parameterized with A,B,C matrices & using the derivative of variance. — mf8 • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Compute the reduced FIM for one individual given specific model(s), parameters, design and methods. -This computation assumes that there is no correlation in the FIM between the fixed and random effects, -and set these elements in the FIM to zero. -This computation parameterizes the FIM calculation using -A,B,C matrices (as in Retout et al.) but uses the derivative of variances. -Should give the same answer as mf3 but computation times may be different.

    - - -
    mf8(model_switch, xt_ind, x, a, bpop, d, sigma, docc, poped.db)
    - -

    Arguments

    -
    -
    model_switch
    -
    A vector that is the same size as xt, specifying which model each sample belongs to.
    -
    xt_ind
    -
    A vector of sample times.
    -
    x
    -
    A vector for the discrete design variables.
    -
    a
    -
    A vector of covariates.
    -
    bpop
    -
    The fixed effects parameter values. Supplied as a vector.
    -
    d
    -
    A between subject variability matrix (OMEGA in NONMEM).
    -
    sigma
    -
    A residual unexplained variability matrix (SIGMA in NONMEM).
    -
    docc
    -
    A between occasion variability matrix.
    -
    poped.db
    -
    A PopED database.
    -
    - -

    Value

    - -

    As a list:

    - -

    References

    - -

    S. Retout and F. Mentre, "Further developments of the Fisher Information Matrix in -nonlinear mixed effects models with evaluation in population pharmacokinetics", J. of Biopharm. Stats., 13(2), 2003.

    - -

    See also

    - -

    Used by mftot7.

    -

    Other FIM: LinMatrixH, - LinMatrixLH, LinMatrixL_occ, - calc_ofv_and_fim, - ed_laplace_ofv, ed_mftot, - efficiency, - evaluate.e.ofv.fim, - evaluate.fim, gradf_eps, - mf3, mf5, mf6, - mf7, mftot0, - mftot1, mftot2, - mftot3, mftot4, - mftot5, mftot6, - mftot7, mftot, - mf, ofv_criterion, - ofv_fim

    - - -

    Examples

    -
    library(PopED) - -############# START ################# -## Create PopED database -## (warfarin example) -##################################### - -## Warfarin example from software comparison in: -## Nyberg et al., "Methods and software tools for design evaluation -## for population pharmacokinetics-pharmacodynamics studies", -## Br. J. Clin. Pharm., 2014. - -## find the parameters that are needed to define from the structural model -ff.PK.1.comp.oral.sd.CL
    #> function(model_switch,xt,parameters,poped.db){ -#> ##-- Model: One comp first order absorption -#> with(as.list(parameters),{ -#> y=xt -#> y=(DOSE*Favail*KA/(V*(KA-CL/V)))*(exp(-CL/V*xt)-exp(-KA*xt)) -#> return(list( y= y,poped.db=poped.db)) -#> }) -#> } -#> <environment: namespace:PopED>
    -## -- parameter definition function -## -- names match parameters in function ff -sfg <- function(x,a,bpop,b,bocc){ - parameters=c(CL=bpop[1]*exp(b[1]), - V=bpop[2]*exp(b[2]), - KA=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1]) - return(parameters) -} - -## -- Define initial design and design space -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, - fg_fun=sfg, - fError_fun=feps.prop, - bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), - notfixed_bpop=c(1,1,1,0), - d=c(CL=0.07, V=0.02, KA=0.6), - sigma=0.01, - groupsize=32, - xt=c( 0.5,1,2,6,24,36,72,120), - minxt=0, - maxxt=120, - a=70) - -############# END ################### -## Create PopED database -## (warfarin example) -##################################### - - -#for the FO approximation -ind=1 - -# no occasion defined in this example, so result is zero -output <- mf8(model_switch=t(poped.db$design$model_switch[ind,,drop=FALSE]), - xt=t(poped.db$design$xt[ind,,drop=FALSE]), - x=zeros(0,1), - a=t(poped.db$design$a[ind,,drop=FALSE]), - bpop=poped.db$parameters$bpop[,2,drop=FALSE], - d=poped.db$parameters$param.pt.val$d, - sigma=poped.db$parameters$sigma, - docc=poped.db$parameters$param.pt.val$docc, - poped.db) - -# in this simple case the full FIM is just the sum of the individual FIMs -# and all the individual FIMs are the same -det(output$ret*32) == det(evaluate.fim(poped.db,fim.calc.type=7))
    #> [1] TRUE
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/mfea.html b/docs/reference/mfea.html deleted file mode 100644 index 92ea7f9b..00000000 --- a/docs/reference/mfea.html +++ /dev/null @@ -1,434 +0,0 @@ - -Modified Fedorov Exchange Algorithm — mfea • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Optimize the objective function using a modified Fedorov exchange algorithm. -The function works for continuous and discrete optimization variables. -This function takes information from the PopED database supplied as an argument. -The PopED database supplies information about the the model, parameters, design and methods to use. -Some of the arguments coming from the PopED database can be overwritten; -if they are supplied then they are used instead of the arguments from the PopED database.

    -
    - -
    -
    mfea(
    -  poped.db,
    -  model_switch,
    -  ni,
    -  xt,
    -  x,
    -  a,
    -  bpopdescr,
    -  ddescr,
    -  maxxt,
    -  minxt,
    -  maxa,
    -  mina,
    -  fmf,
    -  dmf,
    -  EAStepSize = poped.db$settings$EAStepSize,
    -  ourzero = poped.db$settings$ourzero,
    -  opt_xt = poped.db$settings$optsw[2],
    -  opt_a = poped.db$settings$optsw[4],
    -  opt_x = poped.db$settings$optsw[3],
    -  trflag = T,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    xt
    -

    A matrix of sample times. Each row is a vector of sample times for a group.

    - - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    a
    -

    A matrix of covariates. Each row is a group.

    - - -
    bpopdescr
    -

    Matrix defining the fixed effects, per row (row number = -parameter_number) we should have:

    • column 1 the type of the -distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, 3 = -User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the -distribution (or length of uniform distribution).

    • -
    - - -
    ddescr
    -

    Matrix defining the diagonals of the IIV (same logic as for -the bpopdescr).

    - - -
    maxxt
    -

    Matrix or single value defining the maximum value for each xt sample. If a single value is -supplied then all xt values are given the same maximum value.

    - - -
    minxt
    -

    Matrix or single value defining the minimum value for each xt sample. If a single value is -supplied then all xt values are given the same minimum value

    - - -
    maxa
    -

    Vector defining the max value for each covariate. If a single value is supplied then -all a values are given the same max value

    - - -
    mina
    -

    Vector defining the min value for each covariate. If a single value is supplied then -all a values are given the same max value

    - - -
    fmf
    -

    The initial value of the FIM. If set to zero then it is computed.

    - - -
    dmf
    -

    The initial OFV. If set to zero then it is computed.

    - - -
    EAStepSize
    -

    Exchange Algorithm StepSize

    - - -
    ourzero
    -

    Value to interpret as zero in design

    - - -
    opt_xt
    -

    Should the sample times be optimized?

    - - -
    opt_a
    -

    Should the continuous design variables be optimized?

    - - -
    opt_x
    -

    Should the discrete design variables be optimized?

    - - -
    trflag
    -

    Should the optimization be output to the screen and to a file?

    - - -
    ...
    -

    arguments passed to evaluate.fim and ofv_fim.

    - -
    -
    -

    References

    - -
    1. J. Nyberg, S. Ueckert, E.A. Stroemberg, S. Hennig, M.O. Karlsson and A.C. Hooker, "PopED: An extended, -parallelized, nonlinear mixed effects models optimal design tool", -Computer Methods and Programs in Biomedicine, 108, 2012.

    2. -
    - - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -##############
    -# typically one will use poped_optimize 
    -# This then calls mfea 
    -##############
    -
    -# optimization of covariate, with coarse grid
    -out_1 <- poped_optimize(poped.db,opt_a=1,
    -                              bUseExchangeAlgorithm=1,
    -                              EAStepSize=25,out_file = "")
    -#> ===============================================================================
    -#> Initial design evaluation
    -#> 
    -#> Initial OFV = 55.3964
    -#> 
    -#> Initial design
    -#> expected relative standard error
    -#> (%RSE, rounded to nearest integer)
    -#>    Parameter   Values   RSE_0
    -#>           CL     0.15       5
    -#>            V        8       3
    -#>           KA        1      14
    -#>         d_CL     0.07      30
    -#>          d_V     0.02      37
    -#>         d_KA      0.6      27
    -#>     sig_prop     0.01      32
    -#>      sig_add     0.25      26
    -#> 
    -#> ==============================================================================
    -#> Optimization of design parameters
    -#> 
    -#> * Optimize Covariates
    -#> 
    -#> MFEA - It. : 1
    -#> MFEA - It. : 1
    -#> Exchanged covariate 1 in group/ind 1 from 70 to 100
    -#> Exchanged covariate 1 in group/ind 1 from 70 to 100
    -#> Delta : 0.0114735   OFV. : 56.032
    -#> Delta : 0.0114735   OFV. : 56.032
    -#> MFEA - It. : 2
    -#> MFEA - It. : 2
    -#> Delta : 0   OFV. : 56.032
    -#> Delta : 0   OFV. : 56.032
    -#> ===============================================================================
    -#> FINAL RESULTS
    -#> 
    -#> Optimized Covariates:
    -#> Group 1: 100
    -#> 
    -#> OFV = 56.032
    -#> 
    -#> Efficiency: 
    -#>   ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.0827
    -#> 
    -#> Expected relative standard error
    -#> (%RSE, rounded to nearest integer):
    -#>    Parameter   Values   RSE_0   RSE
    -#>           CL     0.15       5     5
    -#>            V        8       3     3
    -#>           KA        1      14    14
    -#>         d_CL     0.07       0     0
    -#>          d_V     0.02      37    34
    -#>         d_KA      0.6       0     0
    -#>     sig_prop     0.01      32    23
    -#>      sig_add     0.25      26    30
    -#> 
    -#> Total running time: 0.025 seconds
    -
    -
    -if (FALSE) {
    -  
    -  
    -  
    -  # MFEA optimization with only integer times allowed
    -  out_2 <- poped_optimize(poped.db,opt_xt=1,
    -                                bUseExchangeAlgorithm=1,
    -                                EAStepSize=1)
    -  get_rse(out_2$fmf,out_2$poped.db)
    -  plot_model_prediction(out_2$poped.db)
    -  
    -  
    -  ##############
    -  # If you really want to you can use mfea dirtectly
    -  ##############
    -  dsl <- downsizing_general_design(poped.db)
    -  
    -  output <- mfea(poped.db,
    -                 model_switch=dsl$model_switch,
    -                 ni=dsl$ni,
    -                 xt=dsl$xt,
    -                 x=dsl$x,
    -                 a=dsl$a,
    -                 bpopdescr=dsl$bpop,
    -                 ddescr=dsl$d,
    -                 maxxt=dsl$maxxt,
    -                 minxt=dsl$minxt,
    -                 maxa=dsl$maxa,
    -                 mina=dsl$mina,
    -                 fmf=0,dmf=0,
    -                 EAStepSize=1,
    -                 opt_xt=1)
    -  
    -  
    -}
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/mftot.html b/docs/reference/mftot.html deleted file mode 100644 index b6aeaa80..00000000 --- a/docs/reference/mftot.html +++ /dev/null @@ -1,297 +0,0 @@ - -Evaluate the Fisher Information Matrix (FIM) — mftot • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Compute the FIM given specific model(s), parameters, design and methods.

    -
    - -
    -
    mftot(
    -  model_switch,
    -  groupsize,
    -  ni,
    -  xt,
    -  x,
    -  a,
    -  bpop,
    -  d,
    -  sigma,
    -  docc,
    -  poped.db,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    groupsize
    -

    A vector of the number of individuals in each group.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    xt
    -

    A matrix of sample times. Each row is a vector of sample times for a group.

    - - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    a
    -

    A matrix of covariates. Each row is a group.

    - - -
    bpop
    -

    The fixed effects parameter values. Supplied as a vector.

    - - -
    d
    -

    A between subject variability matrix (OMEGA in NONMEM).

    - - -
    sigma
    -

    A residual unexplained variability matrix (SIGMA in NONMEM).

    - - -
    docc
    -

    A between occasion variability matrix.

    - - -
    poped.db
    -

    A PopED database.

    - -
    -
    -

    Value

    - - -

    As a list:

    -
    ret
    -

    The FIM

    - -
    poped.db
    -

    A PopED database

    - -
    -
    -

    See also

    -

    For an easier function to use, please see evaluate.fim.

    -

    Other FIM: -LinMatrixH(), -LinMatrixLH(), -LinMatrixL_occ(), -calc_ofv_and_fim(), -ed_laplace_ofv(), -ed_mftot(), -efficiency(), -evaluate.e.ofv.fim(), -evaluate.fim(), -gradf_eps(), -mf3(), -mf7(), -ofv_criterion(), -ofv_fim()

    -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -mftot(model_switch=poped.db$design$model_switch,
    -      groupsize=poped.db$design$groupsize,
    -      ni=poped.db$design$ni,
    -      xt=poped.db$design$xt,
    -      x=poped.db$design$x,
    -      a=poped.db$design$a,
    -      bpop=poped.db$parameters$param.pt.val$bpop,
    -      d=poped.db$parameters$param.pt.val$d,
    -      sigma=poped.db$parameters$sigma,
    -      docc=poped.db$parameters$param.pt.val$docc,
    -      poped.db)["ret"]
    -#> $ret
    -#>             [,1]      [,2]      [,3]         [,4]         [,5]        [,6]
    -#> [1,] 17141.83891 20.838375 10.011000 0.000000e+00     0.000000  0.00000000
    -#> [2,]    20.83837 17.268051 -3.423641 0.000000e+00     0.000000  0.00000000
    -#> [3,]    10.01100 -3.423641 49.864697 0.000000e+00     0.000000  0.00000000
    -#> [4,]     0.00000  0.000000  0.000000 2.324341e+03     9.770352  0.03523364
    -#> [5,]     0.00000  0.000000  0.000000 9.770352e+00 19083.877564 11.72131703
    -#> [6,]     0.00000  0.000000  0.000000 3.523364e-02    11.721317 38.85137516
    -#> [7,]     0.00000  0.000000  0.000000 7.268410e+02  9656.158553 64.78095548
    -#> [8,]     0.00000  0.000000  0.000000 9.062739e+01   266.487127  2.94728469
    -#>              [,7]        [,8]
    -#> [1,]      0.00000    0.000000
    -#> [2,]      0.00000    0.000000
    -#> [3,]      0.00000    0.000000
    -#> [4,]    726.84097   90.627386
    -#> [5,]   9656.15855  266.487127
    -#> [6,]     64.78096    2.947285
    -#> [7,] 192840.20092 6659.569867
    -#> [8,]   6659.56987  475.500111
    -#> 
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/mftot0.html b/docs/reference/mftot0.html deleted file mode 100644 index cabbeb41..00000000 --- a/docs/reference/mftot0.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - -The full Fisher Information Matrix (FIM) — mftot0 • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Compute the full FIM given specific model(s), parameters, design and methods. -This computation makes no assumption that fixed and random effects are uncorrelated.

    - - -
    mftot0(model_switch, groupsize, ni, xt, x, a, bpop, d, sigma, docc, poped.db)
    - -

    Arguments

    -
    -
    model_switch
    -
    A matrix that is the same size as xt, specifying which model each sample belongs to.
    -
    groupsize
    -
    A vector of the numer of individuals in each group.
    -
    ni
    -
    A vector of the number of samples in each group.
    -
    xt
    -
    A matrix of sample times. Each row is a vector of sample times for a group.
    -
    x
    -
    A matrix for the discrete design variables. Each row is a group.
    -
    a
    -
    A matrix of covariates. Each row is a group.
    -
    bpop
    -
    The fixed effects parameter values. Supplied as a vector.
    -
    d
    -
    A between subject variability matrix (OMEGA in NONMEM).
    -
    sigma
    -
    A residual unexplained variability matrix (SIGMA in NONMEM).
    -
    docc
    -
    A between occasion variability matrix.
    -
    poped.db
    -
    A PopED database.
    -
    - -

    Value

    - -

    As a list:

    - -

    See also

    - -

    For an easier function to use, please see evaluate.fim.

    -

    Other FIM: LinMatrixH, - LinMatrixLH, LinMatrixL_occ, - calc_ofv_and_fim, - ed_laplace_ofv, ed_mftot, - efficiency, - evaluate.e.ofv.fim, - evaluate.fim, gradf_eps, - mf3, mf5, mf6, - mf7, mf8, - mftot1, mftot2, - mftot3, mftot4, - mftot5, mftot6, - mftot7, mftot, - mf, ofv_criterion, - ofv_fim

    - - -

    Examples

    -
    library(PopED) - -############# START ################# -## Create PopED database -## (warfarin model for optimization) -##################################### - -## Warfarin example from software comparison in: -## Nyberg et al., "Methods and software tools for design evaluation -## for population pharmacokinetics-pharmacodynamics studies", -## Br. J. Clin. Pharm., 2014. - -## Optimization using an additive + proportional reidual error -## to avoid sample times at very low concentrations (time 0 or very late samples). - -## find the parameters that are needed to define from the structural model -ff.PK.1.comp.oral.sd.CL
    #> function(model_switch,xt,parameters,poped.db){ -#> ##-- Model: One comp first order absorption -#> with(as.list(parameters),{ -#> y=xt -#> y=(DOSE*Favail*KA/(V*(KA-CL/V)))*(exp(-CL/V*xt)-exp(-KA*xt)) -#> return(list( y= y,poped.db=poped.db)) -#> }) -#> } -#> <environment: namespace:PopED>
    -## -- parameter definition function -## -- names match parameters in function ff -sfg <- function(x,a,bpop,b,bocc){ - parameters=c(CL=bpop[1]*exp(b[1]), - V=bpop[2]*exp(b[2]), - KA=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1]) - return(parameters) -} - -## -- Define initial design and design space -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, - fg_fun=sfg, - fError_fun=feps.add.prop, - bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), - notfixed_bpop=c(1,1,1,0), - d=c(CL=0.07, V=0.02, KA=0.6), - sigma=c(0.01,0.25), - groupsize=32, - xt=c( 0.5,1,2,6,24,36,72,120), - minxt=0.01, - maxxt=120, - a=70, - mina=0.01, - maxa=100) - -############# END ################### -## Create PopED database -## (warfarin model for optimization) -##################################### - - -mftot0(model_switch=poped.db$design$model_switch, - groupsize=poped.db$design$groupsize, - ni=poped.db$design$ni, - xt=poped.db$design$xt, - x=poped.db$design$x, - a=poped.db$design$a, - bpop=poped.db$parameters$param.pt.val$bpop, - d=poped.db$parameters$param.pt.val$d, - sigma=poped.db$parameters$sigma, - docc=poped.db$parameters$param.pt.val$docc, - poped.db)["ret"]
    #> $ret -#> [,1] [,2] [,3] [,4] [,5] [,6] -#> [1,] 19865.003641 1.431549 11.016119 -708.59723999 -1875.499055 4.61927134 -#> [2,] 1.431549 20.679817 -6.826283 -29.26097775 -86.321369 -6.13548328 -#> [3,] 11.016119 -6.826283 239.199604 -0.21645901 -71.065641 13.00805966 -#> [4,] -708.597240 -29.260978 -0.216459 2324.34120373 9.770352 0.03523364 -#> [5,] -1875.499055 -86.321369 -71.065641 9.77035192 19083.877564 11.72131703 -#> [6,] 4.619271 -6.135483 13.008060 0.03523364 11.721317 38.85137516 -#> [7,] -4227.062232 -473.560406 716.704415 726.84097215 9656.158553 64.78095548 -#> [8,] -470.162834 -11.193854 36.702955 90.62738594 266.487127 2.94728469 -#> [,7] [,8] -#> [1,] -4227.06223 -470.162834 -#> [2,] -473.56041 -11.193854 -#> [3,] 716.70442 36.702955 -#> [4,] 726.84097 90.627386 -#> [5,] 9656.15855 266.487127 -#> [6,] 64.78096 2.947285 -#> [7,] 192840.20092 6659.569867 -#> [8,] 6659.56987 475.500111 -#>
    -
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/mftot1.html b/docs/reference/mftot1.html deleted file mode 100644 index b6a307af..00000000 --- a/docs/reference/mftot1.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - -The reduced Fisher Information Matrix (FIM) — mftot1 • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Compute the reduced FIM given specific model(s), parameters, design and methods. -This computation assumes that there is no correlation in the FIM between the fixed and random effects, -and set these elements in the FIM to zero.

    - - -
    mftot1(model_switch, groupsize, ni, xt, x, a, bpop, d, sigma, docc, poped.db)
    - -

    Arguments

    -
    -
    model_switch
    -
    A matrix that is the same size as xt, specifying which model each sample belongs to.
    -
    groupsize
    -
    A vector of the numer of individuals in each group.
    -
    ni
    -
    A vector of the number of samples in each group.
    -
    xt
    -
    A matrix of sample times. Each row is a vector of sample times for a group.
    -
    x
    -
    A matrix for the discrete design variables. Each row is a group.
    -
    a
    -
    A matrix of covariates. Each row is a group.
    -
    bpop
    -
    The fixed effects parameter values. Supplied as a vector.
    -
    d
    -
    A between subject variability matrix (OMEGA in NONMEM).
    -
    sigma
    -
    A residual unexplained variability matrix (SIGMA in NONMEM).
    -
    docc
    -
    A between occasion variability matrix.
    -
    poped.db
    -
    A PopED database.
    -
    - -

    Value

    - -

    As a list:

    - -

    See also

    - -

    For an easier function to use, please see evaluate.fim.

    -

    Other FIM: LinMatrixH, - LinMatrixLH, LinMatrixL_occ, - calc_ofv_and_fim, - ed_laplace_ofv, ed_mftot, - efficiency, - evaluate.e.ofv.fim, - evaluate.fim, gradf_eps, - mf3, mf5, mf6, - mf7, mf8, - mftot0, mftot2, - mftot3, mftot4, - mftot5, mftot6, - mftot7, mftot, - mf, ofv_criterion, - ofv_fim

    - - -

    Examples

    -
    library(PopED) - -############# START ################# -## Create PopED database -## (warfarin model for optimization) -##################################### - -## Warfarin example from software comparison in: -## Nyberg et al., "Methods and software tools for design evaluation -## for population pharmacokinetics-pharmacodynamics studies", -## Br. J. Clin. Pharm., 2014. - -## Optimization using an additive + proportional reidual error -## to avoid sample times at very low concentrations (time 0 or very late samples). - -## find the parameters that are needed to define from the structural model -ff.PK.1.comp.oral.sd.CL
    #> function(model_switch,xt,parameters,poped.db){ -#> ##-- Model: One comp first order absorption -#> with(as.list(parameters),{ -#> y=xt -#> y=(DOSE*Favail*KA/(V*(KA-CL/V)))*(exp(-CL/V*xt)-exp(-KA*xt)) -#> return(list( y= y,poped.db=poped.db)) -#> }) -#> } -#> <environment: namespace:PopED>
    -## -- parameter definition function -## -- names match parameters in function ff -sfg <- function(x,a,bpop,b,bocc){ - parameters=c(CL=bpop[1]*exp(b[1]), - V=bpop[2]*exp(b[2]), - KA=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1]) - return(parameters) -} - -## -- Define initial design and design space -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, - fg_fun=sfg, - fError_fun=feps.add.prop, - bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), - notfixed_bpop=c(1,1,1,0), - d=c(CL=0.07, V=0.02, KA=0.6), - sigma=c(0.01,0.25), - groupsize=32, - xt=c( 0.5,1,2,6,24,36,72,120), - minxt=0.01, - maxxt=120, - a=70, - mina=0.01, - maxa=100) - -############# END ################### -## Create PopED database -## (warfarin model for optimization) -##################################### - - -mftot1(model_switch=poped.db$design$model_switch, - groupsize=poped.db$design$groupsize, - ni=poped.db$design$ni, - xt=poped.db$design$xt, - x=poped.db$design$x, - a=poped.db$design$a, - bpop=poped.db$parameters$param.pt.val$bpop, - d=poped.db$parameters$param.pt.val$d, - sigma=poped.db$parameters$sigma, - docc=poped.db$parameters$param.pt.val$docc, - poped.db)["ret"]
    #> $ret -#> [,1] [,2] [,3] [,4] [,5] [,6] -#> [1,] 17141.83891 20.838375 10.011000 0.000000e+00 0.000000 0.00000000 -#> [2,] 20.83837 17.268051 -3.423641 0.000000e+00 0.000000 0.00000000 -#> [3,] 10.01100 -3.423641 49.864697 0.000000e+00 0.000000 0.00000000 -#> [4,] 0.00000 0.000000 0.000000 2.324341e+03 9.770352 0.03523364 -#> [5,] 0.00000 0.000000 0.000000 9.770352e+00 19083.877564 11.72131703 -#> [6,] 0.00000 0.000000 0.000000 3.523364e-02 11.721317 38.85137516 -#> [7,] 0.00000 0.000000 0.000000 7.268410e+02 9656.158553 64.78095548 -#> [8,] 0.00000 0.000000 0.000000 9.062739e+01 266.487127 2.94728469 -#> [,7] [,8] -#> [1,] 0.00000 0.000000 -#> [2,] 0.00000 0.000000 -#> [3,] 0.00000 0.000000 -#> [4,] 726.84097 90.627386 -#> [5,] 9656.15855 266.487127 -#> [6,] 64.78096 2.947285 -#> [7,] 192840.20092 6659.569867 -#> [8,] 6659.56987 475.500111 -#>
    -
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/mftot2.html b/docs/reference/mftot2.html deleted file mode 100644 index 2e816c6b..00000000 --- a/docs/reference/mftot2.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - -The Fisher Information Matrix (FIM) using weighted models — mftot2 • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Compute the FIM using weighted models given specific model(s), parameters, design and methods. Not currently available.

    - - -
    mftot2(model_switch, groupsize, ni, xt, x, a, bpop, d, sigma, docc, poped.db)
    - -

    Arguments

    -
    -
    model_switch
    -
    A matrix that is the same size as xt, specifying which model each sample belongs to.
    -
    groupsize
    -
    A vector of the numer of individuals in each group.
    -
    ni
    -
    A vector of the number of samples in each group.
    -
    xt
    -
    A matrix of sample times. Each row is a vector of sample times for a group.
    -
    x
    -
    A matrix for the discrete design variables. Each row is a group.
    -
    a
    -
    A matrix of covariates. Each row is a group.
    -
    bpop
    -
    The fixed effects parameter values. Supplied as a vector.
    -
    d
    -
    A between subject variability matrix (OMEGA in NONMEM).
    -
    sigma
    -
    A residual unexplained variability matrix (SIGMA in NONMEM).
    -
    docc
    -
    A between occasion variability matrix.
    -
    poped.db
    -
    A PopED database.
    -
    - -

    See also

    - -

    For an easier function to use, please see evaluate.fim.

    -

    Other FIM: LinMatrixH, - LinMatrixLH, LinMatrixL_occ, - calc_ofv_and_fim, - ed_laplace_ofv, ed_mftot, - efficiency, - evaluate.e.ofv.fim, - evaluate.fim, gradf_eps, - mf3, mf5, mf6, - mf7, mf8, - mftot0, mftot1, - mftot3, mftot4, - mftot5, mftot6, - mftot7, mftot, - mf, ofv_criterion, - ofv_fim

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/mftot3.html b/docs/reference/mftot3.html deleted file mode 100644 index f955d6f3..00000000 --- a/docs/reference/mftot3.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - -The Fisher Information Matrix (FIM) some other method — mftot3 • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Compute the FIM using some other method given specific model(s), parameters, design and methods. This is a placeholder.

    - - -
    mftot3(model_switch, groupsize, ni, xt, x, a, bpop, d, sigma, docc, poped.db)
    - -

    Arguments

    -
    -
    model_switch
    -
    A matrix that is the same size as xt, specifying which model each sample belongs to.
    -
    groupsize
    -
    A vector of the numer of individuals in each group.
    -
    ni
    -
    A vector of the number of samples in each group.
    -
    xt
    -
    A matrix of sample times. Each row is a vector of sample times for a group.
    -
    x
    -
    A matrix for the discrete design variables. Each row is a group.
    -
    a
    -
    A matrix of covariates. Each row is a group.
    -
    bpop
    -
    The fixed effects parameter values. Supplied as a vector.
    -
    d
    -
    A between subject variability matrix (OMEGA in NONMEM).
    -
    sigma
    -
    A residual unexplained variability matrix (SIGMA in NONMEM).
    -
    docc
    -
    A between occasion variability matrix.
    -
    poped.db
    -
    A PopED database.
    -
    - -

    See also

    - -

    For an easier function to use, please see evaluate.fim.

    -

    Other FIM: LinMatrixH, - LinMatrixLH, LinMatrixL_occ, - calc_ofv_and_fim, - ed_laplace_ofv, ed_mftot, - efficiency, - evaluate.e.ofv.fim, - evaluate.fim, gradf_eps, - mf3, mf5, mf6, - mf7, mf8, - mftot0, mftot1, - mftot2, mftot4, - mftot5, mftot6, - mftot7, mftot, - mf, ofv_criterion, - ofv_fim

    - - -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/mftot4.html b/docs/reference/mftot4.html deleted file mode 100644 index f47b974e..00000000 --- a/docs/reference/mftot4.html +++ /dev/null @@ -1,263 +0,0 @@ - - - - - - - - -The reduced Fisher Information Matrix (FIM) using the SD of RUV as a parameter. — mftot4 • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Compute the reduced FIM using the standard deviation of the residual unexplained variability (RUV) terms as a parameter, -given specific model(s), parameters, design and methods. -This computation -assumes that there is no correlation in the FIM between the fixed and random effects, -and set these elements in the FIM to zero. -In addition all derivatives in the computation are made -with respect to the standard deviation of the RUV terms (sqrt(SIGMA) in NONMEM). -This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the resudual unexplained variation by default).

    - - -
    mftot4(model_switch, groupsize, ni, xt, x, a, bpop, d, sigma, docc, poped.db)
    - -

    Arguments

    -
    -
    model_switch
    -
    A matrix that is the same size as xt, specifying which model each sample belongs to.
    -
    groupsize
    -
    A vector of the numer of individuals in each group.
    -
    ni
    -
    A vector of the number of samples in each group.
    -
    xt
    -
    A matrix of sample times. Each row is a vector of sample times for a group.
    -
    x
    -
    A matrix for the discrete design variables. Each row is a group.
    -
    a
    -
    A matrix of covariates. Each row is a group.
    -
    bpop
    -
    The fixed effects parameter values. Supplied as a vector.
    -
    d
    -
    A between subject variability matrix (OMEGA in NONMEM).
    -
    sigma
    -
    A residual unexplained variability matrix (SIGMA in NONMEM).
    -
    docc
    -
    A between occasion variability matrix.
    -
    poped.db
    -
    A PopED database.
    -
    - -

    Value

    - -

    As a list:

    - -

    See also

    - -

    For an easier function to use, please see evaluate.fim.

    -

    Other FIM: LinMatrixH, - LinMatrixLH, LinMatrixL_occ, - calc_ofv_and_fim, - ed_laplace_ofv, ed_mftot, - efficiency, - evaluate.e.ofv.fim, - evaluate.fim, gradf_eps, - mf3, mf5, mf6, - mf7, mf8, - mftot0, mftot1, - mftot2, mftot3, - mftot5, mftot6, - mftot7, mftot, - mf, ofv_criterion, - ofv_fim

    - - -

    Examples

    -
    library(PopED) - -############# START ################# -## Create PopED database -## (warfarin model for optimization) -##################################### - -## Warfarin example from software comparison in: -## Nyberg et al., "Methods and software tools for design evaluation -## for population pharmacokinetics-pharmacodynamics studies", -## Br. J. Clin. Pharm., 2014. - -## Optimization using an additive + proportional reidual error -## to avoid sample times at very low concentrations (time 0 or very late samples). - -## find the parameters that are needed to define from the structural model -ff.PK.1.comp.oral.sd.CL
    #> function(model_switch,xt,parameters,poped.db){ -#> ##-- Model: One comp first order absorption -#> with(as.list(parameters),{ -#> y=xt -#> y=(DOSE*Favail*KA/(V*(KA-CL/V)))*(exp(-CL/V*xt)-exp(-KA*xt)) -#> return(list( y= y,poped.db=poped.db)) -#> }) -#> } -#> <environment: namespace:PopED>
    -## -- parameter definition function -## -- names match parameters in function ff -sfg <- function(x,a,bpop,b,bocc){ - parameters=c(CL=bpop[1]*exp(b[1]), - V=bpop[2]*exp(b[2]), - KA=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1]) - return(parameters) -} - -## -- Define initial design and design space -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, - fg_fun=sfg, - fError_fun=feps.add.prop, - bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), - notfixed_bpop=c(1,1,1,0), - d=c(CL=0.07, V=0.02, KA=0.6), - sigma=c(0.01,0.25), - groupsize=32, - xt=c( 0.5,1,2,6,24,36,72,120), - minxt=0.01, - maxxt=120, - a=70, - mina=0.01, - maxa=100) - -############# END ################### -## Create PopED database -## (warfarin model for optimization) -##################################### - - -mftot4(model_switch=poped.db$design$model_switch, - groupsize=poped.db$design$groupsize, - ni=poped.db$design$ni, - xt=poped.db$design$xt, - x=poped.db$design$x, - a=poped.db$design$a, - bpop=poped.db$parameters$param.pt.val$bpop, - d=poped.db$parameters$param.pt.val$d, - sigma=poped.db$parameters$sigma, - docc=poped.db$parameters$param.pt.val$docc, - poped.db)["ret"]
    #> $ret -#> [,1] [,2] [,3] [,4] [,5] [,6] -#> [1,] 17141.83891 20.838375 10.011000 0.000000e+00 0.000000 0.00000000 -#> [2,] 20.83837 17.268051 -3.423641 0.000000e+00 0.000000 0.00000000 -#> [3,] 10.01100 -3.423641 49.864697 0.000000e+00 0.000000 0.00000000 -#> [4,] 0.00000 0.000000 0.000000 2.324341e+03 9.770352 0.03523364 -#> [5,] 0.00000 0.000000 0.000000 9.770352e+00 19083.877564 11.72131703 -#> [6,] 0.00000 0.000000 0.000000 3.523364e-02 11.721317 38.85137516 -#> [7,] 0.00000 0.000000 0.000000 1.453682e+02 1931.231711 12.95619110 -#> [8,] 0.00000 0.000000 0.000000 9.062739e+01 266.487127 2.94728469 -#> [,7] [,8] -#> [1,] 0.00000 0.000000 -#> [2,] 0.00000 0.000000 -#> [3,] 0.00000 0.000000 -#> [4,] 145.36819 90.627386 -#> [5,] 1931.23171 266.487127 -#> [6,] 12.95619 2.947285 -#> [7,] 7713.60804 1331.913973 -#> [8,] 1331.91397 475.500111 -#>
    -
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/mftot5.html b/docs/reference/mftot5.html deleted file mode 100644 index f5e2ac8b..00000000 --- a/docs/reference/mftot5.html +++ /dev/null @@ -1,265 +0,0 @@ - - - - - - - - -The full Fisher Information Matrix (FIM) parameterized with A,B,C matrices & using the derivative of variance. — mftot5 • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Compute the full FIM given specific model(s), parameters, design and methods. -This computation parameterizes the FIM calculation using -A,B,C matrices (as in Retout et al.) but uses the derivative of variances. -Should give the same answer as mftot0 but computation times may be different.

    - - -
    mftot5(model_switch, groupsize, ni, xt, x, a, bpop, d, sigma, docc, poped.db)
    - -

    Arguments

    -
    -
    model_switch
    -
    A matrix that is the same size as xt, specifying which model each sample belongs to.
    -
    groupsize
    -
    A vector of the numer of individuals in each group.
    -
    ni
    -
    A vector of the number of samples in each group.
    -
    xt
    -
    A matrix of sample times. Each row is a vector of sample times for a group.
    -
    x
    -
    A matrix for the discrete design variables. Each row is a group.
    -
    a
    -
    A matrix of covariates. Each row is a group.
    -
    bpop
    -
    The fixed effects parameter values. Supplied as a vector.
    -
    d
    -
    A between subject variability matrix (OMEGA in NONMEM).
    -
    sigma
    -
    A residual unexplained variability matrix (SIGMA in NONMEM).
    -
    docc
    -
    A between occasion variability matrix.
    -
    poped.db
    -
    A PopED database.
    -
    - -

    Value

    - -

    As a list:

    - -

    References

    - -

    S. Retout and F. Mentre, "Further developments of the Fisher Information Matrix in -nonlinear mixed effects models with evaluation in population pharmacokinetics", J. of Biopharm. Stats., 13(2), 2003.

    - -

    See also

    - -

    For an easier function to use, please see evaluate.fim.

    -

    Other FIM: LinMatrixH, - LinMatrixLH, LinMatrixL_occ, - calc_ofv_and_fim, - ed_laplace_ofv, ed_mftot, - efficiency, - evaluate.e.ofv.fim, - evaluate.fim, gradf_eps, - mf3, mf5, mf6, - mf7, mf8, - mftot0, mftot1, - mftot2, mftot3, - mftot4, mftot6, - mftot7, mftot, - mf, ofv_criterion, - ofv_fim

    - - -

    Examples

    -
    library(PopED) - -############# START ################# -## Create PopED database -## (warfarin model for optimization) -##################################### - -## Warfarin example from software comparison in: -## Nyberg et al., "Methods and software tools for design evaluation -## for population pharmacokinetics-pharmacodynamics studies", -## Br. J. Clin. Pharm., 2014. - -## Optimization using an additive + proportional reidual error -## to avoid sample times at very low concentrations (time 0 or very late samples). - -## find the parameters that are needed to define from the structural model -ff.PK.1.comp.oral.sd.CL
    #> function(model_switch,xt,parameters,poped.db){ -#> ##-- Model: One comp first order absorption -#> with(as.list(parameters),{ -#> y=xt -#> y=(DOSE*Favail*KA/(V*(KA-CL/V)))*(exp(-CL/V*xt)-exp(-KA*xt)) -#> return(list( y= y,poped.db=poped.db)) -#> }) -#> } -#> <environment: namespace:PopED>
    -## -- parameter definition function -## -- names match parameters in function ff -sfg <- function(x,a,bpop,b,bocc){ - parameters=c(CL=bpop[1]*exp(b[1]), - V=bpop[2]*exp(b[2]), - KA=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1]) - return(parameters) -} - -## -- Define initial design and design space -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, - fg_fun=sfg, - fError_fun=feps.add.prop, - bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), - notfixed_bpop=c(1,1,1,0), - d=c(CL=0.07, V=0.02, KA=0.6), - sigma=c(0.01,0.25), - groupsize=32, - xt=c( 0.5,1,2,6,24,36,72,120), - minxt=0.01, - maxxt=120, - a=70, - mina=0.01, - maxa=100) - -############# END ################### -## Create PopED database -## (warfarin model for optimization) -##################################### - - -mftot5(model_switch=poped.db$design$model_switch, - groupsize=poped.db$design$groupsize, - ni=poped.db$design$ni, - xt=poped.db$design$xt, - x=poped.db$design$x, - a=poped.db$design$a, - bpop=poped.db$parameters$param.pt.val$bpop, - d=poped.db$parameters$param.pt.val$d, - sigma=poped.db$parameters$sigma, - docc=poped.db$parameters$param.pt.val$docc, - poped.db)["ret"]
    #> $ret -#> [,1] [,2] [,3] [,4] [,5] [,6] -#> [1,] 19865.003641 1.431549 11.016119 -708.59723999 -1875.499055 4.61927134 -#> [2,] 1.431549 20.679817 -6.826283 -29.26097775 -86.321369 -6.13548328 -#> [3,] 11.016119 -6.826283 239.199604 -0.21645901 -71.065641 13.00805966 -#> [4,] -708.597240 -29.260978 -0.216459 2324.34120373 9.770352 0.03523364 -#> [5,] -1875.499055 -86.321369 -71.065641 9.77035192 19083.877564 11.72131703 -#> [6,] 4.619271 -6.135483 13.008060 0.03523364 11.721317 38.85137516 -#> [7,] -4227.062232 -473.560406 716.704415 726.84097215 9656.158553 64.78095548 -#> [8,] -470.162834 -11.193854 36.702955 90.62738594 266.487127 2.94728469 -#> [,7] [,8] -#> [1,] -4227.06223 -470.162834 -#> [2,] -473.56041 -11.193854 -#> [3,] 716.70442 36.702955 -#> [4,] 726.84097 90.627386 -#> [5,] 9656.15855 266.487127 -#> [6,] 64.78096 2.947285 -#> [7,] 192840.20092 6659.569867 -#> [8,] 6659.56987 475.500111 -#>
    -
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/mftot6.html b/docs/reference/mftot6.html deleted file mode 100644 index f596362f..00000000 --- a/docs/reference/mftot6.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - -The full Fisher Information Matrix (FIM) Calculating one model switch at a time, good for large matrices. — mftot6 • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Compute the full FIM given specific model(s), parameters, design and methods. -This computation calculates the FIM for each model switch separately. Correlations between the models parameters are assumed to be zero.

    - - -
    mftot6(model_switch, groupsize, ni, xt, x, a, bpop, d, sigma, docc, poped.db)
    - -

    Arguments

    -
    -
    model_switch
    -
    A matrix that is the same size as xt, specifying which model each sample belongs to.
    -
    groupsize
    -
    A vector of the numer of individuals in each group.
    -
    ni
    -
    A vector of the number of samples in each group.
    -
    xt
    -
    A matrix of sample times. Each row is a vector of sample times for a group.
    -
    x
    -
    A matrix for the discrete design variables. Each row is a group.
    -
    a
    -
    A matrix of covariates. Each row is a group.
    -
    bpop
    -
    The fixed effects parameter values. Supplied as a vector.
    -
    d
    -
    A between subject variability matrix (OMEGA in NONMEM).
    -
    sigma
    -
    A residual unexplained variability matrix (SIGMA in NONMEM).
    -
    docc
    -
    A between occasion variability matrix.
    -
    poped.db
    -
    A PopED database.
    -
    - -

    Value

    - -

    As a list:

    - -

    See also

    - -

    For an easier function to use, please see evaluate.fim.

    -

    Other FIM: LinMatrixH, - LinMatrixLH, LinMatrixL_occ, - calc_ofv_and_fim, - ed_laplace_ofv, ed_mftot, - efficiency, - evaluate.e.ofv.fim, - evaluate.fim, gradf_eps, - mf3, mf5, mf6, - mf7, mf8, - mftot0, mftot1, - mftot2, mftot3, - mftot4, mftot5, - mftot7, mftot, - mf, ofv_criterion, - ofv_fim

    - - -

    Examples

    -
    library(PopED) - -############# START ################# -## Create PopED database -## (warfarin model for optimization) -##################################### - -## Warfarin example from software comparison in: -## Nyberg et al., "Methods and software tools for design evaluation -## for population pharmacokinetics-pharmacodynamics studies", -## Br. J. Clin. Pharm., 2014. - -## Optimization using an additive + proportional reidual error -## to avoid sample times at very low concentrations (time 0 or very late samples). - -## find the parameters that are needed to define from the structural model -ff.PK.1.comp.oral.sd.CL
    #> function(model_switch,xt,parameters,poped.db){ -#> ##-- Model: One comp first order absorption -#> with(as.list(parameters),{ -#> y=xt -#> y=(DOSE*Favail*KA/(V*(KA-CL/V)))*(exp(-CL/V*xt)-exp(-KA*xt)) -#> return(list( y= y,poped.db=poped.db)) -#> }) -#> } -#> <environment: namespace:PopED>
    -## -- parameter definition function -## -- names match parameters in function ff -sfg <- function(x,a,bpop,b,bocc){ - parameters=c(CL=bpop[1]*exp(b[1]), - V=bpop[2]*exp(b[2]), - KA=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1]) - return(parameters) -} - -## -- Define initial design and design space -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, - fg_fun=sfg, - fError_fun=feps.add.prop, - bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), - notfixed_bpop=c(1,1,1,0), - d=c(CL=0.07, V=0.02, KA=0.6), - sigma=c(0.01,0.25), - groupsize=32, - xt=c( 0.5,1,2,6,24,36,72,120), - minxt=0.01, - maxxt=120, - a=70, - mina=0.01, - maxa=100) - -############# END ################### -## Create PopED database -## (warfarin model for optimization) -##################################### - - -mftot6(model_switch=poped.db$design$model_switch, - groupsize=poped.db$design$groupsize, - ni=poped.db$design$ni, - xt=poped.db$design$xt, - x=poped.db$design$x, - a=poped.db$design$a, - bpop=poped.db$parameters$param.pt.val$bpop, - d=poped.db$parameters$param.pt.val$d, - sigma=poped.db$parameters$sigma, - docc=poped.db$parameters$param.pt.val$docc, - poped.db)["ret"]
    #> $ret -#> [,1] [,2] [,3] [,4] [,5] [,6] -#> [1,] 19865.003641 1.431549 11.016119 -708.59723999 -1875.499055 4.61927134 -#> [2,] 1.431549 20.679817 -6.826283 -29.26097775 -86.321369 -6.13548328 -#> [3,] 11.016119 -6.826283 239.199604 -0.21645901 -71.065641 13.00805966 -#> [4,] -708.597240 -29.260978 -0.216459 2324.34120373 9.770352 0.03523364 -#> [5,] -1875.499055 -86.321369 -71.065641 9.77035192 19083.877564 11.72131703 -#> [6,] 4.619271 -6.135483 13.008060 0.03523364 11.721317 38.85137516 -#> [7,] -4227.062232 -473.560406 716.704415 726.84097215 9656.158553 64.78095548 -#> [8,] -470.162834 -11.193854 36.702955 90.62738594 266.487127 2.94728469 -#> [,7] [,8] -#> [1,] -4227.06223 -470.162834 -#> [2,] -473.56041 -11.193854 -#> [3,] 716.70442 36.702955 -#> [4,] 726.84097 90.627386 -#> [5,] 9656.15855 266.487127 -#> [6,] 64.78096 2.947285 -#> [7,] 192840.20092 6659.569867 -#> [8,] 6659.56987 475.500111 -#>
    -
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/mftot7.html b/docs/reference/mftot7.html deleted file mode 100644 index c1c4637c..00000000 --- a/docs/reference/mftot7.html +++ /dev/null @@ -1,267 +0,0 @@ - - - - - - - - -The reduced Fisher Information Matrix (FIM) parameterized with A,B,C matrices & using the derivative of variance. — mftot7 • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Compute the reduced FIM given specific model(s), parameters, design and methods. -This computation assumes that there is no correlation in the FIM between the fixed and random effects, -and set these elements in the FIM to zero. -This computation parameterizes the FIM calculation using -A,B,C matrices (as in Retout et al.) but uses the derivative of variances. -Should give the same answer as mftot1 but computation times may be different.

    - - -
    mftot7(model_switch, groupsize, ni, xt, x, a, bpop, d, sigma, docc, poped.db)
    - -

    Arguments

    -
    -
    model_switch
    -
    A matrix that is the same size as xt, specifying which model each sample belongs to.
    -
    groupsize
    -
    A vector of the numer of individuals in each group.
    -
    ni
    -
    A vector of the number of samples in each group.
    -
    xt
    -
    A matrix of sample times. Each row is a vector of sample times for a group.
    -
    x
    -
    A matrix for the discrete design variables. Each row is a group.
    -
    a
    -
    A matrix of covariates. Each row is a group.
    -
    bpop
    -
    The fixed effects parameter values. Supplied as a vector.
    -
    d
    -
    A between subject variability matrix (OMEGA in NONMEM).
    -
    sigma
    -
    A residual unexplained variability matrix (SIGMA in NONMEM).
    -
    docc
    -
    A between occasion variability matrix.
    -
    poped.db
    -
    A PopED database.
    -
    - -

    Value

    - -

    As a list:

    - -

    References

    - -

    S. Retout and F. Mentre, "Further developments of the Fisher Information Matrix in -nonlinear mixed effects models with evaluation in population pharmacokinetics", J. of Biopharm. Stats., 13(2), 2003.

    - -

    See also

    - -

    For an easier function to use, please see evaluate.fim.

    -

    Other FIM: LinMatrixH, - LinMatrixLH, LinMatrixL_occ, - calc_ofv_and_fim, - ed_laplace_ofv, ed_mftot, - efficiency, - evaluate.e.ofv.fim, - evaluate.fim, gradf_eps, - mf3, mf5, mf6, - mf7, mf8, - mftot0, mftot1, - mftot2, mftot3, - mftot4, mftot5, - mftot6, mftot, - mf, ofv_criterion, - ofv_fim

    - - -

    Examples

    -
    library(PopED) - -############# START ################# -## Create PopED database -## (warfarin model for optimization) -##################################### - -## Warfarin example from software comparison in: -## Nyberg et al., "Methods and software tools for design evaluation -## for population pharmacokinetics-pharmacodynamics studies", -## Br. J. Clin. Pharm., 2014. - -## Optimization using an additive + proportional reidual error -## to avoid sample times at very low concentrations (time 0 or very late samples). - -## find the parameters that are needed to define from the structural model -ff.PK.1.comp.oral.sd.CL
    #> function(model_switch,xt,parameters,poped.db){ -#> ##-- Model: One comp first order absorption -#> with(as.list(parameters),{ -#> y=xt -#> y=(DOSE*Favail*KA/(V*(KA-CL/V)))*(exp(-CL/V*xt)-exp(-KA*xt)) -#> return(list( y= y,poped.db=poped.db)) -#> }) -#> } -#> <environment: namespace:PopED>
    -## -- parameter definition function -## -- names match parameters in function ff -sfg <- function(x,a,bpop,b,bocc){ - parameters=c(CL=bpop[1]*exp(b[1]), - V=bpop[2]*exp(b[2]), - KA=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1]) - return(parameters) -} - -## -- Define initial design and design space -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, - fg_fun=sfg, - fError_fun=feps.add.prop, - bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), - notfixed_bpop=c(1,1,1,0), - d=c(CL=0.07, V=0.02, KA=0.6), - sigma=c(0.01,0.25), - groupsize=32, - xt=c( 0.5,1,2,6,24,36,72,120), - minxt=0.01, - maxxt=120, - a=70, - mina=0.01, - maxa=100) - -############# END ################### -## Create PopED database -## (warfarin model for optimization) -##################################### - - -mftot7(model_switch=poped.db$design$model_switch, - groupsize=poped.db$design$groupsize, - ni=poped.db$design$ni, - xt=poped.db$design$xt, - x=poped.db$design$x, - a=poped.db$design$a, - bpop=poped.db$parameters$param.pt.val$bpop, - d=poped.db$parameters$param.pt.val$d, - sigma=poped.db$parameters$sigma, - docc=poped.db$parameters$param.pt.val$docc, - poped.db)["ret"]
    #> $ret -#> [,1] [,2] [,3] [,4] [,5] [,6] -#> [1,] 17141.83891 20.838375 10.011000 0.000000e+00 0.000000 0.00000000 -#> [2,] 20.83837 17.268051 -3.423641 0.000000e+00 0.000000 0.00000000 -#> [3,] 10.01100 -3.423641 49.864697 0.000000e+00 0.000000 0.00000000 -#> [4,] 0.00000 0.000000 0.000000 2.324341e+03 9.770352 0.03523364 -#> [5,] 0.00000 0.000000 0.000000 9.770352e+00 19083.877564 11.72131703 -#> [6,] 0.00000 0.000000 0.000000 3.523364e-02 11.721317 38.85137516 -#> [7,] 0.00000 0.000000 0.000000 7.268410e+02 9656.158553 64.78095548 -#> [8,] 0.00000 0.000000 0.000000 9.062739e+01 266.487127 2.94728469 -#> [,7] [,8] -#> [1,] 0.00000 0.000000 -#> [2,] 0.00000 0.000000 -#> [3,] 0.00000 0.000000 -#> [4,] 726.84097 90.627386 -#> [5,] 9656.15855 266.487127 -#> [6,] 64.78096 2.947285 -#> [7,] 192840.20092 6659.569867 -#> [8,] 6659.56987 475.500111 -#>
    -
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/model_prediction.html b/docs/reference/model_prediction.html deleted file mode 100644 index 85e7c787..00000000 --- a/docs/reference/model_prediction.html +++ /dev/null @@ -1,1856 +0,0 @@ - -Model predictions — model_prediction • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Function generates a data frame of model predictions for the typical value in the population, -individual predictions and data predictions. The function can also be used to generate datasets -without predictions using the design specified in the arguments.

    -
    - -
    -
    model_prediction(
    -  poped.db = NULL,
    -  design = list(xt = poped.db$design[["xt"]], groupsize = poped.db$design$groupsize, m =
    -    poped.db$design[["m"]], x = poped.db$design[["x"]], a = poped.db$design[["a"]], ni =
    -    poped.db$design$ni, model_switch = poped.db$design$model_switch),
    -  model = list(fg_pointer = poped.db$model$fg_pointer, ff_pointer =
    -    poped.db$model$ff_pointer, ferror_pointer = poped.db$model$ferror_pointer),
    -  parameters = list(docc = poped.db$parameters$docc, d = poped.db$parameters$d, bpop =
    -    poped.db$parameters$bpop, covd = poped.db$parameters$covd, covdocc =
    -    poped.db$parameters$covdocc, sigma = poped.db$parameters$sigma),
    -  IPRED = FALSE,
    -  DV = FALSE,
    -  dosing = NULL,
    -  predictions = NULL,
    -  filename = NULL,
    -  models_to_use = "all",
    -  model_num_points = NULL,
    -  model_minxt = NULL,
    -  model_maxxt = NULL,
    -  include_sample_times = T,
    -  groups_to_use = "all",
    -  include_a = TRUE,
    -  include_x = TRUE,
    -  manipulation = NULL,
    -  PI = FALSE,
    -  PI_conf_level = 0.95,
    -  PI_ln_dist = TRUE
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database created by create.poped.database.

    - - -
    design
    -

    A list that is passed as arguments to the function create_design to create a design object.

    - - -
    model
    -

    A list containing the model elements to use for the predictions

    - - -
    parameters
    -

    A list of parameters to use in the model predictions.

    - - -
    IPRED
    -

    Should we simulate individual predictions?

    - - -
    DV
    -

    should we simulate observations?

    - - -
    dosing
    -

    A list of lists that adds dosing records to the data frame (Each inner list corresponding to a group in the design).

    - - -
    predictions
    -

    Should the resulting data frame have predictions? Either TRUE or FALSE -or NULL in which case the function decides based on other arguments.

    - - -
    filename
    -

    A filename that the data frame should be written to in comma separate value (csv) format.

    - - -
    models_to_use
    -

    Which model numbers should we use? -Model numbers are defined in design below using model_switch. For an explanation see create_design.

    - - -
    model_num_points
    -

    How many extra observation rows should be created in the data frame for each group or individual -per model. If used then the points are placed evenly between model_minxt and model_maxxt. This option -is used by plot_model_prediction to simulate the response of the model on a finer grid then the defined design. -If NULL then only the input design is used. Can be a single value or a vector the same length as the number of models.

    - - -
    model_minxt
    -

    The minimum time value for extra observation rows indicated by model_num_points. -A vector the same length as the number of models

    - - -
    model_maxxt
    -

    The minimum time value for extra observation rows indicated by model_num_points. -A vector the same length as the number of models

    - - -
    include_sample_times
    -

    Should observations rows in the output data frame include the times indicated in the input design?

    - - -
    groups_to_use
    -

    Which groups should we include in the output data frame?Allowed values are "all" or -a vector of numbers indicating the groups to include, e.g. c(1,3,6).

    - - -
    include_a
    -

    Should we include the continuous design variables in the output?

    - - -
    include_x
    -

    Should we include the discrete design variables in the output?

    - - -
    manipulation
    -

    A list of one or more expression arguments. Each expression is -evaluated using the code for(i in 1:length(manipulation)){df <- within(df,{eval(manipulation[[i]])})}. -Can be used to transform -or create new columns in the resulting data frame. Note that these transformations are created after any model predictions occur, -so transformations in columns having to do with input to model predictions will not affect the predictions.

    - - -
    PI
    -

    Compute prediction intervals for the data given the model. Predictions are based on first-order approximations to -the model variance and a log-normality assumption of that variance (by default), if all predictions are positive, otherwise a -normal distribution is assumed.

    - - -
    PI_conf_level
    -

    The confidence level for the prediction interval computed.

    - - -
    PI_ln_dist
    -

    Should the PI calculation be done assuming log-normal or a normal distribution. TRUE is the default and -indicates a log-normal distribution. If any of the PRED values from the model are negative then a normal distribution is -assumed.

    - -
    -
    -

    Value

    - - -

    A dataframe containing a design and (potentially) simulated data with some dense grid of samples and/or -based on the input design.

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    ## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -library(PopED)
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.md.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         N = floor(xt/TAU) + 1
    -#>         y = (DOSE * Favail/V) * (KA/(KA - CL/V)) * (exp(-CL/V * 
    -#>             (xt - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - 
    -#>             exp(-CL/V * TAU)) - exp(-KA * (xt - (N - 1) * TAU)) * 
    -#>             (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU)))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1104c9b70>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -    return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=0.01,
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0,
    -                                  maxxt=120,
    -                                  a=70)
    -
    -## data frame with model predictions
    -df_1 <- model_prediction(poped.db)
    -head(df_1,n=20)
    -#>    Time      PRED Group Model a_i
    -#> 1   0.5 3.4254357     1     1  70
    -#> 2   1.0 5.4711041     1     1  70
    -#> 3   2.0 7.3821834     1     1  70
    -#> 4   6.0 7.9462805     1     1  70
    -#> 5  24.0 5.6858561     1     1  70
    -#> 6  36.0 4.5402483     1     1  70
    -#> 7  72.0 2.3116966     1     1  70
    -#> 8 120.0 0.9398657     1     1  70
    -
    -##  data frame with variability 
    -df_2 <- model_prediction(poped.db,DV=TRUE)
    -head(df_2,n=20)
    -#>    ID  Time       DV    IPRED      PRED Group Model a_i
    -#> 1   1   0.5 3.273208 3.363554 3.4254357     1     1  70
    -#> 2   1   1.0 4.925244 5.366761 5.4711041     1     1  70
    -#> 3   1   2.0 7.196765 7.233603 7.3821834     1     1  70
    -#> 4   1   6.0 7.146286 7.807924 7.9462805     1     1  70
    -#> 5   1  24.0 6.701808 5.727427 5.6858561     1     1  70
    -#> 6   1  36.0 3.576081 4.650296 4.5402483     1     1  70
    -#> 7   1  72.0 2.280191 2.489108 2.3116966     1     1  70
    -#> 8   1 120.0 1.003259 1.081753 0.9398657     1     1  70
    -#> 9   2   0.5 2.813017 2.913682 3.4254357     1     1  70
    -#> 10  2   1.0 5.025580 4.786920 5.4711041     1     1  70
    -#> 11  2   2.0 6.092136 6.737522 7.3821834     1     1  70
    -#> 12  2   6.0 7.434007 7.688839 7.9462805     1     1  70
    -#> 13  2  24.0 4.624765 5.714743 5.6858561     1     1  70
    -#> 14  2  36.0 4.353947 4.668906 4.5402483     1     1  70
    -#> 15  2  72.0 2.297259 2.546071 2.3116966     1     1  70
    -#> 16  2 120.0 1.011634 1.134343 0.9398657     1     1  70
    -#> 17  3   0.5 1.945226 2.161844 3.4254357     1     1  70
    -#> 18  3   1.0 3.679038 3.680427 5.4711041     1     1  70
    -#> 19  3   2.0 4.991466 5.486561 7.3821834     1     1  70
    -#> 20  3   6.0 7.361465 6.976866 7.9462805     1     1  70
    -
    -## data frame with variability (only IPRED, no DV)
    -df_3 <- model_prediction(poped.db,IPRED=TRUE)
    -head(df_3,n=20)
    -#>    ID  Time     IPRED      PRED Group Model a_i
    -#> 1   1   0.5 2.4094357 3.4254357     1     1  70
    -#> 2   1   1.0 4.2546116 5.4711041     1     1  70
    -#> 3   1   2.0 6.7306305 7.3821834     1     1  70
    -#> 4   1   6.0 9.4340164 7.9462805     1     1  70
    -#> 5   1  24.0 6.9288565 5.6858561     1     1  70
    -#> 6   1  36.0 5.4365627 4.5402483     1     1  70
    -#> 7   1  72.0 2.6260445 2.3116966     1     1  70
    -#> 8   1 120.0 0.9952656 0.9398657     1     1  70
    -#> 9   2   0.5 1.8181102 3.4254357     1     1  70
    -#> 10  2   1.0 3.2312714 5.4711041     1     1  70
    -#> 11  2   2.0 5.1743526 7.3821834     1     1  70
    -#> 12  2   6.0 7.5504514 7.9462805     1     1  70
    -#> 13  2  24.0 6.3388270 5.6858561     1     1  70
    -#> 14  2  36.0 5.4205265 4.5402483     1     1  70
    -#> 15  2  72.0 3.3894121 2.3116966     1     1  70
    -#> 16  2 120.0 1.8123201 0.9398657     1     1  70
    -#> 17  3   0.5 0.7018305 3.4254357     1     1  70
    -#> 18  3   1.0 1.3365014 5.4711041     1     1  70
    -#> 19  3   2.0 2.4276238 7.3821834     1     1  70
    -#> 20  3   6.0 5.0715504 7.9462805     1     1  70
    -
    -## data frame with model predictions, no continuous design variables in data frame
    -df_4 <- model_prediction(poped.db,include_a = FALSE)
    -head(df_4,n=20)
    -#>    Time      PRED Group Model
    -#> 1   0.5 3.4254357     1     1
    -#> 2   1.0 5.4711041     1     1
    -#> 3   2.0 7.3821834     1     1
    -#> 4   6.0 7.9462805     1     1
    -#> 5  24.0 5.6858561     1     1
    -#> 6  36.0 4.5402483     1     1
    -#> 7  72.0 2.3116966     1     1
    -#> 8 120.0 0.9398657     1     1
    -
    -## -- 2 groups
    -poped.db.2 <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                    fg_fun=sfg,
    -                                    fError_fun=feps.prop,
    -                                    bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                    notfixed_bpop=c(1,1,1,0),
    -                                    d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                    sigma=0.01,
    -                                    groupsize=rbind(3,3),
    -                                    m=2,
    -                                    xt=c( 0.5,1,2,6,24,36,72,120),
    -                                    minxt=0,
    -                                    maxxt=120,
    -                                    a=rbind(70,50))
    -
    -df_5 <- model_prediction(poped.db.2,DV=TRUE)
    -head(df_5,n=20)
    -#>    ID  Time        DV     IPRED      PRED Group Model a_i
    -#> 1   1   0.5 4.8267134 5.2962007 3.4254357     1     1  70
    -#> 2   1   1.0 7.2429516 7.7283651 5.4711041     1     1  70
    -#> 3   1   2.0 9.4324183 9.2935117 7.3821834     1     1  70
    -#> 4   1   6.0 8.5338344 9.1750629 7.9462805     1     1  70
    -#> 5   1  24.0 7.3124022 6.9085487 5.6858561     1     1  70
    -#> 6   1  36.0 5.9028504 5.7174760 4.5402483     1     1  70
    -#> 7   1  72.0 3.5444716 3.2408352 2.3116966     1     1  70
    -#> 8   1 120.0 1.5138498 1.5202922 0.9398657     1     1  70
    -#> 9   2   0.5 2.5840091 2.7763962 3.4254357     1     1  70
    -#> 10  2   1.0 3.6425586 4.6537822 5.4711041     1     1  70
    -#> 11  2   2.0 5.7065338 6.7515213 7.3821834     1     1  70
    -#> 12  2   6.0 6.4834592 7.9850029 7.9462805     1     1  70
    -#> 13  2  24.0 5.6318378 5.5624196 5.6858561     1     1  70
    -#> 14  2  36.0 4.6277194 4.3348244 4.5402483     1     1  70
    -#> 15  2  72.0 2.0872410 2.0516098 2.3116966     1     1  70
    -#> 16  2 120.0 0.7747501 0.7567035 0.9398657     1     1  70
    -#> 17  3   0.5 2.5020473 2.3727827 3.4254357     1     1  70
    -#> 18  3   1.0 4.2426113 4.0803712 5.4711041     1     1  70
    -#> 19  3   2.0 6.4726439 6.1728475 7.3821834     1     1  70
    -#> 20  3   6.0 8.2993452 7.8958656 7.9462805     1     1  70
    -
    -## without a poped database, just describing the design
    -## Useful for creating datasets for use in other software (like NONMEM)
    -design_1 <- list(
    -  xt=c( 0.5,1,2,6,24,36,72,120),
    -  m=2,
    -  groupsize=3)
    -
    -design_2 <- list(
    -  xt=c( 0.5,1,2,6,24,36,72,120),
    -  m=2,
    -  groupsize=3,
    -  a=c(WT=70,AGE=50))
    -
    -design_3 <- list(
    -  xt=c( 0.5,1,2,6,24,36,72,120),
    -  m=2,
    -  groupsize=3,
    -  a=list(c(WT=70,AGE=50),c(AGE=45,WT=60)))
    -
    -(df_6 <- model_prediction(design=design_1))
    -#>     Time PRED Group Model
    -#> 1    0.5   NA     1     1
    -#> 2    1.0   NA     1     1
    -#> 3    2.0   NA     1     1
    -#> 4    6.0   NA     1     1
    -#> 5   24.0   NA     1     1
    -#> 6   36.0   NA     1     1
    -#> 7   72.0   NA     1     1
    -#> 8  120.0   NA     1     1
    -#> 9    0.5   NA     2     1
    -#> 10   1.0   NA     2     1
    -#> 11   2.0   NA     2     1
    -#> 12   6.0   NA     2     1
    -#> 13  24.0   NA     2     1
    -#> 14  36.0   NA     2     1
    -#> 15  72.0   NA     2     1
    -#> 16 120.0   NA     2     1
    -(df_7 <- model_prediction(design=design_2))
    -#>     Time PRED Group Model WT AGE
    -#> 1    0.5   NA     1     1 70  50
    -#> 2    1.0   NA     1     1 70  50
    -#> 3    2.0   NA     1     1 70  50
    -#> 4    6.0   NA     1     1 70  50
    -#> 5   24.0   NA     1     1 70  50
    -#> 6   36.0   NA     1     1 70  50
    -#> 7   72.0   NA     1     1 70  50
    -#> 8  120.0   NA     1     1 70  50
    -#> 9    0.5   NA     2     1 70  50
    -#> 10   1.0   NA     2     1 70  50
    -#> 11   2.0   NA     2     1 70  50
    -#> 12   6.0   NA     2     1 70  50
    -#> 13  24.0   NA     2     1 70  50
    -#> 14  36.0   NA     2     1 70  50
    -#> 15  72.0   NA     2     1 70  50
    -#> 16 120.0   NA     2     1 70  50
    -(df_8 <- model_prediction(design=design_3))
    -#>     Time PRED Group Model WT AGE
    -#> 1    0.5   NA     1     1 70  50
    -#> 2    1.0   NA     1     1 70  50
    -#> 3    2.0   NA     1     1 70  50
    -#> 4    6.0   NA     1     1 70  50
    -#> 5   24.0   NA     1     1 70  50
    -#> 6   36.0   NA     1     1 70  50
    -#> 7   72.0   NA     1     1 70  50
    -#> 8  120.0   NA     1     1 70  50
    -#> 9    0.5   NA     2     1 60  45
    -#> 10   1.0   NA     2     1 60  45
    -#> 11   2.0   NA     2     1 60  45
    -#> 12   6.0   NA     2     1 60  45
    -#> 13  24.0   NA     2     1 60  45
    -#> 14  36.0   NA     2     1 60  45
    -#> 15  72.0   NA     2     1 60  45
    -#> 16 120.0   NA     2     1 60  45
    -(df_9 <- model_prediction(design=design_3,DV=TRUE))
    -#>    ID  Time DV IPRED PRED Group Model WT AGE
    -#> 1   1   0.5 NA    NA   NA     1     1 70  50
    -#> 2   1   1.0 NA    NA   NA     1     1 70  50
    -#> 3   1   2.0 NA    NA   NA     1     1 70  50
    -#> 4   1   6.0 NA    NA   NA     1     1 70  50
    -#> 5   1  24.0 NA    NA   NA     1     1 70  50
    -#> 6   1  36.0 NA    NA   NA     1     1 70  50
    -#> 7   1  72.0 NA    NA   NA     1     1 70  50
    -#> 8   1 120.0 NA    NA   NA     1     1 70  50
    -#> 9   2   0.5 NA    NA   NA     1     1 70  50
    -#> 10  2   1.0 NA    NA   NA     1     1 70  50
    -#> 11  2   2.0 NA    NA   NA     1     1 70  50
    -#> 12  2   6.0 NA    NA   NA     1     1 70  50
    -#> 13  2  24.0 NA    NA   NA     1     1 70  50
    -#> 14  2  36.0 NA    NA   NA     1     1 70  50
    -#> 15  2  72.0 NA    NA   NA     1     1 70  50
    -#> 16  2 120.0 NA    NA   NA     1     1 70  50
    -#> 17  3   0.5 NA    NA   NA     1     1 70  50
    -#> 18  3   1.0 NA    NA   NA     1     1 70  50
    -#> 19  3   2.0 NA    NA   NA     1     1 70  50
    -#> 20  3   6.0 NA    NA   NA     1     1 70  50
    -#> 21  3  24.0 NA    NA   NA     1     1 70  50
    -#> 22  3  36.0 NA    NA   NA     1     1 70  50
    -#> 23  3  72.0 NA    NA   NA     1     1 70  50
    -#> 24  3 120.0 NA    NA   NA     1     1 70  50
    -#> 25  4   0.5 NA    NA   NA     2     1 60  45
    -#> 26  4   1.0 NA    NA   NA     2     1 60  45
    -#> 27  4   2.0 NA    NA   NA     2     1 60  45
    -#> 28  4   6.0 NA    NA   NA     2     1 60  45
    -#> 29  4  24.0 NA    NA   NA     2     1 60  45
    -#> 30  4  36.0 NA    NA   NA     2     1 60  45
    -#> 31  4  72.0 NA    NA   NA     2     1 60  45
    -#> 32  4 120.0 NA    NA   NA     2     1 60  45
    -#> 33  5   0.5 NA    NA   NA     2     1 60  45
    -#> 34  5   1.0 NA    NA   NA     2     1 60  45
    -#> 35  5   2.0 NA    NA   NA     2     1 60  45
    -#> 36  5   6.0 NA    NA   NA     2     1 60  45
    -#> 37  5  24.0 NA    NA   NA     2     1 60  45
    -#> 38  5  36.0 NA    NA   NA     2     1 60  45
    -#> 39  5  72.0 NA    NA   NA     2     1 60  45
    -#> 40  5 120.0 NA    NA   NA     2     1 60  45
    -#> 41  6   0.5 NA    NA   NA     2     1 60  45
    -#> 42  6   1.0 NA    NA   NA     2     1 60  45
    -#> 43  6   2.0 NA    NA   NA     2     1 60  45
    -#> 44  6   6.0 NA    NA   NA     2     1 60  45
    -#> 45  6  24.0 NA    NA   NA     2     1 60  45
    -#> 46  6  36.0 NA    NA   NA     2     1 60  45
    -#> 47  6  72.0 NA    NA   NA     2     1 60  45
    -#> 48  6 120.0 NA    NA   NA     2     1 60  45
    -
    -# generate random deviations in WT for each individual
    -df_10 <- model_prediction(design=design_3,DV=TRUE,
    -                          manipulation=expression({for(id in unique(ID)) 
    -                              WT[ID==id] = rnorm(1,WT[ID==id],WT[ID==id]*0.1);id <- NULL}))
    -head(df_10,n=20)
    -#>    ID  Time DV IPRED PRED Group Model       WT AGE
    -#> 1   1   0.5 NA    NA   NA     1     1 70.11811  50
    -#> 2   1   1.0 NA    NA   NA     1     1 70.11811  50
    -#> 3   1   2.0 NA    NA   NA     1     1 70.11811  50
    -#> 4   1   6.0 NA    NA   NA     1     1 70.11811  50
    -#> 5   1  24.0 NA    NA   NA     1     1 70.11811  50
    -#> 6   1  36.0 NA    NA   NA     1     1 70.11811  50
    -#> 7   1  72.0 NA    NA   NA     1     1 70.11811  50
    -#> 8   1 120.0 NA    NA   NA     1     1 70.11811  50
    -#> 9   2   0.5 NA    NA   NA     1     1 55.95341  50
    -#> 10  2   1.0 NA    NA   NA     1     1 55.95341  50
    -#> 11  2   2.0 NA    NA   NA     1     1 55.95341  50
    -#> 12  2   6.0 NA    NA   NA     1     1 55.95341  50
    -#> 13  2  24.0 NA    NA   NA     1     1 55.95341  50
    -#> 14  2  36.0 NA    NA   NA     1     1 55.95341  50
    -#> 15  2  72.0 NA    NA   NA     1     1 55.95341  50
    -#> 16  2 120.0 NA    NA   NA     1     1 55.95341  50
    -#> 17  3   0.5 NA    NA   NA     1     1 67.63716  50
    -#> 18  3   1.0 NA    NA   NA     1     1 67.63716  50
    -#> 19  3   2.0 NA    NA   NA     1     1 67.63716  50
    -#> 20  3   6.0 NA    NA   NA     1     1 67.63716  50
    -
    -# generate random deviations in WT and AGE for each individual
    -df_11 <- model_prediction(design=design_3,DV=TRUE,
    -                          manipulation=list(
    -                            expression(for(id in unique(ID)) 
    -                              WT[ID==id] = rnorm(1,WT[ID==id],WT[ID==id]*0.1)),
    -                            expression(for(id in unique(ID)) 
    -                              AGE[ID==id] = rnorm(1,AGE[ID==id],AGE[ID==id]*0.2)),
    -                            expression(id <- NULL)
    -                          ))
    -head(df_10,n=20)
    -#>    ID  Time DV IPRED PRED Group Model       WT AGE
    -#> 1   1   0.5 NA    NA   NA     1     1 70.11811  50
    -#> 2   1   1.0 NA    NA   NA     1     1 70.11811  50
    -#> 3   1   2.0 NA    NA   NA     1     1 70.11811  50
    -#> 4   1   6.0 NA    NA   NA     1     1 70.11811  50
    -#> 5   1  24.0 NA    NA   NA     1     1 70.11811  50
    -#> 6   1  36.0 NA    NA   NA     1     1 70.11811  50
    -#> 7   1  72.0 NA    NA   NA     1     1 70.11811  50
    -#> 8   1 120.0 NA    NA   NA     1     1 70.11811  50
    -#> 9   2   0.5 NA    NA   NA     1     1 55.95341  50
    -#> 10  2   1.0 NA    NA   NA     1     1 55.95341  50
    -#> 11  2   2.0 NA    NA   NA     1     1 55.95341  50
    -#> 12  2   6.0 NA    NA   NA     1     1 55.95341  50
    -#> 13  2  24.0 NA    NA   NA     1     1 55.95341  50
    -#> 14  2  36.0 NA    NA   NA     1     1 55.95341  50
    -#> 15  2  72.0 NA    NA   NA     1     1 55.95341  50
    -#> 16  2 120.0 NA    NA   NA     1     1 55.95341  50
    -#> 17  3   0.5 NA    NA   NA     1     1 67.63716  50
    -#> 18  3   1.0 NA    NA   NA     1     1 67.63716  50
    -#> 19  3   2.0 NA    NA   NA     1     1 67.63716  50
    -#> 20  3   6.0 NA    NA   NA     1     1 67.63716  50
    -
    -## create dosing rows 
    -dosing_1 <- list(list(AMT=1000,RATE=NA,Time=0.5),list(AMT=3000,RATE=NA,Time=0.5))
    -dosing_2 <- list(list(AMT=1000,RATE=NA,Time=0.5))
    -dosing_3 <- list(list(AMT=1000,Time=0.5))
    -dosing_4 <- list(list(AMT=c(1000,20),Time=c(0.5,10))) # multiple dosing
    -
    -
    -(df_12 <- model_prediction(design=design_3,DV=TRUE,dosing=dosing_1))
    -#>    ID  Time DV IPRED PRED  AMT RATE Group Model WT AGE
    -#> 1   1   0.5 NA    NA   NA 1000   NA     1     1 70  50
    -#> 2   1   0.5 NA    NA   NA   NA   NA     1     1 70  50
    -#> 3   1   1.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 4   1   2.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 5   1   6.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 6   1  24.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 7   1  36.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 8   1  72.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 9   1 120.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 10  2   0.5 NA    NA   NA 1000   NA     1     1 70  50
    -#> 11  2   0.5 NA    NA   NA   NA   NA     1     1 70  50
    -#> 12  2   1.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 13  2   2.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 14  2   6.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 15  2  24.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 16  2  36.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 17  2  72.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 18  2 120.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 19  3   0.5 NA    NA   NA 1000   NA     1     1 70  50
    -#> 20  3   0.5 NA    NA   NA   NA   NA     1     1 70  50
    -#> 21  3   1.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 22  3   2.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 23  3   6.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 24  3  24.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 25  3  36.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 26  3  72.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 27  3 120.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 28  4   0.5 NA    NA   NA 3000   NA     2     1 60  45
    -#> 29  4   0.5 NA    NA   NA   NA   NA     2     1 60  45
    -#> 30  4   1.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 31  4   2.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 32  4   6.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 33  4  24.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 34  4  36.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 35  4  72.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 36  4 120.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 37  5   0.5 NA    NA   NA 3000   NA     2     1 60  45
    -#> 38  5   0.5 NA    NA   NA   NA   NA     2     1 60  45
    -#> 39  5   1.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 40  5   2.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 41  5   6.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 42  5  24.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 43  5  36.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 44  5  72.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 45  5 120.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 46  6   0.5 NA    NA   NA 3000   NA     2     1 60  45
    -#> 47  6   0.5 NA    NA   NA   NA   NA     2     1 60  45
    -#> 48  6   1.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 49  6   2.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 50  6   6.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 51  6  24.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 52  6  36.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 53  6  72.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 54  6 120.0 NA    NA   NA   NA   NA     2     1 60  45
    -(df_13 <- model_prediction(design=design_3,DV=TRUE,dosing=dosing_2))
    -#>    ID  Time DV IPRED PRED  AMT RATE Group Model WT AGE
    -#> 1   1   0.5 NA    NA   NA 1000   NA     1     1 70  50
    -#> 2   1   0.5 NA    NA   NA   NA   NA     1     1 70  50
    -#> 3   1   1.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 4   1   2.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 5   1   6.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 6   1  24.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 7   1  36.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 8   1  72.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 9   1 120.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 10  2   0.5 NA    NA   NA 1000   NA     1     1 70  50
    -#> 11  2   0.5 NA    NA   NA   NA   NA     1     1 70  50
    -#> 12  2   1.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 13  2   2.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 14  2   6.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 15  2  24.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 16  2  36.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 17  2  72.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 18  2 120.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 19  3   0.5 NA    NA   NA 1000   NA     1     1 70  50
    -#> 20  3   0.5 NA    NA   NA   NA   NA     1     1 70  50
    -#> 21  3   1.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 22  3   2.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 23  3   6.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 24  3  24.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 25  3  36.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 26  3  72.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 27  3 120.0 NA    NA   NA   NA   NA     1     1 70  50
    -#> 28  4   0.5 NA    NA   NA 1000   NA     2     1 60  45
    -#> 29  4   0.5 NA    NA   NA   NA   NA     2     1 60  45
    -#> 30  4   1.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 31  4   2.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 32  4   6.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 33  4  24.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 34  4  36.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 35  4  72.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 36  4 120.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 37  5   0.5 NA    NA   NA 1000   NA     2     1 60  45
    -#> 38  5   0.5 NA    NA   NA   NA   NA     2     1 60  45
    -#> 39  5   1.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 40  5   2.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 41  5   6.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 42  5  24.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 43  5  36.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 44  5  72.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 45  5 120.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 46  6   0.5 NA    NA   NA 1000   NA     2     1 60  45
    -#> 47  6   0.5 NA    NA   NA   NA   NA     2     1 60  45
    -#> 48  6   1.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 49  6   2.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 50  6   6.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 51  6  24.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 52  6  36.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 53  6  72.0 NA    NA   NA   NA   NA     2     1 60  45
    -#> 54  6 120.0 NA    NA   NA   NA   NA     2     1 60  45
    -(df_14 <- model_prediction(design=design_3,DV=TRUE,dosing=dosing_3))
    -#>    ID  Time DV IPRED PRED  AMT Group Model WT AGE
    -#> 1   1   0.5 NA    NA   NA 1000     1     1 70  50
    -#> 2   1   0.5 NA    NA   NA   NA     1     1 70  50
    -#> 3   1   1.0 NA    NA   NA   NA     1     1 70  50
    -#> 4   1   2.0 NA    NA   NA   NA     1     1 70  50
    -#> 5   1   6.0 NA    NA   NA   NA     1     1 70  50
    -#> 6   1  24.0 NA    NA   NA   NA     1     1 70  50
    -#> 7   1  36.0 NA    NA   NA   NA     1     1 70  50
    -#> 8   1  72.0 NA    NA   NA   NA     1     1 70  50
    -#> 9   1 120.0 NA    NA   NA   NA     1     1 70  50
    -#> 10  2   0.5 NA    NA   NA 1000     1     1 70  50
    -#> 11  2   0.5 NA    NA   NA   NA     1     1 70  50
    -#> 12  2   1.0 NA    NA   NA   NA     1     1 70  50
    -#> 13  2   2.0 NA    NA   NA   NA     1     1 70  50
    -#> 14  2   6.0 NA    NA   NA   NA     1     1 70  50
    -#> 15  2  24.0 NA    NA   NA   NA     1     1 70  50
    -#> 16  2  36.0 NA    NA   NA   NA     1     1 70  50
    -#> 17  2  72.0 NA    NA   NA   NA     1     1 70  50
    -#> 18  2 120.0 NA    NA   NA   NA     1     1 70  50
    -#> 19  3   0.5 NA    NA   NA 1000     1     1 70  50
    -#> 20  3   0.5 NA    NA   NA   NA     1     1 70  50
    -#> 21  3   1.0 NA    NA   NA   NA     1     1 70  50
    -#> 22  3   2.0 NA    NA   NA   NA     1     1 70  50
    -#> 23  3   6.0 NA    NA   NA   NA     1     1 70  50
    -#> 24  3  24.0 NA    NA   NA   NA     1     1 70  50
    -#> 25  3  36.0 NA    NA   NA   NA     1     1 70  50
    -#> 26  3  72.0 NA    NA   NA   NA     1     1 70  50
    -#> 27  3 120.0 NA    NA   NA   NA     1     1 70  50
    -#> 28  4   0.5 NA    NA   NA 1000     2     1 60  45
    -#> 29  4   0.5 NA    NA   NA   NA     2     1 60  45
    -#> 30  4   1.0 NA    NA   NA   NA     2     1 60  45
    -#> 31  4   2.0 NA    NA   NA   NA     2     1 60  45
    -#> 32  4   6.0 NA    NA   NA   NA     2     1 60  45
    -#> 33  4  24.0 NA    NA   NA   NA     2     1 60  45
    -#> 34  4  36.0 NA    NA   NA   NA     2     1 60  45
    -#> 35  4  72.0 NA    NA   NA   NA     2     1 60  45
    -#> 36  4 120.0 NA    NA   NA   NA     2     1 60  45
    -#> 37  5   0.5 NA    NA   NA 1000     2     1 60  45
    -#> 38  5   0.5 NA    NA   NA   NA     2     1 60  45
    -#> 39  5   1.0 NA    NA   NA   NA     2     1 60  45
    -#> 40  5   2.0 NA    NA   NA   NA     2     1 60  45
    -#> 41  5   6.0 NA    NA   NA   NA     2     1 60  45
    -#> 42  5  24.0 NA    NA   NA   NA     2     1 60  45
    -#> 43  5  36.0 NA    NA   NA   NA     2     1 60  45
    -#> 44  5  72.0 NA    NA   NA   NA     2     1 60  45
    -#> 45  5 120.0 NA    NA   NA   NA     2     1 60  45
    -#> 46  6   0.5 NA    NA   NA 1000     2     1 60  45
    -#> 47  6   0.5 NA    NA   NA   NA     2     1 60  45
    -#> 48  6   1.0 NA    NA   NA   NA     2     1 60  45
    -#> 49  6   2.0 NA    NA   NA   NA     2     1 60  45
    -#> 50  6   6.0 NA    NA   NA   NA     2     1 60  45
    -#> 51  6  24.0 NA    NA   NA   NA     2     1 60  45
    -#> 52  6  36.0 NA    NA   NA   NA     2     1 60  45
    -#> 53  6  72.0 NA    NA   NA   NA     2     1 60  45
    -#> 54  6 120.0 NA    NA   NA   NA     2     1 60  45
    -(df_15 <- model_prediction(design=design_3,DV=TRUE,dosing=dosing_4))
    -#>    ID  Time DV IPRED PRED  AMT Group Model WT AGE
    -#> 1   1   0.5 NA    NA   NA 1000     1     1 70  50
    -#> 2   1   0.5 NA    NA   NA   NA     1     1 70  50
    -#> 3   1   1.0 NA    NA   NA   NA     1     1 70  50
    -#> 4   1   2.0 NA    NA   NA   NA     1     1 70  50
    -#> 5   1   6.0 NA    NA   NA   NA     1     1 70  50
    -#> 6   1  10.0 NA    NA   NA   20     1     1 70  50
    -#> 7   1  24.0 NA    NA   NA   NA     1     1 70  50
    -#> 8   1  36.0 NA    NA   NA   NA     1     1 70  50
    -#> 9   1  72.0 NA    NA   NA   NA     1     1 70  50
    -#> 10  1 120.0 NA    NA   NA   NA     1     1 70  50
    -#> 11  2   0.5 NA    NA   NA 1000     1     1 70  50
    -#> 12  2   0.5 NA    NA   NA   NA     1     1 70  50
    -#> 13  2   1.0 NA    NA   NA   NA     1     1 70  50
    -#> 14  2   2.0 NA    NA   NA   NA     1     1 70  50
    -#> 15  2   6.0 NA    NA   NA   NA     1     1 70  50
    -#> 16  2  10.0 NA    NA   NA   20     1     1 70  50
    -#> 17  2  24.0 NA    NA   NA   NA     1     1 70  50
    -#> 18  2  36.0 NA    NA   NA   NA     1     1 70  50
    -#> 19  2  72.0 NA    NA   NA   NA     1     1 70  50
    -#> 20  2 120.0 NA    NA   NA   NA     1     1 70  50
    -#> 21  3   0.5 NA    NA   NA 1000     1     1 70  50
    -#> 22  3   0.5 NA    NA   NA   NA     1     1 70  50
    -#> 23  3   1.0 NA    NA   NA   NA     1     1 70  50
    -#> 24  3   2.0 NA    NA   NA   NA     1     1 70  50
    -#> 25  3   6.0 NA    NA   NA   NA     1     1 70  50
    -#> 26  3  10.0 NA    NA   NA   20     1     1 70  50
    -#> 27  3  24.0 NA    NA   NA   NA     1     1 70  50
    -#> 28  3  36.0 NA    NA   NA   NA     1     1 70  50
    -#> 29  3  72.0 NA    NA   NA   NA     1     1 70  50
    -#> 30  3 120.0 NA    NA   NA   NA     1     1 70  50
    -#> 31  4   0.5 NA    NA   NA 1000     2     1 60  45
    -#> 32  4   0.5 NA    NA   NA   NA     2     1 60  45
    -#> 33  4   1.0 NA    NA   NA   NA     2     1 60  45
    -#> 34  4   2.0 NA    NA   NA   NA     2     1 60  45
    -#> 35  4   6.0 NA    NA   NA   NA     2     1 60  45
    -#> 36  4  10.0 NA    NA   NA   20     2     1 60  45
    -#> 37  4  24.0 NA    NA   NA   NA     2     1 60  45
    -#> 38  4  36.0 NA    NA   NA   NA     2     1 60  45
    -#> 39  4  72.0 NA    NA   NA   NA     2     1 60  45
    -#> 40  4 120.0 NA    NA   NA   NA     2     1 60  45
    -#> 41  5   0.5 NA    NA   NA 1000     2     1 60  45
    -#> 42  5   0.5 NA    NA   NA   NA     2     1 60  45
    -#> 43  5   1.0 NA    NA   NA   NA     2     1 60  45
    -#> 44  5   2.0 NA    NA   NA   NA     2     1 60  45
    -#> 45  5   6.0 NA    NA   NA   NA     2     1 60  45
    -#> 46  5  10.0 NA    NA   NA   20     2     1 60  45
    -#> 47  5  24.0 NA    NA   NA   NA     2     1 60  45
    -#> 48  5  36.0 NA    NA   NA   NA     2     1 60  45
    -#> 49  5  72.0 NA    NA   NA   NA     2     1 60  45
    -#> 50  5 120.0 NA    NA   NA   NA     2     1 60  45
    -#> 51  6   0.5 NA    NA   NA 1000     2     1 60  45
    -#> 52  6   0.5 NA    NA   NA   NA     2     1 60  45
    -#> 53  6   1.0 NA    NA   NA   NA     2     1 60  45
    -#> 54  6   2.0 NA    NA   NA   NA     2     1 60  45
    -#> 55  6   6.0 NA    NA   NA   NA     2     1 60  45
    -#> 56  6  10.0 NA    NA   NA   20     2     1 60  45
    -#> 57  6  24.0 NA    NA   NA   NA     2     1 60  45
    -#> 58  6  36.0 NA    NA   NA   NA     2     1 60  45
    -#> 59  6  72.0 NA    NA   NA   NA     2     1 60  45
    -#> 60  6 120.0 NA    NA   NA   NA     2     1 60  45
    -
    -
    -model_prediction(design=design_3,DV=TRUE,dosing=dosing_4,model_num_points = 10)
    -#>     ID      Time DV IPRED PRED  AMT Group Model WT AGE
    -#> 1    1   0.50000 NA    NA   NA 1000     1     1 70  50
    -#> 2    1   0.50000 NA    NA   NA   NA     1     1 70  50
    -#> 3    1   1.00000 NA    NA   NA   NA     1     1 70  50
    -#> 4    1   2.00000 NA    NA   NA   NA     1     1 70  50
    -#> 5    1   6.00000 NA    NA   NA   NA     1     1 70  50
    -#> 6    1  10.00000 NA    NA   NA   20     1     1 70  50
    -#> 7    1  13.77778 NA    NA   NA   NA     1     1 70  50
    -#> 8    1  24.00000 NA    NA   NA   NA     1     1 70  50
    -#> 9    1  27.05556 NA    NA   NA   NA     1     1 70  50
    -#> 10   1  36.00000 NA    NA   NA   NA     1     1 70  50
    -#> 11   1  40.33333 NA    NA   NA   NA     1     1 70  50
    -#> 12   1  53.61111 NA    NA   NA   NA     1     1 70  50
    -#> 13   1  66.88889 NA    NA   NA   NA     1     1 70  50
    -#> 14   1  72.00000 NA    NA   NA   NA     1     1 70  50
    -#> 15   1  80.16667 NA    NA   NA   NA     1     1 70  50
    -#> 16   1  93.44444 NA    NA   NA   NA     1     1 70  50
    -#> 17   1 106.72222 NA    NA   NA   NA     1     1 70  50
    -#> 18   1 120.00000 NA    NA   NA   NA     1     1 70  50
    -#> 19   2   0.50000 NA    NA   NA 1000     1     1 70  50
    -#> 20   2   0.50000 NA    NA   NA   NA     1     1 70  50
    -#> 21   2   1.00000 NA    NA   NA   NA     1     1 70  50
    -#> 22   2   2.00000 NA    NA   NA   NA     1     1 70  50
    -#> 23   2   6.00000 NA    NA   NA   NA     1     1 70  50
    -#> 24   2  10.00000 NA    NA   NA   20     1     1 70  50
    -#> 25   2  13.77778 NA    NA   NA   NA     1     1 70  50
    -#> 26   2  24.00000 NA    NA   NA   NA     1     1 70  50
    -#> 27   2  27.05556 NA    NA   NA   NA     1     1 70  50
    -#> 28   2  36.00000 NA    NA   NA   NA     1     1 70  50
    -#> 29   2  40.33333 NA    NA   NA   NA     1     1 70  50
    -#> 30   2  53.61111 NA    NA   NA   NA     1     1 70  50
    -#> 31   2  66.88889 NA    NA   NA   NA     1     1 70  50
    -#> 32   2  72.00000 NA    NA   NA   NA     1     1 70  50
    -#> 33   2  80.16667 NA    NA   NA   NA     1     1 70  50
    -#> 34   2  93.44444 NA    NA   NA   NA     1     1 70  50
    -#> 35   2 106.72222 NA    NA   NA   NA     1     1 70  50
    -#> 36   2 120.00000 NA    NA   NA   NA     1     1 70  50
    -#> 37   3   0.50000 NA    NA   NA 1000     1     1 70  50
    -#> 38   3   0.50000 NA    NA   NA   NA     1     1 70  50
    -#> 39   3   1.00000 NA    NA   NA   NA     1     1 70  50
    -#> 40   3   2.00000 NA    NA   NA   NA     1     1 70  50
    -#> 41   3   6.00000 NA    NA   NA   NA     1     1 70  50
    -#> 42   3  10.00000 NA    NA   NA   20     1     1 70  50
    -#> 43   3  13.77778 NA    NA   NA   NA     1     1 70  50
    -#> 44   3  24.00000 NA    NA   NA   NA     1     1 70  50
    -#> 45   3  27.05556 NA    NA   NA   NA     1     1 70  50
    -#> 46   3  36.00000 NA    NA   NA   NA     1     1 70  50
    -#> 47   3  40.33333 NA    NA   NA   NA     1     1 70  50
    -#> 48   3  53.61111 NA    NA   NA   NA     1     1 70  50
    -#> 49   3  66.88889 NA    NA   NA   NA     1     1 70  50
    -#> 50   3  72.00000 NA    NA   NA   NA     1     1 70  50
    -#> 51   3  80.16667 NA    NA   NA   NA     1     1 70  50
    -#> 52   3  93.44444 NA    NA   NA   NA     1     1 70  50
    -#> 53   3 106.72222 NA    NA   NA   NA     1     1 70  50
    -#> 54   3 120.00000 NA    NA   NA   NA     1     1 70  50
    -#> 55   4   0.50000 NA    NA   NA 1000     2     1 60  45
    -#> 56   4   0.50000 NA    NA   NA   NA     2     1 60  45
    -#> 57   4   1.00000 NA    NA   NA   NA     2     1 60  45
    -#> 58   4   2.00000 NA    NA   NA   NA     2     1 60  45
    -#> 59   4   6.00000 NA    NA   NA   NA     2     1 60  45
    -#> 60   4  10.00000 NA    NA   NA   20     2     1 60  45
    -#> 61   4  13.77778 NA    NA   NA   NA     2     1 60  45
    -#> 62   4  24.00000 NA    NA   NA   NA     2     1 60  45
    -#> 63   4  27.05556 NA    NA   NA   NA     2     1 60  45
    -#> 64   4  36.00000 NA    NA   NA   NA     2     1 60  45
    -#> 65   4  40.33333 NA    NA   NA   NA     2     1 60  45
    -#> 66   4  53.61111 NA    NA   NA   NA     2     1 60  45
    -#> 67   4  66.88889 NA    NA   NA   NA     2     1 60  45
    -#> 68   4  72.00000 NA    NA   NA   NA     2     1 60  45
    -#> 69   4  80.16667 NA    NA   NA   NA     2     1 60  45
    -#> 70   4  93.44444 NA    NA   NA   NA     2     1 60  45
    -#> 71   4 106.72222 NA    NA   NA   NA     2     1 60  45
    -#> 72   4 120.00000 NA    NA   NA   NA     2     1 60  45
    -#> 73   5   0.50000 NA    NA   NA 1000     2     1 60  45
    -#> 74   5   0.50000 NA    NA   NA   NA     2     1 60  45
    -#> 75   5   1.00000 NA    NA   NA   NA     2     1 60  45
    -#> 76   5   2.00000 NA    NA   NA   NA     2     1 60  45
    -#> 77   5   6.00000 NA    NA   NA   NA     2     1 60  45
    -#> 78   5  10.00000 NA    NA   NA   20     2     1 60  45
    -#> 79   5  13.77778 NA    NA   NA   NA     2     1 60  45
    -#> 80   5  24.00000 NA    NA   NA   NA     2     1 60  45
    -#> 81   5  27.05556 NA    NA   NA   NA     2     1 60  45
    -#> 82   5  36.00000 NA    NA   NA   NA     2     1 60  45
    -#> 83   5  40.33333 NA    NA   NA   NA     2     1 60  45
    -#> 84   5  53.61111 NA    NA   NA   NA     2     1 60  45
    -#> 85   5  66.88889 NA    NA   NA   NA     2     1 60  45
    -#> 86   5  72.00000 NA    NA   NA   NA     2     1 60  45
    -#> 87   5  80.16667 NA    NA   NA   NA     2     1 60  45
    -#> 88   5  93.44444 NA    NA   NA   NA     2     1 60  45
    -#> 89   5 106.72222 NA    NA   NA   NA     2     1 60  45
    -#> 90   5 120.00000 NA    NA   NA   NA     2     1 60  45
    -#> 91   6   0.50000 NA    NA   NA 1000     2     1 60  45
    -#> 92   6   0.50000 NA    NA   NA   NA     2     1 60  45
    -#> 93   6   1.00000 NA    NA   NA   NA     2     1 60  45
    -#> 94   6   2.00000 NA    NA   NA   NA     2     1 60  45
    -#> 95   6   6.00000 NA    NA   NA   NA     2     1 60  45
    -#> 96   6  10.00000 NA    NA   NA   20     2     1 60  45
    -#> 97   6  13.77778 NA    NA   NA   NA     2     1 60  45
    -#> 98   6  24.00000 NA    NA   NA   NA     2     1 60  45
    -#> 99   6  27.05556 NA    NA   NA   NA     2     1 60  45
    -#> 100  6  36.00000 NA    NA   NA   NA     2     1 60  45
    -#> 101  6  40.33333 NA    NA   NA   NA     2     1 60  45
    -#> 102  6  53.61111 NA    NA   NA   NA     2     1 60  45
    -#> 103  6  66.88889 NA    NA   NA   NA     2     1 60  45
    -#> 104  6  72.00000 NA    NA   NA   NA     2     1 60  45
    -#> 105  6  80.16667 NA    NA   NA   NA     2     1 60  45
    -#> 106  6  93.44444 NA    NA   NA   NA     2     1 60  45
    -#> 107  6 106.72222 NA    NA   NA   NA     2     1 60  45
    -#> 108  6 120.00000 NA    NA   NA   NA     2     1 60  45
    -model_prediction(design=design_3,DV=TRUE,dosing=dosing_4,model_num_points = 10,model_minxt=20)
    -#>     ID      Time DV IPRED PRED  AMT Group Model WT AGE
    -#> 1    1   0.50000 NA    NA   NA 1000     1     1 70  50
    -#> 2    1   0.50000 NA    NA   NA   NA     1     1 70  50
    -#> 3    1   1.00000 NA    NA   NA   NA     1     1 70  50
    -#> 4    1   2.00000 NA    NA   NA   NA     1     1 70  50
    -#> 5    1   6.00000 NA    NA   NA   NA     1     1 70  50
    -#> 6    1  10.00000 NA    NA   NA   20     1     1 70  50
    -#> 7    1  20.00000 NA    NA   NA   NA     1     1 70  50
    -#> 8    1  24.00000 NA    NA   NA   NA     1     1 70  50
    -#> 9    1  31.11111 NA    NA   NA   NA     1     1 70  50
    -#> 10   1  36.00000 NA    NA   NA   NA     1     1 70  50
    -#> 11   1  42.22222 NA    NA   NA   NA     1     1 70  50
    -#> 12   1  53.33333 NA    NA   NA   NA     1     1 70  50
    -#> 13   1  64.44444 NA    NA   NA   NA     1     1 70  50
    -#> 14   1  72.00000 NA    NA   NA   NA     1     1 70  50
    -#> 15   1  75.55556 NA    NA   NA   NA     1     1 70  50
    -#> 16   1  86.66667 NA    NA   NA   NA     1     1 70  50
    -#> 17   1  97.77778 NA    NA   NA   NA     1     1 70  50
    -#> 18   1 108.88889 NA    NA   NA   NA     1     1 70  50
    -#> 19   1 120.00000 NA    NA   NA   NA     1     1 70  50
    -#> 20   2   0.50000 NA    NA   NA 1000     1     1 70  50
    -#> 21   2   0.50000 NA    NA   NA   NA     1     1 70  50
    -#> 22   2   1.00000 NA    NA   NA   NA     1     1 70  50
    -#> 23   2   2.00000 NA    NA   NA   NA     1     1 70  50
    -#> 24   2   6.00000 NA    NA   NA   NA     1     1 70  50
    -#> 25   2  10.00000 NA    NA   NA   20     1     1 70  50
    -#> 26   2  20.00000 NA    NA   NA   NA     1     1 70  50
    -#> 27   2  24.00000 NA    NA   NA   NA     1     1 70  50
    -#> 28   2  31.11111 NA    NA   NA   NA     1     1 70  50
    -#> 29   2  36.00000 NA    NA   NA   NA     1     1 70  50
    -#> 30   2  42.22222 NA    NA   NA   NA     1     1 70  50
    -#> 31   2  53.33333 NA    NA   NA   NA     1     1 70  50
    -#> 32   2  64.44444 NA    NA   NA   NA     1     1 70  50
    -#> 33   2  72.00000 NA    NA   NA   NA     1     1 70  50
    -#> 34   2  75.55556 NA    NA   NA   NA     1     1 70  50
    -#> 35   2  86.66667 NA    NA   NA   NA     1     1 70  50
    -#> 36   2  97.77778 NA    NA   NA   NA     1     1 70  50
    -#> 37   2 108.88889 NA    NA   NA   NA     1     1 70  50
    -#> 38   2 120.00000 NA    NA   NA   NA     1     1 70  50
    -#> 39   3   0.50000 NA    NA   NA 1000     1     1 70  50
    -#> 40   3   0.50000 NA    NA   NA   NA     1     1 70  50
    -#> 41   3   1.00000 NA    NA   NA   NA     1     1 70  50
    -#> 42   3   2.00000 NA    NA   NA   NA     1     1 70  50
    -#> 43   3   6.00000 NA    NA   NA   NA     1     1 70  50
    -#> 44   3  10.00000 NA    NA   NA   20     1     1 70  50
    -#> 45   3  20.00000 NA    NA   NA   NA     1     1 70  50
    -#> 46   3  24.00000 NA    NA   NA   NA     1     1 70  50
    -#> 47   3  31.11111 NA    NA   NA   NA     1     1 70  50
    -#> 48   3  36.00000 NA    NA   NA   NA     1     1 70  50
    -#> 49   3  42.22222 NA    NA   NA   NA     1     1 70  50
    -#> 50   3  53.33333 NA    NA   NA   NA     1     1 70  50
    -#> 51   3  64.44444 NA    NA   NA   NA     1     1 70  50
    -#> 52   3  72.00000 NA    NA   NA   NA     1     1 70  50
    -#> 53   3  75.55556 NA    NA   NA   NA     1     1 70  50
    -#> 54   3  86.66667 NA    NA   NA   NA     1     1 70  50
    -#> 55   3  97.77778 NA    NA   NA   NA     1     1 70  50
    -#> 56   3 108.88889 NA    NA   NA   NA     1     1 70  50
    -#> 57   3 120.00000 NA    NA   NA   NA     1     1 70  50
    -#> 58   4   0.50000 NA    NA   NA 1000     2     1 60  45
    -#> 59   4   0.50000 NA    NA   NA   NA     2     1 60  45
    -#> 60   4   1.00000 NA    NA   NA   NA     2     1 60  45
    -#> 61   4   2.00000 NA    NA   NA   NA     2     1 60  45
    -#> 62   4   6.00000 NA    NA   NA   NA     2     1 60  45
    -#> 63   4  10.00000 NA    NA   NA   20     2     1 60  45
    -#> 64   4  20.00000 NA    NA   NA   NA     2     1 60  45
    -#> 65   4  24.00000 NA    NA   NA   NA     2     1 60  45
    -#> 66   4  31.11111 NA    NA   NA   NA     2     1 60  45
    -#> 67   4  36.00000 NA    NA   NA   NA     2     1 60  45
    -#> 68   4  42.22222 NA    NA   NA   NA     2     1 60  45
    -#> 69   4  53.33333 NA    NA   NA   NA     2     1 60  45
    -#> 70   4  64.44444 NA    NA   NA   NA     2     1 60  45
    -#> 71   4  72.00000 NA    NA   NA   NA     2     1 60  45
    -#> 72   4  75.55556 NA    NA   NA   NA     2     1 60  45
    -#> 73   4  86.66667 NA    NA   NA   NA     2     1 60  45
    -#> 74   4  97.77778 NA    NA   NA   NA     2     1 60  45
    -#> 75   4 108.88889 NA    NA   NA   NA     2     1 60  45
    -#> 76   4 120.00000 NA    NA   NA   NA     2     1 60  45
    -#> 77   5   0.50000 NA    NA   NA 1000     2     1 60  45
    -#> 78   5   0.50000 NA    NA   NA   NA     2     1 60  45
    -#> 79   5   1.00000 NA    NA   NA   NA     2     1 60  45
    -#> 80   5   2.00000 NA    NA   NA   NA     2     1 60  45
    -#> 81   5   6.00000 NA    NA   NA   NA     2     1 60  45
    -#> 82   5  10.00000 NA    NA   NA   20     2     1 60  45
    -#> 83   5  20.00000 NA    NA   NA   NA     2     1 60  45
    -#> 84   5  24.00000 NA    NA   NA   NA     2     1 60  45
    -#> 85   5  31.11111 NA    NA   NA   NA     2     1 60  45
    -#> 86   5  36.00000 NA    NA   NA   NA     2     1 60  45
    -#> 87   5  42.22222 NA    NA   NA   NA     2     1 60  45
    -#> 88   5  53.33333 NA    NA   NA   NA     2     1 60  45
    -#> 89   5  64.44444 NA    NA   NA   NA     2     1 60  45
    -#> 90   5  72.00000 NA    NA   NA   NA     2     1 60  45
    -#> 91   5  75.55556 NA    NA   NA   NA     2     1 60  45
    -#> 92   5  86.66667 NA    NA   NA   NA     2     1 60  45
    -#> 93   5  97.77778 NA    NA   NA   NA     2     1 60  45
    -#> 94   5 108.88889 NA    NA   NA   NA     2     1 60  45
    -#> 95   5 120.00000 NA    NA   NA   NA     2     1 60  45
    -#> 96   6   0.50000 NA    NA   NA 1000     2     1 60  45
    -#> 97   6   0.50000 NA    NA   NA   NA     2     1 60  45
    -#> 98   6   1.00000 NA    NA   NA   NA     2     1 60  45
    -#> 99   6   2.00000 NA    NA   NA   NA     2     1 60  45
    -#> 100  6   6.00000 NA    NA   NA   NA     2     1 60  45
    -#> 101  6  10.00000 NA    NA   NA   20     2     1 60  45
    -#> 102  6  20.00000 NA    NA   NA   NA     2     1 60  45
    -#> 103  6  24.00000 NA    NA   NA   NA     2     1 60  45
    -#> 104  6  31.11111 NA    NA   NA   NA     2     1 60  45
    -#> 105  6  36.00000 NA    NA   NA   NA     2     1 60  45
    -#> 106  6  42.22222 NA    NA   NA   NA     2     1 60  45
    -#> 107  6  53.33333 NA    NA   NA   NA     2     1 60  45
    -#> 108  6  64.44444 NA    NA   NA   NA     2     1 60  45
    -#> 109  6  72.00000 NA    NA   NA   NA     2     1 60  45
    -#> 110  6  75.55556 NA    NA   NA   NA     2     1 60  45
    -#> 111  6  86.66667 NA    NA   NA   NA     2     1 60  45
    -#> 112  6  97.77778 NA    NA   NA   NA     2     1 60  45
    -#> 113  6 108.88889 NA    NA   NA   NA     2     1 60  45
    -#> 114  6 120.00000 NA    NA   NA   NA     2     1 60  45
    -
    -design_4 <- list(
    -  xt=c( 0.5,1,2,6,24,36,72,120),
    -  model_switch=c(1,1,1,1,2,2,2,2),
    -  m=2,
    -  groupsize=3,
    -  a=list(c(WT=70,AGE=50),c(AGE=45,WT=60)))
    -
    -model_prediction(design=design_4,DV=TRUE,dosing=dosing_4)
    -#>    ID  Time DV IPRED PRED  AMT Group Model WT AGE
    -#> 1   1   0.5 NA    NA   NA 1000     1     1 70  50
    -#> 2   1   0.5 NA    NA   NA   NA     1     1 70  50
    -#> 3   1   1.0 NA    NA   NA   NA     1     1 70  50
    -#> 4   1   2.0 NA    NA   NA   NA     1     1 70  50
    -#> 5   1   6.0 NA    NA   NA   NA     1     1 70  50
    -#> 6   1  10.0 NA    NA   NA   20     1     1 70  50
    -#> 7   1  24.0 NA    NA   NA   NA     1     2 70  50
    -#> 8   1  36.0 NA    NA   NA   NA     1     2 70  50
    -#> 9   1  72.0 NA    NA   NA   NA     1     2 70  50
    -#> 10  1 120.0 NA    NA   NA   NA     1     2 70  50
    -#> 11  2   0.5 NA    NA   NA 1000     1     1 70  50
    -#> 12  2   0.5 NA    NA   NA   NA     1     1 70  50
    -#> 13  2   1.0 NA    NA   NA   NA     1     1 70  50
    -#> 14  2   2.0 NA    NA   NA   NA     1     1 70  50
    -#> 15  2   6.0 NA    NA   NA   NA     1     1 70  50
    -#> 16  2  10.0 NA    NA   NA   20     1     1 70  50
    -#> 17  2  24.0 NA    NA   NA   NA     1     2 70  50
    -#> 18  2  36.0 NA    NA   NA   NA     1     2 70  50
    -#> 19  2  72.0 NA    NA   NA   NA     1     2 70  50
    -#> 20  2 120.0 NA    NA   NA   NA     1     2 70  50
    -#> 21  3   0.5 NA    NA   NA 1000     1     1 70  50
    -#> 22  3   0.5 NA    NA   NA   NA     1     1 70  50
    -#> 23  3   1.0 NA    NA   NA   NA     1     1 70  50
    -#> 24  3   2.0 NA    NA   NA   NA     1     1 70  50
    -#> 25  3   6.0 NA    NA   NA   NA     1     1 70  50
    -#> 26  3  10.0 NA    NA   NA   20     1     1 70  50
    -#> 27  3  24.0 NA    NA   NA   NA     1     2 70  50
    -#> 28  3  36.0 NA    NA   NA   NA     1     2 70  50
    -#> 29  3  72.0 NA    NA   NA   NA     1     2 70  50
    -#> 30  3 120.0 NA    NA   NA   NA     1     2 70  50
    -#> 31  4   0.5 NA    NA   NA 1000     2     1 60  45
    -#> 32  4   0.5 NA    NA   NA   NA     2     1 60  45
    -#> 33  4   1.0 NA    NA   NA   NA     2     1 60  45
    -#> 34  4   2.0 NA    NA   NA   NA     2     1 60  45
    -#> 35  4   6.0 NA    NA   NA   NA     2     1 60  45
    -#> 36  4  10.0 NA    NA   NA   20     2     1 60  45
    -#> 37  4  24.0 NA    NA   NA   NA     2     2 60  45
    -#> 38  4  36.0 NA    NA   NA   NA     2     2 60  45
    -#> 39  4  72.0 NA    NA   NA   NA     2     2 60  45
    -#> 40  4 120.0 NA    NA   NA   NA     2     2 60  45
    -#> 41  5   0.5 NA    NA   NA 1000     2     1 60  45
    -#> 42  5   0.5 NA    NA   NA   NA     2     1 60  45
    -#> 43  5   1.0 NA    NA   NA   NA     2     1 60  45
    -#> 44  5   2.0 NA    NA   NA   NA     2     1 60  45
    -#> 45  5   6.0 NA    NA   NA   NA     2     1 60  45
    -#> 46  5  10.0 NA    NA   NA   20     2     1 60  45
    -#> 47  5  24.0 NA    NA   NA   NA     2     2 60  45
    -#> 48  5  36.0 NA    NA   NA   NA     2     2 60  45
    -#> 49  5  72.0 NA    NA   NA   NA     2     2 60  45
    -#> 50  5 120.0 NA    NA   NA   NA     2     2 60  45
    -#> 51  6   0.5 NA    NA   NA 1000     2     1 60  45
    -#> 52  6   0.5 NA    NA   NA   NA     2     1 60  45
    -#> 53  6   1.0 NA    NA   NA   NA     2     1 60  45
    -#> 54  6   2.0 NA    NA   NA   NA     2     1 60  45
    -#> 55  6   6.0 NA    NA   NA   NA     2     1 60  45
    -#> 56  6  10.0 NA    NA   NA   20     2     1 60  45
    -#> 57  6  24.0 NA    NA   NA   NA     2     2 60  45
    -#> 58  6  36.0 NA    NA   NA   NA     2     2 60  45
    -#> 59  6  72.0 NA    NA   NA   NA     2     2 60  45
    -#> 60  6 120.0 NA    NA   NA   NA     2     2 60  45
    -model_prediction(design=design_4,DV=TRUE,dosing=dosing_4,model_num_points = 10)
    -#>     ID       Time DV IPRED PRED  AMT Group Model WT AGE
    -#> 1    1   0.500000 NA    NA   NA 1000     1     1 70  50
    -#> 2    1   0.500000 NA    NA   NA   NA     1     1 70  50
    -#> 3    1   1.000000 NA    NA   NA   NA     1     1 70  50
    -#> 4    1   1.111111 NA    NA   NA   NA     1     1 70  50
    -#> 5    1   1.722222 NA    NA   NA   NA     1     1 70  50
    -#> 6    1   2.000000 NA    NA   NA   NA     1     1 70  50
    -#> 7    1   2.333333 NA    NA   NA   NA     1     1 70  50
    -#> 8    1   2.944444 NA    NA   NA   NA     1     1 70  50
    -#> 9    1   3.555556 NA    NA   NA   NA     1     1 70  50
    -#> 10   1   4.166667 NA    NA   NA   NA     1     1 70  50
    -#> 11   1   4.777778 NA    NA   NA   NA     1     1 70  50
    -#> 12   1   5.388889 NA    NA   NA   NA     1     1 70  50
    -#> 13   1   6.000000 NA    NA   NA   NA     1     1 70  50
    -#> 14   1  10.000000 NA    NA   NA   20     1     1 70  50
    -#> 15   1  24.000000 NA    NA   NA   NA     1     2 70  50
    -#> 16   1  34.666667 NA    NA   NA   NA     1     2 70  50
    -#> 17   1  36.000000 NA    NA   NA   NA     1     2 70  50
    -#> 18   1  45.333333 NA    NA   NA   NA     1     2 70  50
    -#> 19   1  56.000000 NA    NA   NA   NA     1     2 70  50
    -#> 20   1  66.666667 NA    NA   NA   NA     1     2 70  50
    -#> 21   1  72.000000 NA    NA   NA   NA     1     2 70  50
    -#> 22   1  77.333333 NA    NA   NA   NA     1     2 70  50
    -#> 23   1  88.000000 NA    NA   NA   NA     1     2 70  50
    -#> 24   1  98.666667 NA    NA   NA   NA     1     2 70  50
    -#> 25   1 109.333333 NA    NA   NA   NA     1     2 70  50
    -#> 26   1 120.000000 NA    NA   NA   NA     1     2 70  50
    -#> 27   2   0.500000 NA    NA   NA 1000     1     1 70  50
    -#> 28   2   0.500000 NA    NA   NA   NA     1     1 70  50
    -#> 29   2   1.000000 NA    NA   NA   NA     1     1 70  50
    -#> 30   2   1.111111 NA    NA   NA   NA     1     1 70  50
    -#> 31   2   1.722222 NA    NA   NA   NA     1     1 70  50
    -#> 32   2   2.000000 NA    NA   NA   NA     1     1 70  50
    -#> 33   2   2.333333 NA    NA   NA   NA     1     1 70  50
    -#> 34   2   2.944444 NA    NA   NA   NA     1     1 70  50
    -#> 35   2   3.555556 NA    NA   NA   NA     1     1 70  50
    -#> 36   2   4.166667 NA    NA   NA   NA     1     1 70  50
    -#> 37   2   4.777778 NA    NA   NA   NA     1     1 70  50
    -#> 38   2   5.388889 NA    NA   NA   NA     1     1 70  50
    -#> 39   2   6.000000 NA    NA   NA   NA     1     1 70  50
    -#> 40   2  10.000000 NA    NA   NA   20     1     1 70  50
    -#> 41   2  24.000000 NA    NA   NA   NA     1     2 70  50
    -#> 42   2  34.666667 NA    NA   NA   NA     1     2 70  50
    -#> 43   2  36.000000 NA    NA   NA   NA     1     2 70  50
    -#> 44   2  45.333333 NA    NA   NA   NA     1     2 70  50
    -#> 45   2  56.000000 NA    NA   NA   NA     1     2 70  50
    -#> 46   2  66.666667 NA    NA   NA   NA     1     2 70  50
    -#> 47   2  72.000000 NA    NA   NA   NA     1     2 70  50
    -#> 48   2  77.333333 NA    NA   NA   NA     1     2 70  50
    -#> 49   2  88.000000 NA    NA   NA   NA     1     2 70  50
    -#> 50   2  98.666667 NA    NA   NA   NA     1     2 70  50
    -#> 51   2 109.333333 NA    NA   NA   NA     1     2 70  50
    -#> 52   2 120.000000 NA    NA   NA   NA     1     2 70  50
    -#> 53   3   0.500000 NA    NA   NA 1000     1     1 70  50
    -#> 54   3   0.500000 NA    NA   NA   NA     1     1 70  50
    -#> 55   3   1.000000 NA    NA   NA   NA     1     1 70  50
    -#> 56   3   1.111111 NA    NA   NA   NA     1     1 70  50
    -#> 57   3   1.722222 NA    NA   NA   NA     1     1 70  50
    -#> 58   3   2.000000 NA    NA   NA   NA     1     1 70  50
    -#> 59   3   2.333333 NA    NA   NA   NA     1     1 70  50
    -#> 60   3   2.944444 NA    NA   NA   NA     1     1 70  50
    -#> 61   3   3.555556 NA    NA   NA   NA     1     1 70  50
    -#> 62   3   4.166667 NA    NA   NA   NA     1     1 70  50
    -#> 63   3   4.777778 NA    NA   NA   NA     1     1 70  50
    -#> 64   3   5.388889 NA    NA   NA   NA     1     1 70  50
    -#> 65   3   6.000000 NA    NA   NA   NA     1     1 70  50
    -#> 66   3  10.000000 NA    NA   NA   20     1     1 70  50
    -#> 67   3  24.000000 NA    NA   NA   NA     1     2 70  50
    -#> 68   3  34.666667 NA    NA   NA   NA     1     2 70  50
    -#> 69   3  36.000000 NA    NA   NA   NA     1     2 70  50
    -#> 70   3  45.333333 NA    NA   NA   NA     1     2 70  50
    -#> 71   3  56.000000 NA    NA   NA   NA     1     2 70  50
    -#> 72   3  66.666667 NA    NA   NA   NA     1     2 70  50
    -#> 73   3  72.000000 NA    NA   NA   NA     1     2 70  50
    -#> 74   3  77.333333 NA    NA   NA   NA     1     2 70  50
    -#> 75   3  88.000000 NA    NA   NA   NA     1     2 70  50
    -#> 76   3  98.666667 NA    NA   NA   NA     1     2 70  50
    -#> 77   3 109.333333 NA    NA   NA   NA     1     2 70  50
    -#> 78   3 120.000000 NA    NA   NA   NA     1     2 70  50
    -#> 79   4   0.500000 NA    NA   NA 1000     2     1 60  45
    -#> 80   4   0.500000 NA    NA   NA   NA     2     1 60  45
    -#> 81   4   1.000000 NA    NA   NA   NA     2     1 60  45
    -#> 82   4   1.111111 NA    NA   NA   NA     2     1 60  45
    -#> 83   4   1.722222 NA    NA   NA   NA     2     1 60  45
    -#> 84   4   2.000000 NA    NA   NA   NA     2     1 60  45
    -#> 85   4   2.333333 NA    NA   NA   NA     2     1 60  45
    -#> 86   4   2.944444 NA    NA   NA   NA     2     1 60  45
    -#> 87   4   3.555556 NA    NA   NA   NA     2     1 60  45
    -#> 88   4   4.166667 NA    NA   NA   NA     2     1 60  45
    -#> 89   4   4.777778 NA    NA   NA   NA     2     1 60  45
    -#> 90   4   5.388889 NA    NA   NA   NA     2     1 60  45
    -#> 91   4   6.000000 NA    NA   NA   NA     2     1 60  45
    -#> 92   4  10.000000 NA    NA   NA   20     2     1 60  45
    -#> 93   4  24.000000 NA    NA   NA   NA     2     2 60  45
    -#> 94   4  34.666667 NA    NA   NA   NA     2     2 60  45
    -#> 95   4  36.000000 NA    NA   NA   NA     2     2 60  45
    -#> 96   4  45.333333 NA    NA   NA   NA     2     2 60  45
    -#> 97   4  56.000000 NA    NA   NA   NA     2     2 60  45
    -#> 98   4  66.666667 NA    NA   NA   NA     2     2 60  45
    -#> 99   4  72.000000 NA    NA   NA   NA     2     2 60  45
    -#> 100  4  77.333333 NA    NA   NA   NA     2     2 60  45
    -#> 101  4  88.000000 NA    NA   NA   NA     2     2 60  45
    -#> 102  4  98.666667 NA    NA   NA   NA     2     2 60  45
    -#> 103  4 109.333333 NA    NA   NA   NA     2     2 60  45
    -#> 104  4 120.000000 NA    NA   NA   NA     2     2 60  45
    -#> 105  5   0.500000 NA    NA   NA 1000     2     1 60  45
    -#> 106  5   0.500000 NA    NA   NA   NA     2     1 60  45
    -#> 107  5   1.000000 NA    NA   NA   NA     2     1 60  45
    -#> 108  5   1.111111 NA    NA   NA   NA     2     1 60  45
    -#> 109  5   1.722222 NA    NA   NA   NA     2     1 60  45
    -#> 110  5   2.000000 NA    NA   NA   NA     2     1 60  45
    -#> 111  5   2.333333 NA    NA   NA   NA     2     1 60  45
    -#> 112  5   2.944444 NA    NA   NA   NA     2     1 60  45
    -#> 113  5   3.555556 NA    NA   NA   NA     2     1 60  45
    -#> 114  5   4.166667 NA    NA   NA   NA     2     1 60  45
    -#> 115  5   4.777778 NA    NA   NA   NA     2     1 60  45
    -#> 116  5   5.388889 NA    NA   NA   NA     2     1 60  45
    -#> 117  5   6.000000 NA    NA   NA   NA     2     1 60  45
    -#> 118  5  10.000000 NA    NA   NA   20     2     1 60  45
    -#> 119  5  24.000000 NA    NA   NA   NA     2     2 60  45
    -#> 120  5  34.666667 NA    NA   NA   NA     2     2 60  45
    -#> 121  5  36.000000 NA    NA   NA   NA     2     2 60  45
    -#> 122  5  45.333333 NA    NA   NA   NA     2     2 60  45
    -#> 123  5  56.000000 NA    NA   NA   NA     2     2 60  45
    -#> 124  5  66.666667 NA    NA   NA   NA     2     2 60  45
    -#> 125  5  72.000000 NA    NA   NA   NA     2     2 60  45
    -#> 126  5  77.333333 NA    NA   NA   NA     2     2 60  45
    -#> 127  5  88.000000 NA    NA   NA   NA     2     2 60  45
    -#> 128  5  98.666667 NA    NA   NA   NA     2     2 60  45
    -#> 129  5 109.333333 NA    NA   NA   NA     2     2 60  45
    -#> 130  5 120.000000 NA    NA   NA   NA     2     2 60  45
    -#> 131  6   0.500000 NA    NA   NA 1000     2     1 60  45
    -#> 132  6   0.500000 NA    NA   NA   NA     2     1 60  45
    -#> 133  6   1.000000 NA    NA   NA   NA     2     1 60  45
    -#> 134  6   1.111111 NA    NA   NA   NA     2     1 60  45
    -#> 135  6   1.722222 NA    NA   NA   NA     2     1 60  45
    -#> 136  6   2.000000 NA    NA   NA   NA     2     1 60  45
    -#> 137  6   2.333333 NA    NA   NA   NA     2     1 60  45
    -#> 138  6   2.944444 NA    NA   NA   NA     2     1 60  45
    -#> 139  6   3.555556 NA    NA   NA   NA     2     1 60  45
    -#> 140  6   4.166667 NA    NA   NA   NA     2     1 60  45
    -#> 141  6   4.777778 NA    NA   NA   NA     2     1 60  45
    -#> 142  6   5.388889 NA    NA   NA   NA     2     1 60  45
    -#> 143  6   6.000000 NA    NA   NA   NA     2     1 60  45
    -#> 144  6  10.000000 NA    NA   NA   20     2     1 60  45
    -#> 145  6  24.000000 NA    NA   NA   NA     2     2 60  45
    -#> 146  6  34.666667 NA    NA   NA   NA     2     2 60  45
    -#> 147  6  36.000000 NA    NA   NA   NA     2     2 60  45
    -#> 148  6  45.333333 NA    NA   NA   NA     2     2 60  45
    -#> 149  6  56.000000 NA    NA   NA   NA     2     2 60  45
    -#> 150  6  66.666667 NA    NA   NA   NA     2     2 60  45
    -#> 151  6  72.000000 NA    NA   NA   NA     2     2 60  45
    -#> 152  6  77.333333 NA    NA   NA   NA     2     2 60  45
    -#> 153  6  88.000000 NA    NA   NA   NA     2     2 60  45
    -#> 154  6  98.666667 NA    NA   NA   NA     2     2 60  45
    -#> 155  6 109.333333 NA    NA   NA   NA     2     2 60  45
    -#> 156  6 120.000000 NA    NA   NA   NA     2     2 60  45
    -model_prediction(design=design_4,DV=TRUE,dosing=dosing_4,model_num_points = 10,
    -                 model_minxt=10,model_maxxt=100)
    -#>     ID  Time DV IPRED PRED  AMT Group Model WT AGE
    -#> 1    1   0.5 NA    NA   NA 1000     1     1 70  50
    -#> 2    1   0.5 NA    NA   NA   NA     1     1 70  50
    -#> 3    1   1.0 NA    NA   NA   NA     1     1 70  50
    -#> 4    1   2.0 NA    NA   NA   NA     1     1 70  50
    -#> 5    1   6.0 NA    NA   NA   NA     1     1 70  50
    -#> 6    1  10.0 NA    NA   NA   20     1     1 70  50
    -#> 7    1  10.0 NA    NA   NA   NA     1     1 70  50
    -#> 8    1  10.0 NA    NA   NA   NA     1     2 70  50
    -#> 9    1  20.0 NA    NA   NA   NA     1     1 70  50
    -#> 10   1  20.0 NA    NA   NA   NA     1     2 70  50
    -#> 11   1  24.0 NA    NA   NA   NA     1     2 70  50
    -#> 12   1  30.0 NA    NA   NA   NA     1     1 70  50
    -#> 13   1  30.0 NA    NA   NA   NA     1     2 70  50
    -#> 14   1  36.0 NA    NA   NA   NA     1     2 70  50
    -#> 15   1  40.0 NA    NA   NA   NA     1     1 70  50
    -#> 16   1  40.0 NA    NA   NA   NA     1     2 70  50
    -#> 17   1  50.0 NA    NA   NA   NA     1     1 70  50
    -#> 18   1  50.0 NA    NA   NA   NA     1     2 70  50
    -#> 19   1  60.0 NA    NA   NA   NA     1     1 70  50
    -#> 20   1  60.0 NA    NA   NA   NA     1     2 70  50
    -#> 21   1  70.0 NA    NA   NA   NA     1     1 70  50
    -#> 22   1  70.0 NA    NA   NA   NA     1     2 70  50
    -#> 23   1  72.0 NA    NA   NA   NA     1     2 70  50
    -#> 24   1  80.0 NA    NA   NA   NA     1     1 70  50
    -#> 25   1  80.0 NA    NA   NA   NA     1     2 70  50
    -#> 26   1  90.0 NA    NA   NA   NA     1     1 70  50
    -#> 27   1  90.0 NA    NA   NA   NA     1     2 70  50
    -#> 28   1 100.0 NA    NA   NA   NA     1     1 70  50
    -#> 29   1 100.0 NA    NA   NA   NA     1     2 70  50
    -#> 30   1 120.0 NA    NA   NA   NA     1     2 70  50
    -#> 31   2   0.5 NA    NA   NA 1000     1     1 70  50
    -#> 32   2   0.5 NA    NA   NA   NA     1     1 70  50
    -#> 33   2   1.0 NA    NA   NA   NA     1     1 70  50
    -#> 34   2   2.0 NA    NA   NA   NA     1     1 70  50
    -#> 35   2   6.0 NA    NA   NA   NA     1     1 70  50
    -#> 36   2  10.0 NA    NA   NA   20     1     1 70  50
    -#> 37   2  10.0 NA    NA   NA   NA     1     1 70  50
    -#> 38   2  10.0 NA    NA   NA   NA     1     2 70  50
    -#> 39   2  20.0 NA    NA   NA   NA     1     1 70  50
    -#> 40   2  20.0 NA    NA   NA   NA     1     2 70  50
    -#> 41   2  24.0 NA    NA   NA   NA     1     2 70  50
    -#> 42   2  30.0 NA    NA   NA   NA     1     1 70  50
    -#> 43   2  30.0 NA    NA   NA   NA     1     2 70  50
    -#> 44   2  36.0 NA    NA   NA   NA     1     2 70  50
    -#> 45   2  40.0 NA    NA   NA   NA     1     1 70  50
    -#> 46   2  40.0 NA    NA   NA   NA     1     2 70  50
    -#> 47   2  50.0 NA    NA   NA   NA     1     1 70  50
    -#> 48   2  50.0 NA    NA   NA   NA     1     2 70  50
    -#> 49   2  60.0 NA    NA   NA   NA     1     1 70  50
    -#> 50   2  60.0 NA    NA   NA   NA     1     2 70  50
    -#> 51   2  70.0 NA    NA   NA   NA     1     1 70  50
    -#> 52   2  70.0 NA    NA   NA   NA     1     2 70  50
    -#> 53   2  72.0 NA    NA   NA   NA     1     2 70  50
    -#> 54   2  80.0 NA    NA   NA   NA     1     1 70  50
    -#> 55   2  80.0 NA    NA   NA   NA     1     2 70  50
    -#> 56   2  90.0 NA    NA   NA   NA     1     1 70  50
    -#> 57   2  90.0 NA    NA   NA   NA     1     2 70  50
    -#> 58   2 100.0 NA    NA   NA   NA     1     1 70  50
    -#> 59   2 100.0 NA    NA   NA   NA     1     2 70  50
    -#> 60   2 120.0 NA    NA   NA   NA     1     2 70  50
    -#> 61   3   0.5 NA    NA   NA 1000     1     1 70  50
    -#> 62   3   0.5 NA    NA   NA   NA     1     1 70  50
    -#> 63   3   1.0 NA    NA   NA   NA     1     1 70  50
    -#> 64   3   2.0 NA    NA   NA   NA     1     1 70  50
    -#> 65   3   6.0 NA    NA   NA   NA     1     1 70  50
    -#> 66   3  10.0 NA    NA   NA   20     1     1 70  50
    -#> 67   3  10.0 NA    NA   NA   NA     1     1 70  50
    -#> 68   3  10.0 NA    NA   NA   NA     1     2 70  50
    -#> 69   3  20.0 NA    NA   NA   NA     1     1 70  50
    -#> 70   3  20.0 NA    NA   NA   NA     1     2 70  50
    -#> 71   3  24.0 NA    NA   NA   NA     1     2 70  50
    -#> 72   3  30.0 NA    NA   NA   NA     1     1 70  50
    -#> 73   3  30.0 NA    NA   NA   NA     1     2 70  50
    -#> 74   3  36.0 NA    NA   NA   NA     1     2 70  50
    -#> 75   3  40.0 NA    NA   NA   NA     1     1 70  50
    -#> 76   3  40.0 NA    NA   NA   NA     1     2 70  50
    -#> 77   3  50.0 NA    NA   NA   NA     1     1 70  50
    -#> 78   3  50.0 NA    NA   NA   NA     1     2 70  50
    -#> 79   3  60.0 NA    NA   NA   NA     1     1 70  50
    -#> 80   3  60.0 NA    NA   NA   NA     1     2 70  50
    -#> 81   3  70.0 NA    NA   NA   NA     1     1 70  50
    -#> 82   3  70.0 NA    NA   NA   NA     1     2 70  50
    -#> 83   3  72.0 NA    NA   NA   NA     1     2 70  50
    -#> 84   3  80.0 NA    NA   NA   NA     1     1 70  50
    -#> 85   3  80.0 NA    NA   NA   NA     1     2 70  50
    -#> 86   3  90.0 NA    NA   NA   NA     1     1 70  50
    -#> 87   3  90.0 NA    NA   NA   NA     1     2 70  50
    -#> 88   3 100.0 NA    NA   NA   NA     1     1 70  50
    -#> 89   3 100.0 NA    NA   NA   NA     1     2 70  50
    -#> 90   3 120.0 NA    NA   NA   NA     1     2 70  50
    -#> 91   4   0.5 NA    NA   NA 1000     2     1 60  45
    -#> 92   4   0.5 NA    NA   NA   NA     2     1 60  45
    -#> 93   4   1.0 NA    NA   NA   NA     2     1 60  45
    -#> 94   4   2.0 NA    NA   NA   NA     2     1 60  45
    -#> 95   4   6.0 NA    NA   NA   NA     2     1 60  45
    -#> 96   4  10.0 NA    NA   NA   20     2     1 60  45
    -#> 97   4  10.0 NA    NA   NA   NA     2     1 60  45
    -#> 98   4  10.0 NA    NA   NA   NA     2     2 60  45
    -#> 99   4  20.0 NA    NA   NA   NA     2     1 60  45
    -#> 100  4  20.0 NA    NA   NA   NA     2     2 60  45
    -#> 101  4  24.0 NA    NA   NA   NA     2     2 60  45
    -#> 102  4  30.0 NA    NA   NA   NA     2     1 60  45
    -#> 103  4  30.0 NA    NA   NA   NA     2     2 60  45
    -#> 104  4  36.0 NA    NA   NA   NA     2     2 60  45
    -#> 105  4  40.0 NA    NA   NA   NA     2     1 60  45
    -#> 106  4  40.0 NA    NA   NA   NA     2     2 60  45
    -#> 107  4  50.0 NA    NA   NA   NA     2     1 60  45
    -#> 108  4  50.0 NA    NA   NA   NA     2     2 60  45
    -#> 109  4  60.0 NA    NA   NA   NA     2     1 60  45
    -#> 110  4  60.0 NA    NA   NA   NA     2     2 60  45
    -#> 111  4  70.0 NA    NA   NA   NA     2     1 60  45
    -#> 112  4  70.0 NA    NA   NA   NA     2     2 60  45
    -#> 113  4  72.0 NA    NA   NA   NA     2     2 60  45
    -#> 114  4  80.0 NA    NA   NA   NA     2     1 60  45
    -#> 115  4  80.0 NA    NA   NA   NA     2     2 60  45
    -#> 116  4  90.0 NA    NA   NA   NA     2     1 60  45
    -#> 117  4  90.0 NA    NA   NA   NA     2     2 60  45
    -#> 118  4 100.0 NA    NA   NA   NA     2     1 60  45
    -#> 119  4 100.0 NA    NA   NA   NA     2     2 60  45
    -#> 120  4 120.0 NA    NA   NA   NA     2     2 60  45
    -#> 121  5   0.5 NA    NA   NA 1000     2     1 60  45
    -#> 122  5   0.5 NA    NA   NA   NA     2     1 60  45
    -#> 123  5   1.0 NA    NA   NA   NA     2     1 60  45
    -#> 124  5   2.0 NA    NA   NA   NA     2     1 60  45
    -#> 125  5   6.0 NA    NA   NA   NA     2     1 60  45
    -#> 126  5  10.0 NA    NA   NA   20     2     1 60  45
    -#> 127  5  10.0 NA    NA   NA   NA     2     1 60  45
    -#> 128  5  10.0 NA    NA   NA   NA     2     2 60  45
    -#> 129  5  20.0 NA    NA   NA   NA     2     1 60  45
    -#> 130  5  20.0 NA    NA   NA   NA     2     2 60  45
    -#> 131  5  24.0 NA    NA   NA   NA     2     2 60  45
    -#> 132  5  30.0 NA    NA   NA   NA     2     1 60  45
    -#> 133  5  30.0 NA    NA   NA   NA     2     2 60  45
    -#> 134  5  36.0 NA    NA   NA   NA     2     2 60  45
    -#> 135  5  40.0 NA    NA   NA   NA     2     1 60  45
    -#> 136  5  40.0 NA    NA   NA   NA     2     2 60  45
    -#> 137  5  50.0 NA    NA   NA   NA     2     1 60  45
    -#> 138  5  50.0 NA    NA   NA   NA     2     2 60  45
    -#> 139  5  60.0 NA    NA   NA   NA     2     1 60  45
    -#> 140  5  60.0 NA    NA   NA   NA     2     2 60  45
    -#> 141  5  70.0 NA    NA   NA   NA     2     1 60  45
    -#> 142  5  70.0 NA    NA   NA   NA     2     2 60  45
    -#> 143  5  72.0 NA    NA   NA   NA     2     2 60  45
    -#> 144  5  80.0 NA    NA   NA   NA     2     1 60  45
    -#> 145  5  80.0 NA    NA   NA   NA     2     2 60  45
    -#> 146  5  90.0 NA    NA   NA   NA     2     1 60  45
    -#> 147  5  90.0 NA    NA   NA   NA     2     2 60  45
    -#> 148  5 100.0 NA    NA   NA   NA     2     1 60  45
    -#> 149  5 100.0 NA    NA   NA   NA     2     2 60  45
    -#> 150  5 120.0 NA    NA   NA   NA     2     2 60  45
    -#> 151  6   0.5 NA    NA   NA 1000     2     1 60  45
    -#> 152  6   0.5 NA    NA   NA   NA     2     1 60  45
    -#> 153  6   1.0 NA    NA   NA   NA     2     1 60  45
    -#> 154  6   2.0 NA    NA   NA   NA     2     1 60  45
    -#> 155  6   6.0 NA    NA   NA   NA     2     1 60  45
    -#> 156  6  10.0 NA    NA   NA   20     2     1 60  45
    -#> 157  6  10.0 NA    NA   NA   NA     2     1 60  45
    -#> 158  6  10.0 NA    NA   NA   NA     2     2 60  45
    -#> 159  6  20.0 NA    NA   NA   NA     2     1 60  45
    -#> 160  6  20.0 NA    NA   NA   NA     2     2 60  45
    -#> 161  6  24.0 NA    NA   NA   NA     2     2 60  45
    -#> 162  6  30.0 NA    NA   NA   NA     2     1 60  45
    -#> 163  6  30.0 NA    NA   NA   NA     2     2 60  45
    -#> 164  6  36.0 NA    NA   NA   NA     2     2 60  45
    -#> 165  6  40.0 NA    NA   NA   NA     2     1 60  45
    -#> 166  6  40.0 NA    NA   NA   NA     2     2 60  45
    -#> 167  6  50.0 NA    NA   NA   NA     2     1 60  45
    -#> 168  6  50.0 NA    NA   NA   NA     2     2 60  45
    -#> 169  6  60.0 NA    NA   NA   NA     2     1 60  45
    -#> 170  6  60.0 NA    NA   NA   NA     2     2 60  45
    -#> 171  6  70.0 NA    NA   NA   NA     2     1 60  45
    -#> 172  6  70.0 NA    NA   NA   NA     2     2 60  45
    -#> 173  6  72.0 NA    NA   NA   NA     2     2 60  45
    -#> 174  6  80.0 NA    NA   NA   NA     2     1 60  45
    -#> 175  6  80.0 NA    NA   NA   NA     2     2 60  45
    -#> 176  6  90.0 NA    NA   NA   NA     2     1 60  45
    -#> 177  6  90.0 NA    NA   NA   NA     2     2 60  45
    -#> 178  6 100.0 NA    NA   NA   NA     2     1 60  45
    -#> 179  6 100.0 NA    NA   NA   NA     2     2 60  45
    -#> 180  6 120.0 NA    NA   NA   NA     2     2 60  45
    -model_prediction(design=design_4,DV=TRUE,dosing=dosing_4,model_num_points = 10,
    -                 model_minxt=c(20,20),model_maxxt=c(100,100))
    -#>     ID      Time DV IPRED PRED  AMT Group Model WT AGE
    -#> 1    1   0.50000 NA    NA   NA 1000     1     1 70  50
    -#> 2    1   0.50000 NA    NA   NA   NA     1     1 70  50
    -#> 3    1   1.00000 NA    NA   NA   NA     1     1 70  50
    -#> 4    1   2.00000 NA    NA   NA   NA     1     1 70  50
    -#> 5    1   6.00000 NA    NA   NA   NA     1     1 70  50
    -#> 6    1  10.00000 NA    NA   NA   20     1     1 70  50
    -#> 7    1  20.00000 NA    NA   NA   NA     1     1 70  50
    -#> 8    1  20.00000 NA    NA   NA   NA     1     2 70  50
    -#> 9    1  24.00000 NA    NA   NA   NA     1     2 70  50
    -#> 10   1  28.88889 NA    NA   NA   NA     1     1 70  50
    -#> 11   1  28.88889 NA    NA   NA   NA     1     2 70  50
    -#> 12   1  36.00000 NA    NA   NA   NA     1     2 70  50
    -#> 13   1  37.77778 NA    NA   NA   NA     1     1 70  50
    -#> 14   1  37.77778 NA    NA   NA   NA     1     2 70  50
    -#> 15   1  46.66667 NA    NA   NA   NA     1     1 70  50
    -#> 16   1  46.66667 NA    NA   NA   NA     1     2 70  50
    -#> 17   1  55.55556 NA    NA   NA   NA     1     1 70  50
    -#> 18   1  55.55556 NA    NA   NA   NA     1     2 70  50
    -#> 19   1  64.44444 NA    NA   NA   NA     1     1 70  50
    -#> 20   1  64.44444 NA    NA   NA   NA     1     2 70  50
    -#> 21   1  72.00000 NA    NA   NA   NA     1     2 70  50
    -#> 22   1  73.33333 NA    NA   NA   NA     1     1 70  50
    -#> 23   1  73.33333 NA    NA   NA   NA     1     2 70  50
    -#> 24   1  82.22222 NA    NA   NA   NA     1     1 70  50
    -#> 25   1  82.22222 NA    NA   NA   NA     1     2 70  50
    -#> 26   1  91.11111 NA    NA   NA   NA     1     1 70  50
    -#> 27   1  91.11111 NA    NA   NA   NA     1     2 70  50
    -#> 28   1 100.00000 NA    NA   NA   NA     1     1 70  50
    -#> 29   1 100.00000 NA    NA   NA   NA     1     2 70  50
    -#> 30   1 120.00000 NA    NA   NA   NA     1     2 70  50
    -#> 31   2   0.50000 NA    NA   NA 1000     1     1 70  50
    -#> 32   2   0.50000 NA    NA   NA   NA     1     1 70  50
    -#> 33   2   1.00000 NA    NA   NA   NA     1     1 70  50
    -#> 34   2   2.00000 NA    NA   NA   NA     1     1 70  50
    -#> 35   2   6.00000 NA    NA   NA   NA     1     1 70  50
    -#> 36   2  10.00000 NA    NA   NA   20     1     1 70  50
    -#> 37   2  20.00000 NA    NA   NA   NA     1     1 70  50
    -#> 38   2  20.00000 NA    NA   NA   NA     1     2 70  50
    -#> 39   2  24.00000 NA    NA   NA   NA     1     2 70  50
    -#> 40   2  28.88889 NA    NA   NA   NA     1     1 70  50
    -#> 41   2  28.88889 NA    NA   NA   NA     1     2 70  50
    -#> 42   2  36.00000 NA    NA   NA   NA     1     2 70  50
    -#> 43   2  37.77778 NA    NA   NA   NA     1     1 70  50
    -#> 44   2  37.77778 NA    NA   NA   NA     1     2 70  50
    -#> 45   2  46.66667 NA    NA   NA   NA     1     1 70  50
    -#> 46   2  46.66667 NA    NA   NA   NA     1     2 70  50
    -#> 47   2  55.55556 NA    NA   NA   NA     1     1 70  50
    -#> 48   2  55.55556 NA    NA   NA   NA     1     2 70  50
    -#> 49   2  64.44444 NA    NA   NA   NA     1     1 70  50
    -#> 50   2  64.44444 NA    NA   NA   NA     1     2 70  50
    -#> 51   2  72.00000 NA    NA   NA   NA     1     2 70  50
    -#> 52   2  73.33333 NA    NA   NA   NA     1     1 70  50
    -#> 53   2  73.33333 NA    NA   NA   NA     1     2 70  50
    -#> 54   2  82.22222 NA    NA   NA   NA     1     1 70  50
    -#> 55   2  82.22222 NA    NA   NA   NA     1     2 70  50
    -#> 56   2  91.11111 NA    NA   NA   NA     1     1 70  50
    -#> 57   2  91.11111 NA    NA   NA   NA     1     2 70  50
    -#> 58   2 100.00000 NA    NA   NA   NA     1     1 70  50
    -#> 59   2 100.00000 NA    NA   NA   NA     1     2 70  50
    -#> 60   2 120.00000 NA    NA   NA   NA     1     2 70  50
    -#> 61   3   0.50000 NA    NA   NA 1000     1     1 70  50
    -#> 62   3   0.50000 NA    NA   NA   NA     1     1 70  50
    -#> 63   3   1.00000 NA    NA   NA   NA     1     1 70  50
    -#> 64   3   2.00000 NA    NA   NA   NA     1     1 70  50
    -#> 65   3   6.00000 NA    NA   NA   NA     1     1 70  50
    -#> 66   3  10.00000 NA    NA   NA   20     1     1 70  50
    -#> 67   3  20.00000 NA    NA   NA   NA     1     1 70  50
    -#> 68   3  20.00000 NA    NA   NA   NA     1     2 70  50
    -#> 69   3  24.00000 NA    NA   NA   NA     1     2 70  50
    -#> 70   3  28.88889 NA    NA   NA   NA     1     1 70  50
    -#> 71   3  28.88889 NA    NA   NA   NA     1     2 70  50
    -#> 72   3  36.00000 NA    NA   NA   NA     1     2 70  50
    -#> 73   3  37.77778 NA    NA   NA   NA     1     1 70  50
    -#> 74   3  37.77778 NA    NA   NA   NA     1     2 70  50
    -#> 75   3  46.66667 NA    NA   NA   NA     1     1 70  50
    -#> 76   3  46.66667 NA    NA   NA   NA     1     2 70  50
    -#> 77   3  55.55556 NA    NA   NA   NA     1     1 70  50
    -#> 78   3  55.55556 NA    NA   NA   NA     1     2 70  50
    -#> 79   3  64.44444 NA    NA   NA   NA     1     1 70  50
    -#> 80   3  64.44444 NA    NA   NA   NA     1     2 70  50
    -#> 81   3  72.00000 NA    NA   NA   NA     1     2 70  50
    -#> 82   3  73.33333 NA    NA   NA   NA     1     1 70  50
    -#> 83   3  73.33333 NA    NA   NA   NA     1     2 70  50
    -#> 84   3  82.22222 NA    NA   NA   NA     1     1 70  50
    -#> 85   3  82.22222 NA    NA   NA   NA     1     2 70  50
    -#> 86   3  91.11111 NA    NA   NA   NA     1     1 70  50
    -#> 87   3  91.11111 NA    NA   NA   NA     1     2 70  50
    -#> 88   3 100.00000 NA    NA   NA   NA     1     1 70  50
    -#> 89   3 100.00000 NA    NA   NA   NA     1     2 70  50
    -#> 90   3 120.00000 NA    NA   NA   NA     1     2 70  50
    -#> 91   4   0.50000 NA    NA   NA 1000     2     1 60  45
    -#> 92   4   0.50000 NA    NA   NA   NA     2     1 60  45
    -#> 93   4   1.00000 NA    NA   NA   NA     2     1 60  45
    -#> 94   4   2.00000 NA    NA   NA   NA     2     1 60  45
    -#> 95   4   6.00000 NA    NA   NA   NA     2     1 60  45
    -#> 96   4  10.00000 NA    NA   NA   20     2     1 60  45
    -#> 97   4  20.00000 NA    NA   NA   NA     2     1 60  45
    -#> 98   4  20.00000 NA    NA   NA   NA     2     2 60  45
    -#> 99   4  24.00000 NA    NA   NA   NA     2     2 60  45
    -#> 100  4  28.88889 NA    NA   NA   NA     2     1 60  45
    -#> 101  4  28.88889 NA    NA   NA   NA     2     2 60  45
    -#> 102  4  36.00000 NA    NA   NA   NA     2     2 60  45
    -#> 103  4  37.77778 NA    NA   NA   NA     2     1 60  45
    -#> 104  4  37.77778 NA    NA   NA   NA     2     2 60  45
    -#> 105  4  46.66667 NA    NA   NA   NA     2     1 60  45
    -#> 106  4  46.66667 NA    NA   NA   NA     2     2 60  45
    -#> 107  4  55.55556 NA    NA   NA   NA     2     1 60  45
    -#> 108  4  55.55556 NA    NA   NA   NA     2     2 60  45
    -#> 109  4  64.44444 NA    NA   NA   NA     2     1 60  45
    -#> 110  4  64.44444 NA    NA   NA   NA     2     2 60  45
    -#> 111  4  72.00000 NA    NA   NA   NA     2     2 60  45
    -#> 112  4  73.33333 NA    NA   NA   NA     2     1 60  45
    -#> 113  4  73.33333 NA    NA   NA   NA     2     2 60  45
    -#> 114  4  82.22222 NA    NA   NA   NA     2     1 60  45
    -#> 115  4  82.22222 NA    NA   NA   NA     2     2 60  45
    -#> 116  4  91.11111 NA    NA   NA   NA     2     1 60  45
    -#> 117  4  91.11111 NA    NA   NA   NA     2     2 60  45
    -#> 118  4 100.00000 NA    NA   NA   NA     2     1 60  45
    -#> 119  4 100.00000 NA    NA   NA   NA     2     2 60  45
    -#> 120  4 120.00000 NA    NA   NA   NA     2     2 60  45
    -#> 121  5   0.50000 NA    NA   NA 1000     2     1 60  45
    -#> 122  5   0.50000 NA    NA   NA   NA     2     1 60  45
    -#> 123  5   1.00000 NA    NA   NA   NA     2     1 60  45
    -#> 124  5   2.00000 NA    NA   NA   NA     2     1 60  45
    -#> 125  5   6.00000 NA    NA   NA   NA     2     1 60  45
    -#> 126  5  10.00000 NA    NA   NA   20     2     1 60  45
    -#> 127  5  20.00000 NA    NA   NA   NA     2     1 60  45
    -#> 128  5  20.00000 NA    NA   NA   NA     2     2 60  45
    -#> 129  5  24.00000 NA    NA   NA   NA     2     2 60  45
    -#> 130  5  28.88889 NA    NA   NA   NA     2     1 60  45
    -#> 131  5  28.88889 NA    NA   NA   NA     2     2 60  45
    -#> 132  5  36.00000 NA    NA   NA   NA     2     2 60  45
    -#> 133  5  37.77778 NA    NA   NA   NA     2     1 60  45
    -#> 134  5  37.77778 NA    NA   NA   NA     2     2 60  45
    -#> 135  5  46.66667 NA    NA   NA   NA     2     1 60  45
    -#> 136  5  46.66667 NA    NA   NA   NA     2     2 60  45
    -#> 137  5  55.55556 NA    NA   NA   NA     2     1 60  45
    -#> 138  5  55.55556 NA    NA   NA   NA     2     2 60  45
    -#> 139  5  64.44444 NA    NA   NA   NA     2     1 60  45
    -#> 140  5  64.44444 NA    NA   NA   NA     2     2 60  45
    -#> 141  5  72.00000 NA    NA   NA   NA     2     2 60  45
    -#> 142  5  73.33333 NA    NA   NA   NA     2     1 60  45
    -#> 143  5  73.33333 NA    NA   NA   NA     2     2 60  45
    -#> 144  5  82.22222 NA    NA   NA   NA     2     1 60  45
    -#> 145  5  82.22222 NA    NA   NA   NA     2     2 60  45
    -#> 146  5  91.11111 NA    NA   NA   NA     2     1 60  45
    -#> 147  5  91.11111 NA    NA   NA   NA     2     2 60  45
    -#> 148  5 100.00000 NA    NA   NA   NA     2     1 60  45
    -#> 149  5 100.00000 NA    NA   NA   NA     2     2 60  45
    -#> 150  5 120.00000 NA    NA   NA   NA     2     2 60  45
    -#> 151  6   0.50000 NA    NA   NA 1000     2     1 60  45
    -#> 152  6   0.50000 NA    NA   NA   NA     2     1 60  45
    -#> 153  6   1.00000 NA    NA   NA   NA     2     1 60  45
    -#> 154  6   2.00000 NA    NA   NA   NA     2     1 60  45
    -#> 155  6   6.00000 NA    NA   NA   NA     2     1 60  45
    -#> 156  6  10.00000 NA    NA   NA   20     2     1 60  45
    -#> 157  6  20.00000 NA    NA   NA   NA     2     1 60  45
    -#> 158  6  20.00000 NA    NA   NA   NA     2     2 60  45
    -#> 159  6  24.00000 NA    NA   NA   NA     2     2 60  45
    -#> 160  6  28.88889 NA    NA   NA   NA     2     1 60  45
    -#> 161  6  28.88889 NA    NA   NA   NA     2     2 60  45
    -#> 162  6  36.00000 NA    NA   NA   NA     2     2 60  45
    -#> 163  6  37.77778 NA    NA   NA   NA     2     1 60  45
    -#> 164  6  37.77778 NA    NA   NA   NA     2     2 60  45
    -#> 165  6  46.66667 NA    NA   NA   NA     2     1 60  45
    -#> 166  6  46.66667 NA    NA   NA   NA     2     2 60  45
    -#> 167  6  55.55556 NA    NA   NA   NA     2     1 60  45
    -#> 168  6  55.55556 NA    NA   NA   NA     2     2 60  45
    -#> 169  6  64.44444 NA    NA   NA   NA     2     1 60  45
    -#> 170  6  64.44444 NA    NA   NA   NA     2     2 60  45
    -#> 171  6  72.00000 NA    NA   NA   NA     2     2 60  45
    -#> 172  6  73.33333 NA    NA   NA   NA     2     1 60  45
    -#> 173  6  73.33333 NA    NA   NA   NA     2     2 60  45
    -#> 174  6  82.22222 NA    NA   NA   NA     2     1 60  45
    -#> 175  6  82.22222 NA    NA   NA   NA     2     2 60  45
    -#> 176  6  91.11111 NA    NA   NA   NA     2     1 60  45
    -#> 177  6  91.11111 NA    NA   NA   NA     2     2 60  45
    -#> 178  6 100.00000 NA    NA   NA   NA     2     1 60  45
    -#> 179  6 100.00000 NA    NA   NA   NA     2     2 60  45
    -#> 180  6 120.00000 NA    NA   NA   NA     2     2 60  45
    -model_prediction(design=design_4,DV=TRUE,dosing=dosing_4,model_num_points = c(10,10),
    -                 model_minxt=c(20,20),model_maxxt=c(100,100))
    -#>     ID      Time DV IPRED PRED  AMT Group Model WT AGE
    -#> 1    1   0.50000 NA    NA   NA 1000     1     1 70  50
    -#> 2    1   0.50000 NA    NA   NA   NA     1     1 70  50
    -#> 3    1   1.00000 NA    NA   NA   NA     1     1 70  50
    -#> 4    1   2.00000 NA    NA   NA   NA     1     1 70  50
    -#> 5    1   6.00000 NA    NA   NA   NA     1     1 70  50
    -#> 6    1  10.00000 NA    NA   NA   20     1     1 70  50
    -#> 7    1  20.00000 NA    NA   NA   NA     1     1 70  50
    -#> 8    1  20.00000 NA    NA   NA   NA     1     2 70  50
    -#> 9    1  24.00000 NA    NA   NA   NA     1     2 70  50
    -#> 10   1  28.88889 NA    NA   NA   NA     1     1 70  50
    -#> 11   1  28.88889 NA    NA   NA   NA     1     2 70  50
    -#> 12   1  36.00000 NA    NA   NA   NA     1     2 70  50
    -#> 13   1  37.77778 NA    NA   NA   NA     1     1 70  50
    -#> 14   1  37.77778 NA    NA   NA   NA     1     2 70  50
    -#> 15   1  46.66667 NA    NA   NA   NA     1     1 70  50
    -#> 16   1  46.66667 NA    NA   NA   NA     1     2 70  50
    -#> 17   1  55.55556 NA    NA   NA   NA     1     1 70  50
    -#> 18   1  55.55556 NA    NA   NA   NA     1     2 70  50
    -#> 19   1  64.44444 NA    NA   NA   NA     1     1 70  50
    -#> 20   1  64.44444 NA    NA   NA   NA     1     2 70  50
    -#> 21   1  72.00000 NA    NA   NA   NA     1     2 70  50
    -#> 22   1  73.33333 NA    NA   NA   NA     1     1 70  50
    -#> 23   1  73.33333 NA    NA   NA   NA     1     2 70  50
    -#> 24   1  82.22222 NA    NA   NA   NA     1     1 70  50
    -#> 25   1  82.22222 NA    NA   NA   NA     1     2 70  50
    -#> 26   1  91.11111 NA    NA   NA   NA     1     1 70  50
    -#> 27   1  91.11111 NA    NA   NA   NA     1     2 70  50
    -#> 28   1 100.00000 NA    NA   NA   NA     1     1 70  50
    -#> 29   1 100.00000 NA    NA   NA   NA     1     2 70  50
    -#> 30   1 120.00000 NA    NA   NA   NA     1     2 70  50
    -#> 31   2   0.50000 NA    NA   NA 1000     1     1 70  50
    -#> 32   2   0.50000 NA    NA   NA   NA     1     1 70  50
    -#> 33   2   1.00000 NA    NA   NA   NA     1     1 70  50
    -#> 34   2   2.00000 NA    NA   NA   NA     1     1 70  50
    -#> 35   2   6.00000 NA    NA   NA   NA     1     1 70  50
    -#> 36   2  10.00000 NA    NA   NA   20     1     1 70  50
    -#> 37   2  20.00000 NA    NA   NA   NA     1     1 70  50
    -#> 38   2  20.00000 NA    NA   NA   NA     1     2 70  50
    -#> 39   2  24.00000 NA    NA   NA   NA     1     2 70  50
    -#> 40   2  28.88889 NA    NA   NA   NA     1     1 70  50
    -#> 41   2  28.88889 NA    NA   NA   NA     1     2 70  50
    -#> 42   2  36.00000 NA    NA   NA   NA     1     2 70  50
    -#> 43   2  37.77778 NA    NA   NA   NA     1     1 70  50
    -#> 44   2  37.77778 NA    NA   NA   NA     1     2 70  50
    -#> 45   2  46.66667 NA    NA   NA   NA     1     1 70  50
    -#> 46   2  46.66667 NA    NA   NA   NA     1     2 70  50
    -#> 47   2  55.55556 NA    NA   NA   NA     1     1 70  50
    -#> 48   2  55.55556 NA    NA   NA   NA     1     2 70  50
    -#> 49   2  64.44444 NA    NA   NA   NA     1     1 70  50
    -#> 50   2  64.44444 NA    NA   NA   NA     1     2 70  50
    -#> 51   2  72.00000 NA    NA   NA   NA     1     2 70  50
    -#> 52   2  73.33333 NA    NA   NA   NA     1     1 70  50
    -#> 53   2  73.33333 NA    NA   NA   NA     1     2 70  50
    -#> 54   2  82.22222 NA    NA   NA   NA     1     1 70  50
    -#> 55   2  82.22222 NA    NA   NA   NA     1     2 70  50
    -#> 56   2  91.11111 NA    NA   NA   NA     1     1 70  50
    -#> 57   2  91.11111 NA    NA   NA   NA     1     2 70  50
    -#> 58   2 100.00000 NA    NA   NA   NA     1     1 70  50
    -#> 59   2 100.00000 NA    NA   NA   NA     1     2 70  50
    -#> 60   2 120.00000 NA    NA   NA   NA     1     2 70  50
    -#> 61   3   0.50000 NA    NA   NA 1000     1     1 70  50
    -#> 62   3   0.50000 NA    NA   NA   NA     1     1 70  50
    -#> 63   3   1.00000 NA    NA   NA   NA     1     1 70  50
    -#> 64   3   2.00000 NA    NA   NA   NA     1     1 70  50
    -#> 65   3   6.00000 NA    NA   NA   NA     1     1 70  50
    -#> 66   3  10.00000 NA    NA   NA   20     1     1 70  50
    -#> 67   3  20.00000 NA    NA   NA   NA     1     1 70  50
    -#> 68   3  20.00000 NA    NA   NA   NA     1     2 70  50
    -#> 69   3  24.00000 NA    NA   NA   NA     1     2 70  50
    -#> 70   3  28.88889 NA    NA   NA   NA     1     1 70  50
    -#> 71   3  28.88889 NA    NA   NA   NA     1     2 70  50
    -#> 72   3  36.00000 NA    NA   NA   NA     1     2 70  50
    -#> 73   3  37.77778 NA    NA   NA   NA     1     1 70  50
    -#> 74   3  37.77778 NA    NA   NA   NA     1     2 70  50
    -#> 75   3  46.66667 NA    NA   NA   NA     1     1 70  50
    -#> 76   3  46.66667 NA    NA   NA   NA     1     2 70  50
    -#> 77   3  55.55556 NA    NA   NA   NA     1     1 70  50
    -#> 78   3  55.55556 NA    NA   NA   NA     1     2 70  50
    -#> 79   3  64.44444 NA    NA   NA   NA     1     1 70  50
    -#> 80   3  64.44444 NA    NA   NA   NA     1     2 70  50
    -#> 81   3  72.00000 NA    NA   NA   NA     1     2 70  50
    -#> 82   3  73.33333 NA    NA   NA   NA     1     1 70  50
    -#> 83   3  73.33333 NA    NA   NA   NA     1     2 70  50
    -#> 84   3  82.22222 NA    NA   NA   NA     1     1 70  50
    -#> 85   3  82.22222 NA    NA   NA   NA     1     2 70  50
    -#> 86   3  91.11111 NA    NA   NA   NA     1     1 70  50
    -#> 87   3  91.11111 NA    NA   NA   NA     1     2 70  50
    -#> 88   3 100.00000 NA    NA   NA   NA     1     1 70  50
    -#> 89   3 100.00000 NA    NA   NA   NA     1     2 70  50
    -#> 90   3 120.00000 NA    NA   NA   NA     1     2 70  50
    -#> 91   4   0.50000 NA    NA   NA 1000     2     1 60  45
    -#> 92   4   0.50000 NA    NA   NA   NA     2     1 60  45
    -#> 93   4   1.00000 NA    NA   NA   NA     2     1 60  45
    -#> 94   4   2.00000 NA    NA   NA   NA     2     1 60  45
    -#> 95   4   6.00000 NA    NA   NA   NA     2     1 60  45
    -#> 96   4  10.00000 NA    NA   NA   20     2     1 60  45
    -#> 97   4  20.00000 NA    NA   NA   NA     2     1 60  45
    -#> 98   4  20.00000 NA    NA   NA   NA     2     2 60  45
    -#> 99   4  24.00000 NA    NA   NA   NA     2     2 60  45
    -#> 100  4  28.88889 NA    NA   NA   NA     2     1 60  45
    -#> 101  4  28.88889 NA    NA   NA   NA     2     2 60  45
    -#> 102  4  36.00000 NA    NA   NA   NA     2     2 60  45
    -#> 103  4  37.77778 NA    NA   NA   NA     2     1 60  45
    -#> 104  4  37.77778 NA    NA   NA   NA     2     2 60  45
    -#> 105  4  46.66667 NA    NA   NA   NA     2     1 60  45
    -#> 106  4  46.66667 NA    NA   NA   NA     2     2 60  45
    -#> 107  4  55.55556 NA    NA   NA   NA     2     1 60  45
    -#> 108  4  55.55556 NA    NA   NA   NA     2     2 60  45
    -#> 109  4  64.44444 NA    NA   NA   NA     2     1 60  45
    -#> 110  4  64.44444 NA    NA   NA   NA     2     2 60  45
    -#> 111  4  72.00000 NA    NA   NA   NA     2     2 60  45
    -#> 112  4  73.33333 NA    NA   NA   NA     2     1 60  45
    -#> 113  4  73.33333 NA    NA   NA   NA     2     2 60  45
    -#> 114  4  82.22222 NA    NA   NA   NA     2     1 60  45
    -#> 115  4  82.22222 NA    NA   NA   NA     2     2 60  45
    -#> 116  4  91.11111 NA    NA   NA   NA     2     1 60  45
    -#> 117  4  91.11111 NA    NA   NA   NA     2     2 60  45
    -#> 118  4 100.00000 NA    NA   NA   NA     2     1 60  45
    -#> 119  4 100.00000 NA    NA   NA   NA     2     2 60  45
    -#> 120  4 120.00000 NA    NA   NA   NA     2     2 60  45
    -#> 121  5   0.50000 NA    NA   NA 1000     2     1 60  45
    -#> 122  5   0.50000 NA    NA   NA   NA     2     1 60  45
    -#> 123  5   1.00000 NA    NA   NA   NA     2     1 60  45
    -#> 124  5   2.00000 NA    NA   NA   NA     2     1 60  45
    -#> 125  5   6.00000 NA    NA   NA   NA     2     1 60  45
    -#> 126  5  10.00000 NA    NA   NA   20     2     1 60  45
    -#> 127  5  20.00000 NA    NA   NA   NA     2     1 60  45
    -#> 128  5  20.00000 NA    NA   NA   NA     2     2 60  45
    -#> 129  5  24.00000 NA    NA   NA   NA     2     2 60  45
    -#> 130  5  28.88889 NA    NA   NA   NA     2     1 60  45
    -#> 131  5  28.88889 NA    NA   NA   NA     2     2 60  45
    -#> 132  5  36.00000 NA    NA   NA   NA     2     2 60  45
    -#> 133  5  37.77778 NA    NA   NA   NA     2     1 60  45
    -#> 134  5  37.77778 NA    NA   NA   NA     2     2 60  45
    -#> 135  5  46.66667 NA    NA   NA   NA     2     1 60  45
    -#> 136  5  46.66667 NA    NA   NA   NA     2     2 60  45
    -#> 137  5  55.55556 NA    NA   NA   NA     2     1 60  45
    -#> 138  5  55.55556 NA    NA   NA   NA     2     2 60  45
    -#> 139  5  64.44444 NA    NA   NA   NA     2     1 60  45
    -#> 140  5  64.44444 NA    NA   NA   NA     2     2 60  45
    -#> 141  5  72.00000 NA    NA   NA   NA     2     2 60  45
    -#> 142  5  73.33333 NA    NA   NA   NA     2     1 60  45
    -#> 143  5  73.33333 NA    NA   NA   NA     2     2 60  45
    -#> 144  5  82.22222 NA    NA   NA   NA     2     1 60  45
    -#> 145  5  82.22222 NA    NA   NA   NA     2     2 60  45
    -#> 146  5  91.11111 NA    NA   NA   NA     2     1 60  45
    -#> 147  5  91.11111 NA    NA   NA   NA     2     2 60  45
    -#> 148  5 100.00000 NA    NA   NA   NA     2     1 60  45
    -#> 149  5 100.00000 NA    NA   NA   NA     2     2 60  45
    -#> 150  5 120.00000 NA    NA   NA   NA     2     2 60  45
    -#> 151  6   0.50000 NA    NA   NA 1000     2     1 60  45
    -#> 152  6   0.50000 NA    NA   NA   NA     2     1 60  45
    -#> 153  6   1.00000 NA    NA   NA   NA     2     1 60  45
    -#> 154  6   2.00000 NA    NA   NA   NA     2     1 60  45
    -#> 155  6   6.00000 NA    NA   NA   NA     2     1 60  45
    -#> 156  6  10.00000 NA    NA   NA   20     2     1 60  45
    -#> 157  6  20.00000 NA    NA   NA   NA     2     1 60  45
    -#> 158  6  20.00000 NA    NA   NA   NA     2     2 60  45
    -#> 159  6  24.00000 NA    NA   NA   NA     2     2 60  45
    -#> 160  6  28.88889 NA    NA   NA   NA     2     1 60  45
    -#> 161  6  28.88889 NA    NA   NA   NA     2     2 60  45
    -#> 162  6  36.00000 NA    NA   NA   NA     2     2 60  45
    -#> 163  6  37.77778 NA    NA   NA   NA     2     1 60  45
    -#> 164  6  37.77778 NA    NA   NA   NA     2     2 60  45
    -#> 165  6  46.66667 NA    NA   NA   NA     2     1 60  45
    -#> 166  6  46.66667 NA    NA   NA   NA     2     2 60  45
    -#> 167  6  55.55556 NA    NA   NA   NA     2     1 60  45
    -#> 168  6  55.55556 NA    NA   NA   NA     2     2 60  45
    -#> 169  6  64.44444 NA    NA   NA   NA     2     1 60  45
    -#> 170  6  64.44444 NA    NA   NA   NA     2     2 60  45
    -#> 171  6  72.00000 NA    NA   NA   NA     2     2 60  45
    -#> 172  6  73.33333 NA    NA   NA   NA     2     1 60  45
    -#> 173  6  73.33333 NA    NA   NA   NA     2     2 60  45
    -#> 174  6  82.22222 NA    NA   NA   NA     2     1 60  45
    -#> 175  6  82.22222 NA    NA   NA   NA     2     2 60  45
    -#> 176  6  91.11111 NA    NA   NA   NA     2     1 60  45
    -#> 177  6  91.11111 NA    NA   NA   NA     2     2 60  45
    -#> 178  6 100.00000 NA    NA   NA   NA     2     1 60  45
    -#> 179  6 100.00000 NA    NA   NA   NA     2     2 60  45
    -#> 180  6 120.00000 NA    NA   NA   NA     2     2 60  45
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/ofv_criterion.html b/docs/reference/ofv_criterion.html deleted file mode 100644 index d52f66c3..00000000 --- a/docs/reference/ofv_criterion.html +++ /dev/null @@ -1,286 +0,0 @@ - -Normalize an objective function by the size of the FIM matrix — ofv_criterion • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Compute a normalized OFV based on the size of the FIM matrix. This value can then be used in -efficiency calculations. This is NOT the OFV used in optimization, see ofv_fim.

    -
    - -
    -
    ofv_criterion(
    -  ofv_f,
    -  num_parameters,
    -  poped.db,
    -  ofv_calc_type = poped.db$settings$ofv_calc_type
    -)
    -
    - -
    -

    Arguments

    -
    ofv_f
    -

    An objective function

    - - -
    num_parameters
    -

    The number of parameters to use for normalization

    - - -
    poped.db
    -

    a poped database

    - - -
    ofv_calc_type
    -

    OFV calculation type for FIM

    • 1 = "D-optimality". Determinant of the FIM: det(FIM)

    • -
    • 2 = "A-optimality". Inverse of the sum of the expected parameter variances: -1/trace_matrix(inv(FIM))

    • -
    • 4 = "lnD-optimality". Natural logarithm of the determinant of the FIM: log(det(FIM))

    • -
    • 6 = "Ds-optimality". Ratio of the Determinant of the FIM and the Determinant of the uninteresting -rows and columns of the FIM: det(FIM)/det(FIM_u)

    • -
    • 7 = Inverse of the sum of the expected parameter RSE: 1/sum(get_rse(FIM,poped.db,use_percent=FALSE))

    • -
    - -
    -
    -

    Value

    - - -

    The specified criterion value.

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -## evaluate initial design 
    -FIM <- evaluate.fim(poped.db) # new name for function needed
    -FIM
    -#>             [,1]      [,2]      [,3]         [,4]         [,5]        [,6]
    -#> [1,] 17141.83891 20.838375 10.011000 0.000000e+00     0.000000  0.00000000
    -#> [2,]    20.83837 17.268051 -3.423641 0.000000e+00     0.000000  0.00000000
    -#> [3,]    10.01100 -3.423641 49.864697 0.000000e+00     0.000000  0.00000000
    -#> [4,]     0.00000  0.000000  0.000000 2.324341e+03     9.770352  0.03523364
    -#> [5,]     0.00000  0.000000  0.000000 9.770352e+00 19083.877564 11.72131703
    -#> [6,]     0.00000  0.000000  0.000000 3.523364e-02    11.721317 38.85137516
    -#> [7,]     0.00000  0.000000  0.000000 7.268410e+02  9656.158553 64.78095548
    -#> [8,]     0.00000  0.000000  0.000000 9.062739e+01   266.487127  2.94728469
    -#>              [,7]        [,8]
    -#> [1,]      0.00000    0.000000
    -#> [2,]      0.00000    0.000000
    -#> [3,]      0.00000    0.000000
    -#> [4,]    726.84097   90.627386
    -#> [5,]   9656.15855  266.487127
    -#> [6,]     64.78096    2.947285
    -#> [7,] 192840.20092 6659.569867
    -#> [8,]   6659.56987  475.500111
    -get_rse(FIM,poped.db)
    -#>        CL         V        KA      d_CL       d_V      d_KA  sig_prop   sig_add 
    -#>  5.096246  3.031164 14.260384 29.761226 36.681388 26.748640 32.011719 25.637971 
    -
    -ofv_criterion(ofv_fim(FIM,poped.db,ofv_calc_type=1),
    -              length(get_unfixed_params(poped.db)[["all"]]),
    -              poped.db,
    -              ofv_calc_type=1) # det(FIM)
    -#> [1] 1016.943
    -
    -ofv_criterion(ofv_fim(FIM,poped.db,ofv_calc_type=2),
    -              length(get_unfixed_params(poped.db)[["all"]]),
    -              poped.db,
    -              ofv_calc_type=2) 
    -#> [1] 1.140916
    -
    -ofv_criterion(ofv_fim(FIM,poped.db,ofv_calc_type=4),
    -              length(get_unfixed_params(poped.db)[["all"]]),
    -              poped.db,
    -              ofv_calc_type=4)
    -#> [1] 1016.943
    -
    -ofv_criterion(ofv_fim(FIM,poped.db,ofv_calc_type=6),
    -              length(get_unfixed_params(poped.db)[["all"]]),
    -              poped.db,
    -              ofv_calc_type=6)
    -#> [1] 1.75168
    -
    -ofv_criterion(ofv_fim(FIM,poped.db,ofv_calc_type=7),
    -              length(get_unfixed_params(poped.db)[["all"]]),
    -              poped.db,
    -              ofv_calc_type=7) 
    -#> [1] 0
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/ofv_fim.html b/docs/reference/ofv_fim.html deleted file mode 100644 index 0c2e8c6b..00000000 --- a/docs/reference/ofv_fim.html +++ /dev/null @@ -1,289 +0,0 @@ - -Evaluate a criterion of the Fisher Information Matrix (FIM) — ofv_fim • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Compute a criterion of the FIM given the model, parameters, design and methods defined in the -PopED database.

    -
    - -
    -
    ofv_fim(
    -  fmf,
    -  poped.db,
    -  ofv_calc_type = poped.db$settings$ofv_calc_type,
    -  ds_index = poped.db$parameters$ds_index,
    -  use_log = TRUE,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    fmf
    -

    The FIM

    - - -
    poped.db
    -

    A poped database

    - - -
    ofv_calc_type
    -

    OFV calculation type for FIM

    • 1 = "D-optimality". Determinant of the FIM: det(FIM)

    • -
    • 2 = "A-optimality". Inverse of the sum of the expected parameter variances: -1/trace_matrix(inv(FIM))

    • -
    • 4 = "lnD-optimality". Natural logarithm of the determinant of the FIM: log(det(FIM))

    • -
    • 6 = "Ds-optimality". Ratio of the Determinant of the FIM and the Determinant of the uninteresting -rows and columns of the FIM: det(FIM)/det(FIM_u)

    • -
    • 7 = Inverse of the sum of the expected parameter RSE: 1/sum(get_rse(FIM,poped.db,use_percent=FALSE))

    • -
    - - -
    ds_index
    -

    Ds_index is a vector set to 1 if a parameter is uninteresting, otherwise 0. -size=(1,num unfixed parameters). First unfixed bpop, then unfixed d, then unfixed docc and last unfixed sigma. -Default is the fixed effects being important, everything else not important. Used in conjunction with -ofv_calc_type=6.

    - - -
    use_log
    -

    Should the criterion be in the log domain?

    - - -
    ...
    -

    arguments passed to evaluate.fim and ofv_fim.

    - -
    -
    -

    Value

    - - -

    The specified criterion value.

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -## evaluate initial design 
    -FIM <- evaluate.fim(poped.db) 
    -FIM
    -#>             [,1]      [,2]      [,3]         [,4]         [,5]        [,6]
    -#> [1,] 17141.83891 20.838375 10.011000 0.000000e+00     0.000000  0.00000000
    -#> [2,]    20.83837 17.268051 -3.423641 0.000000e+00     0.000000  0.00000000
    -#> [3,]    10.01100 -3.423641 49.864697 0.000000e+00     0.000000  0.00000000
    -#> [4,]     0.00000  0.000000  0.000000 2.324341e+03     9.770352  0.03523364
    -#> [5,]     0.00000  0.000000  0.000000 9.770352e+00 19083.877564 11.72131703
    -#> [6,]     0.00000  0.000000  0.000000 3.523364e-02    11.721317 38.85137516
    -#> [7,]     0.00000  0.000000  0.000000 7.268410e+02  9656.158553 64.78095548
    -#> [8,]     0.00000  0.000000  0.000000 9.062739e+01   266.487127  2.94728469
    -#>              [,7]        [,8]
    -#> [1,]      0.00000    0.000000
    -#> [2,]      0.00000    0.000000
    -#> [3,]      0.00000    0.000000
    -#> [4,]    726.84097   90.627386
    -#> [5,]   9656.15855  266.487127
    -#> [6,]     64.78096    2.947285
    -#> [7,] 192840.20092 6659.569867
    -#> [8,]   6659.56987  475.500111
    -get_rse(FIM,poped.db)
    -#>        CL         V        KA      d_CL       d_V      d_KA  sig_prop   sig_add 
    -#>  5.096246  3.031164 14.260384 29.761226 36.681388 26.748640 32.011719 25.637971 
    -
    -det(FIM)
    -#> [1] 1.143859e+24
    -ofv_fim(FIM,poped.db,ofv_calc_type=1) # det(FIM)
    -#> [1] 1.143859e+24
    -ofv_fim(FIM,poped.db,ofv_calc_type=2) # 1/trace_matrix(inv(FIM))
    -#> [1] 9.127328
    -ofv_fim(FIM,poped.db,ofv_calc_type=4) # log(det(FIM)) 
    -#> [1] 55.39645
    -ofv_fim(FIM,poped.db,ofv_calc_type=6) # Ds with fixed effects as "important"
    -#> [1] 16.49204
    -ofv_fim(FIM,poped.db,ofv_calc_type=6,
    -        ds_index=c(1,1,1,0,0,0,1,1)) # Ds with random effects as "important"
    -#> [1] 21.23143
    -ofv_fim(FIM,poped.db,ofv_calc_type=7) # 1/sum(get_rse(FIM,poped.db,use_percent=FALSE))
    -#> [1] 0.5772714
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/ones.html b/docs/reference/ones.html deleted file mode 100644 index ddf4123e..00000000 --- a/docs/reference/ones.html +++ /dev/null @@ -1,156 +0,0 @@ - -Create a matrix of ones — ones • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Create a matrix of ones of size (dim1 x dim2).

    -
    - -
    -
    ones(dim1, dim2 = NULL)
    -
    - -
    -

    Arguments

    -
    dim1
    -

    The dimension of the matrix (if square) or the number of rows.

    - - -
    dim2
    -

    The number of columns

    - -
    -
    -

    Value

    - - -

    A matrix of ones

    -
    -
    -

    See also

    -

    Other MATLAB: -cell(), -diag_matlab(), -feval(), -fileparts(), -isempty(), -randn(), -rand(), -size(), -tic(), -toc(), -zeros()

    -
    - -
    -

    Examples

    -
    
    -ones(4)
    -#>      [,1] [,2] [,3] [,4]
    -#> [1,]    1    1    1    1
    -#> [2,]    1    1    1    1
    -#> [3,]    1    1    1    1
    -#> [4,]    1    1    1    1
    -ones(3,4)
    -#>      [,1] [,2] [,3] [,4]
    -#> [1,]    1    1    1    1
    -#> [2,]    1    1    1    1
    -#> [3,]    1    1    1    1
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/optim_ARS.html b/docs/reference/optim_ARS.html deleted file mode 100644 index bf817caa..00000000 --- a/docs/reference/optim_ARS.html +++ /dev/null @@ -1,878 +0,0 @@ - -Optimize a function using adaptive random search. — optim_ARS • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Optimize an objective function using an adaptive random search algorithm. -The function works for both discrete and continuous optimization parameters -and allows for box-constraints and sets of allowed values.

    -
    - -
    -
    optim_ARS(
    -  par,
    -  fn,
    -  lower = NULL,
    -  upper = NULL,
    -  allowed_values = NULL,
    -  loc_fac = 4,
    -  no_bounds_sd = par,
    -  iter = 400,
    -  iter_adapt = 50,
    -  adapt_scale = 1,
    -  max_run = 200,
    -  trace = TRUE,
    -  trace_iter = 5,
    -  new_par_max_it = 200,
    -  maximize = F,
    -  parallel = F,
    -  parallel_type = NULL,
    -  num_cores = NULL,
    -  mrgsolve_model = NULL,
    -  seed = round(runif(1, 0, 1e+07)),
    -  allow_replicates = TRUE,
    -  replicates_index = seq(1, length(par)),
    -  generator = NULL,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    par
    -

    A vector of initial values for the parameters to be optimized over.

    - - -
    fn
    -

    A function to be minimized (or maximized), -with first argument the vector of parameters over which minimization is to take place. -It should return a scalar result.

    - - -
    lower
    -

    Lower bounds on the parameters. A vector.

    - - -
    upper
    -

    Upper bounds on the parameters. A vector.

    - - -
    allowed_values
    -

    A list containing allowed values for each parameter list(par1=c(2,3,4,5,6),par2=c(5,6,7,8)). -A vector containing allowed values for all parameters is also allowed c(2,3,4,5,6).

    - - -
    loc_fac
    -

    Locality factor for determining the standard deviation of the sampling distribution around the current -position of the parameters. The initial standard deviation is normally calculated as (upper - lower)/loc_fac -except in cases when there are no upper or lower limits (e.g. when upper=Inf or lower=-Inf).

    - - -
    no_bounds_sd
    -

    The standard deviation of the sampling distribution around the current -position of the parameters when there are no upper or lower limits (e.g. when upper=Inf or lower=-Inf).

    - - -
    iter
    -

    The number of iterations for the algorithm to perform (this is a maximum number, it could be less).

    - - -
    iter_adapt
    -

    The number of iterations before adapting (shrinking) the parameter search space.

    - - -
    adapt_scale
    -

    The scale for adapting the size of the sampling distribution. The adaptation of the -standard deviation of the sampling distribution around the current -position of the parameters is done after iter_adapt iteration with no change in the best objective function. -When adapting, the standard deviation of the sampling distribution is calculated as -(upper - lower)/(loc_fac*ff*adapt_scale) where ff starts at 1 and increases by 1 for each adaptation.

    - - -
    max_run
    -

    The maximum number of iterations to run without a change in the best parameter estimates.

    - - -
    trace
    -

    Should the algorithm output results intermittently.

    - - -
    trace_iter
    -

    How many iterations between each update to the screen about the result of the search.

    - - -
    new_par_max_it
    -

    The algorithm randomly chooses samples based on the current best set of parameters. If when drawing -these samples the new parameter set has already been tested then a new draw is performed. After new_par_max_it draws, with -no new parameter sets, then the algorithm stops.

    - - -
    maximize
    -

    Should the function be maximized? Default is to minimize.

    - - -
    parallel
    -

    Should we use parallel computations?

    - - -
    parallel_type
    -

    Which type of parallelization should be used? -Can be "snow" or "multicore". "snow" works on Linux-like systems & Windows. "multicore" works only on -Linux-like systems. By default this is chosen for you depending on your operating system. -See start_parallel.

    - - -
    num_cores
    -

    The number of cores to use in the parallelization. By default is set to the number - output from -parallel::detectCores(). -See start_parallel.

    - - -
    mrgsolve_model
    -

    If the computations require a mrgsolve model and you -are using the "snow" method then you need to specify the name of the model -object created by mread or mcode.

    - - -
    seed
    -

    The random seed to use in the algorithm,

    - - -
    allow_replicates
    -

    Should the algorithm allow parameters to have the same value?

    - - -
    replicates_index
    -

    A vector, the same length as the parameters. -If two values are the same in this vector then the parameters may not assume the same value in the optimization.

    - - -
    generator
    -

    A user-defined function that generates new parameter sets to try in the algorithm. See examples below.

    - - -
    ...
    -

    Additional arguments passed to fn and start_parallel.

    - -
    -
    -

    References

    - -
    1. M. Foracchia, A.C. Hooker, P. Vicini and A. Ruggeri, "PopED, a software fir optimal -experimental design in population kinetics", Computer Methods and Programs in Biomedicine, 74, 2004.

    2. -
    3. J. Nyberg, S. Ueckert, E.A. Stroemberg, S. Hennig, M.O. Karlsson and A.C. Hooker, "PopED: An extended, -parallelized, nonlinear mixed effects models optimal design tool", -Computer Methods and Programs in Biomedicine, 108, 2012.

    4. -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    
    -## "wild" function , global minimum at about -15.81515
    -fw <- function(x) 10*sin(0.3*x)*sin(1.3*x^2) + 0.00001*x^4 + 0.2*x+80
    -
    -# optimization with fewer function evaluations compared to SANN
    -res1 <- optim_ARS(50, fw,lower = -50, upper=100)
    -#> Initial OFV = 159.001
    -#> It.   5 | OFV = 93.2516
    -#> It.  10 | OFV = 74.4026
    -#> It.  15 | OFV = 71.9214
    -#> It.  20 | OFV = 71.9214
    -#> It.  25 | OFV = 71.9214
    -#> It.  30 | OFV = 71.9214
    -#> It.  35 | OFV = 71.9214
    -#> It.  40 | OFV = 71.9214
    -#> It.  45 | OFV = 71.9214
    -#> It.  50 | OFV = 71.9214
    -#> It.  55 | OFV = 71.9214
    -#> It.  60 | OFV = 71.9214
    -#> It.  65 | OFV = 71.9214
    -#> It.  70 | OFV = 71.9214
    -#> It.  75 | OFV = 71.9214
    -#> It.  80 | OFV = 70.2523
    -#> It.  85 | OFV = 69.6812
    -#> It.  90 | OFV = 69.6812
    -#> It.  95 | OFV = 69.6812
    -#> It. 100 | OFV = 69.6812
    -#> It. 105 | OFV = 69.4204
    -#> It. 110 | OFV = 69.4204
    -#> It. 115 | OFV = 69.4204
    -#> It. 120 | OFV = 69.4204
    -#> It. 125 | OFV = 69.4204
    -#> It. 130 | OFV = 69.4204
    -#> It. 135 | OFV = 69.4204
    -#> It. 140 | OFV = 69.4204
    -#> It. 145 | OFV = 69.4204
    -#> It. 150 | OFV = 69.4204
    -#> It. 155 | OFV = 68.5244
    -#> It. 160 | OFV = 68.5244
    -#> It. 165 | OFV = 68.5244
    -#> It. 170 | OFV = 68.5244
    -#> It. 175 | OFV = 68.5244
    -#> It. 180 | OFV = 68.5244
    -#> It. 185 | OFV = 68.5244
    -#> It. 190 | OFV = 68.5244
    -#> It. 195 | OFV = 68.5244
    -#> It. 200 | OFV = 68.5244
    -#> It. 205 | OFV = 68.5244
    -#> It. 210 | OFV = 68.5244
    -#> It. 215 | OFV = 68.5244
    -#> It. 220 | OFV = 68.5244
    -#> It. 225 | OFV = 68.5244
    -#> It. 230 | OFV = 68.5244
    -#> It. 235 | OFV = 68.5244
    -#> It. 240 | OFV = 68.4406
    -#> It. 245 | OFV = 68.4406
    -#> It. 250 | OFV = 68.4406
    -#> It. 255 | OFV = 68.4406
    -#> It. 260 | OFV = 68.4406
    -#> It. 265 | OFV = 68.4406
    -#> It. 270 | OFV = 68.4406
    -#> It. 275 | OFV = 68.4406
    -#> It. 280 | OFV = 68.4406
    -#> It. 285 | OFV = 68.4406
    -#> It. 290 | OFV = 68.4406
    -#> It. 295 | OFV = 68.4406
    -#> It. 300 | OFV = 68.4406
    -#> It. 305 | OFV = 68.4406
    -#> It. 310 | OFV = 68.4406
    -#> It. 315 | OFV = 68.4406
    -#> It. 320 | OFV = 68.4406
    -#> It. 325 | OFV = 68.4406
    -#> It. 330 | OFV = 68.4406
    -#> It. 335 | OFV = 68.4406
    -#> It. 340 | OFV = 68.4406
    -#> It. 345 | OFV = 68.4406
    -#> It. 350 | OFV = 68.4406
    -#> It. 355 | OFV = 68.4406
    -#> It. 360 | OFV = 68.4406
    -#> It. 365 | OFV = 68.4406
    -#> It. 370 | OFV = 68.4406
    -#> It. 375 | OFV = 68.4406
    -#> It. 380 | OFV = 68.4406
    -#> It. 385 | OFV = 68.4406
    -#> It. 390 | OFV = 68.4406
    -#> It. 395 | OFV = 67.9743
    -#> It. 400 | OFV = 67.9743
    -#> 
    -#> Total iterations: 400 
    -#> Elapsed time: 0.151 seconds.
    -#> 
    -#> Final OFV =  67.97435 
    -#> Parameters: -14.7069 
    -#> 
    -
    -# often not as good performance when upper and lower bounds are poor
    -res2 <- optim_ARS(50, fw, lower=-Inf,upper=Inf)
    -#> Initial OFV = 159.001
    -#> It.   5 | OFV = 81.8156
    -#> It.  10 | OFV = 81.8156
    -#> It.  15 | OFV = 81.8156
    -#> It.  20 | OFV = 81.8156
    -#> It.  25 | OFV = 68.0396
    -#> It.  30 | OFV = 68.0396
    -#> It.  35 | OFV = 68.0396
    -#> It.  40 | OFV = 68.0396
    -#> It.  45 | OFV = 68.0396
    -#> It.  50 | OFV = 68.0396
    -#> It.  55 | OFV = 67.5532
    -#> It.  60 | OFV = 67.5532
    -#> It.  65 | OFV = 67.5532
    -#> It.  70 | OFV = 67.5532
    -#> It.  75 | OFV = 67.5532
    -#> It.  80 | OFV = 67.5532
    -#> It.  85 | OFV = 67.5532
    -#> It.  90 | OFV = 67.5532
    -#> It.  95 | OFV = 67.5532
    -#> It. 100 | OFV = 67.5532
    -#> It. 105 | OFV = 67.5532
    -#> It. 110 | OFV = 67.5532
    -#> It. 115 | OFV = 67.5532
    -#> It. 120 | OFV = 67.5532
    -#> It. 125 | OFV = 67.5532
    -#> It. 130 | OFV = 67.5532
    -#> It. 135 | OFV = 67.5532
    -#> It. 140 | OFV = 67.5532
    -#> It. 145 | OFV = 67.5532
    -#> It. 150 | OFV = 67.5532
    -#> It. 155 | OFV = 67.5532
    -#> It. 160 | OFV = 67.5532
    -#> It. 165 | OFV = 67.5532
    -#> It. 170 | OFV = 67.5532
    -#> It. 175 | OFV = 67.5532
    -#> It. 180 | OFV = 67.5532
    -#> It. 185 | OFV = 67.5532
    -#> It. 190 | OFV = 67.5532
    -#> It. 195 | OFV = 67.5532
    -#> It. 200 | OFV = 67.5532
    -#> It. 205 | OFV = 67.5532
    -#> It. 210 | OFV = 67.5532
    -#> It. 215 | OFV = 67.5532
    -#> It. 220 | OFV = 67.5532
    -#> It. 225 | OFV = 67.5532
    -#> It. 230 | OFV = 67.5532
    -#> It. 235 | OFV = 67.5532
    -#> It. 240 | OFV = 67.5532
    -#> It. 245 | OFV = 67.5532
    -#> It. 250 | OFV = 67.5532
    -#> Maximum number of identical optimal values reached (max_run=200), optimization stopped.
    -#> 
    -#> Total iterations: 250 
    -#> Elapsed time: 0.041 seconds.
    -#> 
    -#> Final OFV =  67.55323 
    -#> Parameters: -15.34878 
    -#> 
    -
    -# Only integer values allowed
    -if (FALSE) { 
    -res_int <- optim_ARS(50, fw, allowed_values = seq(-50,100,by=1))
    -}
    -
    -if (FALSE) { 
    -  #plot of the function and solutions
    -  require(graphics)
    -  plot(fw, -50, 50, n = 1000, main = "Minimizing 'wild function'")
    -  points(-15.81515, fw(-15.81515), pch = 16, col = "red", cex = 1)
    -  points(res1$par, res1$ofv, pch = 16, col = "green", cex = 1)
    -  points(res2$par, res2$ofv, pch = 16, col = "blue", cex = 1)
    -} 
    -
    -# optim_ARS does not work great for hard to find minima on flat surface:
    -# Rosenbrock Banana function
    -# f(x, y) = (a-x)^2 + b(y-x^2)^2
    -# global minimum at (x, y)=(a, a^2), where f(x, y)=0. 
    -# Usually a = 1 and b = 100.
    -if (FALSE) { 
    -  fr <- function(x,a=1,b=100) {   
    -    x1 <- x[1]
    -    x2 <- x[2]
    -    b*(x2 - x1*x1)^2 + (a - x1)^2
    -  }
    -  
    -  res3 <- optim_ARS(c(-1.2,1), fr,lower = -5, upper = 5)
    -  
    -  # plot the surface
    -  x <- seq(-50, 50, length= 30)
    -  y <- x
    -  f <- function(x,y){apply(cbind(x,y),1,fr)}
    -  z <- outer(x, y, f)
    -  persp(x, y, z, theta = 30, phi = 30, expand = 0.5, col = "lightblue", ticktype="detailed") -> res
    -  points(trans3d(1, 1, 0, pmat = res), col = 2, pch = 16,cex=2)
    -  points(trans3d(res3$par[1], res3$par[1], res3$ofv, pmat = res), col = "green", pch = 16,cex=2)
    -}
    -
    -# box constraints
    -flb <- function(x){
    -  p <- length(x) 
    -  sum(c(1, rep(4, p-1)) * (x - c(1, x[-p])^2)^2) 
    -}
    -## 25-dimensional box constrained
    -#optim(rep(3, 25), flb,lower = rep(2, 25), upper = rep(4, 25),method = "L-BFGS-B") 
    -res_box <- optim_ARS(rep(3, 25), flb,lower = rep(2, 25), upper = rep(4, 25)) 
    -#> Initial OFV = 3460
    -#> It.   5 | OFV = 2893.22
    -#> It.  10 | OFV = 2843.53
    -#> It.  15 | OFV = 2843.53
    -#> It.  20 | OFV = 2534.71
    -#> It.  25 | OFV = 2534.71
    -#> It.  30 | OFV = 2534.71
    -#> It.  35 | OFV = 2534.71
    -#> It.  40 | OFV = 2534.71
    -#> It.  45 | OFV = 2534.71
    -#> It.  50 | OFV = 2534.71
    -#> It.  55 | OFV = 2534.71
    -#> It.  60 | OFV = 2534.71
    -#> It.  65 | OFV = 2534.71
    -#> It.  70 | OFV = 2534.71
    -#> It.  75 | OFV = 2528.5
    -#> It.  80 | OFV = 2352.4
    -#> It.  85 | OFV = 1971.58
    -#> It.  90 | OFV = 1842.28
    -#> It.  95 | OFV = 1831.86
    -#> It. 100 | OFV = 1760.66
    -#> It. 105 | OFV = 1656.85
    -#> It. 110 | OFV = 1640.83
    -#> It. 115 | OFV = 1504.39
    -#> It. 120 | OFV = 1504.25
    -#> It. 125 | OFV = 1283.46
    -#> It. 130 | OFV = 1272.11
    -#> It. 135 | OFV = 1244.14
    -#> It. 140 | OFV = 1244.14
    -#> It. 145 | OFV = 1189.71
    -#> It. 150 | OFV = 1093.24
    -#> It. 155 | OFV = 1093.24
    -#> It. 160 | OFV = 817.1
    -#> It. 165 | OFV = 817.1
    -#> It. 170 | OFV = 763.001
    -#> It. 175 | OFV = 763.001
    -#> It. 180 | OFV = 749.85
    -#> It. 185 | OFV = 749.85
    -#> It. 190 | OFV = 749.85
    -#> It. 195 | OFV = 746.645
    -#> It. 200 | OFV = 746.645
    -#> It. 205 | OFV = 724.258
    -#> It. 210 | OFV = 724.258
    -#> It. 215 | OFV = 724.258
    -#> It. 220 | OFV = 724.258
    -#> It. 225 | OFV = 665.8
    -#> It. 230 | OFV = 612.601
    -#> It. 235 | OFV = 612.601
    -#> It. 240 | OFV = 612.601
    -#> It. 245 | OFV = 602.118
    -#> It. 250 | OFV = 602.118
    -#> It. 255 | OFV = 602.118
    -#> It. 260 | OFV = 602.118
    -#> It. 265 | OFV = 535.288
    -#> It. 270 | OFV = 535.288
    -#> It. 275 | OFV = 520.06
    -#> It. 280 | OFV = 520.06
    -#> It. 285 | OFV = 520.06
    -#> It. 290 | OFV = 520.06
    -#> It. 295 | OFV = 520.06
    -#> It. 300 | OFV = 520.06
    -#> It. 305 | OFV = 520.06
    -#> It. 310 | OFV = 520.06
    -#> It. 315 | OFV = 520.06
    -#> It. 320 | OFV = 520.06
    -#> It. 325 | OFV = 520.06
    -#> It. 330 | OFV = 520.06
    -#> It. 335 | OFV = 520.06
    -#> It. 340 | OFV = 520.06
    -#> It. 345 | OFV = 513.043
    -#> It. 350 | OFV = 504.66
    -#> It. 355 | OFV = 504.66
    -#> It. 360 | OFV = 504.66
    -#> It. 365 | OFV = 504.66
    -#> It. 370 | OFV = 504.66
    -#> It. 375 | OFV = 504.66
    -#> It. 380 | OFV = 499.84
    -#> It. 385 | OFV = 480.001
    -#> It. 390 | OFV = 480.001
    -#> It. 395 | OFV = 480.001
    -#> It. 400 | OFV = 480.001
    -#> 
    -#> Total iterations: 400 
    -#> Elapsed time: 0.084 seconds.
    -#> 
    -#> Final OFV =  480.0015 
    -#> Parameters: 2 2 2.016557 2.168674 2.047529 2 2 2 2 2.09281 2 2 2 2 2 2.040247 2 2 2.220732 2.207626 2.156515 2.435454 2.29775 2.139542 3.804459 
    -#> 
    -
    -
    -## Combinatorial optimization: Traveling salesman problem
    -eurodistmat <- as.matrix(eurodist)
    -
    -distance <- function(sq) {  # Target function
    -  sq2 <- embed(sq, 2)
    -  sum(eurodistmat[cbind(sq2[,2], sq2[,1])])
    -}
    -
    -genseq <- function(sq) {  # Generate new candidate sequence
    -  idx <- seq(2, NROW(eurodistmat)-1)
    -  changepoints <- sample(idx, size = 2, replace = FALSE)
    -  tmp <- sq[changepoints[1]]
    -  sq[changepoints[1]] <- sq[changepoints[2]]
    -  sq[changepoints[2]] <- tmp
    -  sq
    -}
    -
    -sq <- c(1:nrow(eurodistmat), 1)  # Initial sequence: alphabetic
    -res3 <- optim_ARS(sq,distance,generator=genseq) # Near optimum distance around 12842
    -#> Initial OFV = 29625
    -#> It.   5 | OFV = 29625
    -#> It.  10 | OFV = 28278
    -#> It.  15 | OFV = 26918
    -#> It.  20 | OFV = 26195
    -#> It.  25 | OFV = 24669
    -#> It.  30 | OFV = 24669
    -#> It.  35 | OFV = 24669
    -#> It.  40 | OFV = 24323
    -#> It.  45 | OFV = 24323
    -#> It.  50 | OFV = 24323
    -#> It.  55 | OFV = 24323
    -#> It.  60 | OFV = 23222
    -#> It.  65 | OFV = 23222
    -#> It.  70 | OFV = 23050
    -#> It.  75 | OFV = 23050
    -#> It.  80 | OFV = 23050
    -#> It.  85 | OFV = 22581
    -#> It.  90 | OFV = 22581
    -#> It.  95 | OFV = 22581
    -#> It. 100 | OFV = 22581
    -#> It. 105 | OFV = 21740
    -#> It. 110 | OFV = 21740
    -#> It. 115 | OFV = 19232
    -#> It. 120 | OFV = 19232
    -#> It. 125 | OFV = 19232
    -#> It. 130 | OFV = 19232
    -#> It. 135 | OFV = 19232
    -#> It. 140 | OFV = 19232
    -#> It. 145 | OFV = 19043
    -#> It. 150 | OFV = 19043
    -#> It. 155 | OFV = 19043
    -#> It. 160 | OFV = 19043
    -#> It. 165 | OFV = 18794
    -#> It. 170 | OFV = 18794
    -#> It. 175 | OFV = 18794
    -#> It. 180 | OFV = 18794
    -#> It. 185 | OFV = 18794
    -#> It. 190 | OFV = 18794
    -#> It. 195 | OFV = 18794
    -#> It. 200 | OFV = 18794
    -#> It. 205 | OFV = 18794
    -#> It. 210 | OFV = 18794
    -#> It. 215 | OFV = 18794
    -#> It. 220 | OFV = 18794
    -#> It. 225 | OFV = 18794
    -#> It. 230 | OFV = 18794
    -#> It. 235 | OFV = 18794
    -#> It. 240 | OFV = 18794
    -#> It. 245 | OFV = 18794
    -#> It. 250 | OFV = 18794
    -#> It. 255 | OFV = 18794
    -#> It. 260 | OFV = 17874
    -#> It. 265 | OFV = 17874
    -#> It. 270 | OFV = 17874
    -#> It. 275 | OFV = 17648
    -#> It. 280 | OFV = 17648
    -#> It. 285 | OFV = 17648
    -#> It. 290 | OFV = 17648
    -#> It. 295 | OFV = 17648
    -#> It. 300 | OFV = 17648
    -#> It. 305 | OFV = 17648
    -#> It. 310 | OFV = 17648
    -#> It. 315 | OFV = 17648
    -#> It. 320 | OFV = 17589
    -#> It. 325 | OFV = 17571
    -#> It. 330 | OFV = 17571
    -#> It. 335 | OFV = 17571
    -#> It. 340 | OFV = 17571
    -#> It. 345 | OFV = 17571
    -#> It. 350 | OFV = 17571
    -#> It. 355 | OFV = 17571
    -#> It. 360 | OFV = 17571
    -#> It. 365 | OFV = 17571
    -#> It. 370 | OFV = 17571
    -#> It. 375 | OFV = 17171
    -#> It. 380 | OFV = 17171
    -#> It. 385 | OFV = 17171
    -#> It. 390 | OFV = 17171
    -#> It. 395 | OFV = 17171
    -#> It. 400 | OFV = 17171
    -#> 
    -#> Total iterations: 400 
    -#> Elapsed time: 0.097 seconds.
    -#> 
    -#> Final OFV =  17171 
    -#> Parameters: 1 19 18 5 11 7 20 12 9 14 2 8 17 16 15 13 6 3 4 10 21 1 
    -#> 
    -
    -if (FALSE) { 
    -  # plot of initial sequence
    -  # rotate for conventional orientation
    -  loc <- -cmdscale(eurodist, add = TRUE)$points
    -  x <- loc[,1]; y <- loc[,2]
    -  s <- seq_len(nrow(eurodistmat))
    -  tspinit <- loc[sq,]
    -  
    -  plot(x, y, type = "n", asp = 1, xlab = "", ylab = "",
    -       main = paste("Initial sequence of traveling salesman problem\n",
    -                    "Distance =",distance(sq)), axes = FALSE)
    -  arrows(tspinit[s,1], tspinit[s,2], tspinit[s+1,1], tspinit[s+1,2],
    -         angle = 10, col = "green")
    -  text(x, y, labels(eurodist), cex = 0.8)
    -  
    -  # plot of final sequence from optim_ARS
    -  tspres <- loc[res3$par,]
    -  plot(x, y, type = "n", asp = 1, xlab = "", ylab = "",
    -       main = paste("optim_ARS() 'solving' traveling salesman problem\n",
    -                    "Distance =",distance(c(1,res3$par,1))),axes = FALSE)
    -  arrows(tspres[s,1], tspres[s,2], tspres[s+1,1], tspres[s+1,2],
    -         angle = 10, col = "red")
    -  text(x, y, labels(eurodist), cex = 0.8)
    -  
    -  # using optim
    -  set.seed(123) # chosen to get a good soln relatively quickly
    -  (res4 <- optim(sq, distance, genseq, method = "SANN",
    -                 control = list(maxit = 30000, temp = 2000, trace = TRUE,
    -                                REPORT = 500))) 
    -  
    -  tspres <- loc[res4$par,]
    -  plot(x, y, type = "n", asp = 1, xlab = "", ylab = "",
    -       main = paste("optim() 'solving' traveling salesman problem\n",
    -                    "Distance =",distance(res4$par)),axes = FALSE)
    -  arrows(tspres[s,1], tspres[s,2], tspres[s+1,1], tspres[s+1,2],
    -         angle = 10, col = "red")
    -  text(x, y, labels(eurodist), cex = 0.8)
    -}  
    -
    -# one-dimensional function
    -if (FALSE) { 
    -  f <- function(x)  abs(x)+cos(x)
    -  res5 <- optim_ARS(-20,f,lower=-20, upper=20)
    -  
    -  curve(f, -20, 20)
    -  abline(v = res5$par, lty = 4,col="green")
    -}  
    -
    -# one-dimensional function
    -f <- function(x)  (x^2+x)*cos(x) # -10 < x < 10
    -res_max <- optim_ARS(0,f,lower=-10, upper=10,maximize=TRUE) # sometimes to local maxima
    -#> Initial OFV = 0
    -#> It.   5 | OFV = 1.08018
    -#> It.  10 | OFV = 32.617
    -#> It.  15 | OFV = 35.0597
    -#> It.  20 | OFV = 35.0597
    -#> It.  25 | OFV = 35.0597
    -#> It.  30 | OFV = 35.0597
    -#> It.  35 | OFV = 37.8576
    -#> It.  40 | OFV = 37.8576
    -#> It.  45 | OFV = 37.8576
    -#> It.  50 | OFV = 40.0602
    -#> It.  55 | OFV = 47.3821
    -#> It.  60 | OFV = 47.3821
    -#> It.  65 | OFV = 47.3821
    -#> It.  70 | OFV = 47.3821
    -#> It.  75 | OFV = 47.3821
    -#> It.  80 | OFV = 47.6584
    -#> It.  85 | OFV = 47.6584
    -#> It.  90 | OFV = 47.6584
    -#> It.  95 | OFV = 47.699
    -#> It. 100 | OFV = 47.699
    -#> It. 105 | OFV = 47.699
    -#> It. 110 | OFV = 47.699
    -#> It. 115 | OFV = 47.699
    -#> It. 120 | OFV = 47.699
    -#> It. 125 | OFV = 47.699
    -#> It. 130 | OFV = 47.699
    -#> It. 135 | OFV = 47.699
    -#> It. 140 | OFV = 47.699
    -#> It. 145 | OFV = 47.699
    -#> It. 150 | OFV = 47.699
    -#> It. 155 | OFV = 47.699
    -#> It. 160 | OFV = 47.699
    -#> It. 165 | OFV = 47.699
    -#> It. 170 | OFV = 47.699
    -#> It. 175 | OFV = 47.699
    -#> It. 180 | OFV = 47.699
    -#> It. 185 | OFV = 47.7055
    -#> It. 190 | OFV = 47.7055
    -#> It. 195 | OFV = 47.7055
    -#> It. 200 | OFV = 47.7055
    -#> It. 205 | OFV = 47.7055
    -#> It. 210 | OFV = 47.7055
    -#> It. 215 | OFV = 47.7055
    -#> It. 220 | OFV = 47.7055
    -#> It. 225 | OFV = 47.7055
    -#> It. 230 | OFV = 47.7055
    -#> It. 235 | OFV = 47.7055
    -#> It. 240 | OFV = 47.7055
    -#> It. 245 | OFV = 47.7055
    -#> It. 250 | OFV = 47.7055
    -#> It. 255 | OFV = 47.7055
    -#> It. 260 | OFV = 47.7055
    -#> It. 265 | OFV = 47.7055
    -#> It. 270 | OFV = 47.7055
    -#> It. 275 | OFV = 47.7055
    -#> It. 280 | OFV = 47.7055
    -#> It. 285 | OFV = 47.7055
    -#> It. 290 | OFV = 47.7055
    -#> It. 295 | OFV = 47.7055
    -#> It. 300 | OFV = 47.7055
    -#> It. 305 | OFV = 47.7055
    -#> It. 310 | OFV = 47.7055
    -#> It. 315 | OFV = 47.7055
    -#> It. 320 | OFV = 47.7055
    -#> It. 325 | OFV = 47.7055
    -#> It. 330 | OFV = 47.7055
    -#> It. 335 | OFV = 47.7055
    -#> It. 340 | OFV = 47.7055
    -#> It. 345 | OFV = 47.7055
    -#> It. 350 | OFV = 47.7055
    -#> It. 355 | OFV = 47.7055
    -#> It. 360 | OFV = 47.7055
    -#> It. 365 | OFV = 47.7055
    -#> It. 370 | OFV = 47.7055
    -#> It. 375 | OFV = 47.7055
    -#> It. 380 | OFV = 47.7055
    -#> Maximum number of identical optimal values reached (max_run=200), optimization stopped.
    -#> 
    -#> Total iterations: 380 
    -#> Elapsed time: 0.083 seconds.
    -#> 
    -#> Final OFV =  47.70545 
    -#> Parameters: 6.563052 
    -#> 
    -
    -if (FALSE) { 
    -  res_min <- optim_ARS(0,f,lower=-10, upper=10) # sometimes to local minima
    -  
    -  curve(f, -10, 10)
    -  abline(v = res_min$par, lty = 4,col="green")
    -  abline(v = res_max$par, lty = 4,col="red")
    -}
    -
    -
    -# two-dimensional Rastrigin function
    -#It has a global minimum at f(x) = f(0) = 0.
    -if (FALSE) { 
    -  Rastrigin <- function(x1, x2){
    -    20 + x1^2 + x2^2 - 10*(cos(2*pi*x1) + cos(2*pi*x2))
    -  }
    -  
    -  
    -  x1 <- x2 <- seq(-5.12, 5.12, by = 0.1)
    -  z <- outer(x1, x2, Rastrigin)
    -  
    -  res6 <- optim_ARS(c(-4,4),function(x) Rastrigin(x[1], x[2]),lower=-5.12, upper=5.12)
    -  
    -  # color scale
    -  nrz <- nrow(z)
    -  ncz <- ncol(z)
    -  jet.colors <-
    -    colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",
    -                       "#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000"))
    -  # Generate the desired number of colors from this palette
    -  nbcol <- 100
    -  color <- jet.colors(nbcol)
    -  # Compute the z-value at the facet centres
    -  zfacet <- z[-1, -1] + z[-1, -ncz] + z[-nrz, -1] + z[-nrz, -ncz]
    -  # Recode facet z-values into color indices
    -  facetcol <- cut(zfacet, nbcol)
    -  persp(x1, x2, z, col = color[facetcol], phi = 30, theta = 30)
    -  filled.contour(x1, x2, z, color.palette = jet.colors)
    -}
    -
    -
    -## Parallel computation  
    -## works better when each evaluation takes longer
    -## here we have added extra time to the computations
    -## just to show that it works
    -if (FALSE) { 
    -  res7 <- optim_ARS(c(-4,4),function(x){Sys.sleep(0.01); Rastrigin(x[1], x[2])},
    -                    lower=-5.12, upper=5.12)
    -  res8 <- optim_ARS(c(-4,4),function(x){Sys.sleep(0.01); Rastrigin(x[1], x[2])},
    -                    lower=-5.12, upper=5.12,parallel = T)
    -  res9 <- optim_ARS(c(-4,4),function(x){Sys.sleep(0.01); Rastrigin(x[1], x[2])},
    -                    lower=-5.12, upper=5.12,parallel = T,parallel_type = "snow")
    -}
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/optim_LS.html b/docs/reference/optim_LS.html deleted file mode 100644 index e8295196..00000000 --- a/docs/reference/optim_LS.html +++ /dev/null @@ -1,506 +0,0 @@ - -Optimize a function using a line search algorithm. — optim_LS • PopED - - -
    -
    - - - -
    -
    - - -
    -

    optim_LS performs sequential grid search optimization of an arbitrary function with respect -to each of the parameters to be optimized over. -The function works for both discrete and continuous optimization parameters -and allows for box-constraints (by using the upper and lower function arguments) or sets of allowed values (by using the -allowed_values function argument) for all parameters, or on a parameter per parameter basis.

    -
    - -
    -
    optim_LS(
    -  par,
    -  fn,
    -  lower = NULL,
    -  upper = NULL,
    -  allowed_values = NULL,
    -  line_length = 50,
    -  trace = TRUE,
    -  maximize = F,
    -  parallel = F,
    -  parallel_type = NULL,
    -  num_cores = NULL,
    -  mrgsolve_model = NULL,
    -  seed = round(runif(1, 0, 1e+07)),
    -  allow_replicates = TRUE,
    -  replicates_index = seq(1, length(par)),
    -  ofv_initial = NULL,
    -  closed_bounds = TRUE,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    par
    -

    A vector of initial values for the parameters to be optimized over.

    - - -
    fn
    -

    A function to be minimized (or maximized), -with first argument the vector of parameters over which minimization is to take place. -It should return a scalar result.

    - - -
    lower
    -

    Lower bounds on the parameters. A vector.

    - - -
    upper
    -

    Upper bounds on the parameters. A vector.

    - - -
    allowed_values
    -

    A list containing allowed values for each parameter list(par1=c(2,3,4,5,6),par2=c(5,6,7,8)). -A vector containing allowed values for all parameters is also allowed c(2,3,4,5,6).

    - - -
    line_length
    -

    The number of different parameter values per parameter to evaluate. The values are -selected as an evenly spaced grid between the upper and lower bounds.

    - - -
    trace
    -

    Should the algorithm output results intermittently.

    - - -
    maximize
    -

    Should the function be maximized? Default is to minimize.

    - - -
    parallel
    -

    Should we use parallel computations?

    - - -
    parallel_type
    -

    Which type of parallelization should be used? -Can be "snow" or "multicore". "snow" works on Linux-like systems & Windows. "multicore" works only on -Linux-like systems. By default this is chosen for you depending on your operating system. -See start_parallel.

    - - -
    num_cores
    -

    The number of cores to use in the parallelization. By default is set to the number - output from -parallel::detectCores(). -See start_parallel.

    - - -
    mrgsolve_model
    -

    If the computations require a mrgsolve model and you -are using the "snow" method then you need to specify the name of the model -object created by mread or mcode.

    - - -
    seed
    -

    The random seed to use in the algorithm,

    - - -
    allow_replicates
    -

    Should the algorithm allow parameters to have the same value?

    - - -
    replicates_index
    -

    A vector, the same length as the parameters. -If two values are the same in this vector then the parameters may not assume the same value in the optimization.

    - - -
    ofv_initial
    -

    An initial objective function value (OFV). If not NULL then the initial design is not evaluated -and the OFV value is assumed to be this number.

    - - -
    closed_bounds
    -

    Are the upper and lower limits open (boundaries not allowed) or closed (boundaries allowed) bounds?

    - - -
    ...
    -

    Additional arguments passed to fn and start_parallel.

    - -
    -
    -

    References

    - -
    1. M. Foracchia, A.C. Hooker, P. Vicini and A. Ruggeri, "PopED, a software fir optimal -experimental design in population kinetics", Computer Methods and Programs in Biomedicine, 74, 2004.

    2. -
    3. J. Nyberg, S. Ueckert, E.A. Stroemberg, S. Hennig, M.O. Karlsson and A.C. Hooker, "PopED: An extended, -parallelized, nonlinear mixed effects models optimal design tool", -Computer Methods and Programs in Biomedicine, 108, 2012.

    4. -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    # "wild" function 
    -fw <- function(x) 10*sin(0.3*x)*sin(1.3*x^2) + 0.00001*x^4 + 0.2*x+80
    -
    -# Global minimum of 67.47 at about -15.81515
    -(fw_min <- fw(-15.81515))
    -#> [1] 67.46773
    -
    -if (interactive()){  
    -  #plot of the function
    -  require(graphics)
    -  plot(fw, -50, 50, n = 10000, main = "Minimizing 'wild function'")
    -  
    -  # Known minimum
    -  points(-15.81515, fw_min, pch = 21, col = "red", cex = 1.5)
    -} 
    -
    -# optimization with fewer function evaluations 
    -# compared to SANN: see examples in '?optim'
    -res1 <- optim_LS(50, fw,lower = -50, upper=50, line_length = 10000)
    -#> 
    -#>    Initial parameters: 50 
    -#>    Initial OFV: 159.0012 
    -#> 
    -#>    Searching parameter 1 
    -#>      Changed from 50 to -15.8166 ; OFV = 67.485 
    -#> 
    -#>    Elapsed time: 0.017 seconds.
    -#> 
    -#>    Final OFV =  67.48502 
    -#>    Parameters: -15.81658 
    -#> 
    -
    -if (interactive()){ 
    -  require(graphics)
    -  plot(fw, -20, 0, n = 10000, main = "Minimizing 'wild function'")
    -  
    -  # Known minimum
    -  points(-15.81515, fw_min, pch = 21, col = "red", cex = 1.5)
    -  
    -  #plot of the optimization
    -  points(res1$par, res1$ofv, pch = 16, col = "green", cex = 1)
    -} 
    -
    -# Upper and lower bounds and line_length should be considered carefully
    -res2 <- optim_LS(50, fw, lower=-Inf,upper=Inf,line_length = 10000)
    -#> 
    -#>    Initial parameters: 50 
    -#>    Initial OFV: 159.0012 
    -#> 
    -#>    Searching parameter 1 
    -#>      Changed from 50 to -5.0055 ; OFV = 69.8766 
    -#> 
    -#>    Elapsed time: 0.018 seconds.
    -#> 
    -#>    Final OFV =  69.87659 
    -#>    Parameters: -5.005501 
    -#> 
    -
    -# Only integer values allowed
    -res_int <- optim_LS(50, fw, allowed_values = seq(-50,50,by=1))
    -#> 
    -#>    Initial parameters: 50 
    -#>    Initial OFV: 159.0012 
    -#> 
    -#>    Searching parameter 1 
    -#>      Changed from 50 to -17 ; OFV = 68.5368 
    -#> 
    -#>    Elapsed time: 0 seconds.
    -#> 
    -#>    Final OFV =  68.53679 
    -#>    Parameters: -17 
    -#> 
    -
    -
    -# Rosenbrock Banana function
    -# f(x, y) = (a-x)^2 + b*(y-x^2)^2
    -# global minimum at (x, y)=(a, a^2), where f(x, y)=0. 
    -# Usually a = 1 and b = 100 so x=1 and y=1
    -if (interactive()){ 
    -  fr <- function(x,a=1,b=100) {   
    -    x1 <- x[1]
    -    x2 <- x[2]
    -    b*(x2 - x1*x1)^2 + (a - x1)^2
    -  }
    -  
    -  res3 <- optim_LS(c(-1.2,1), fr,lower = -5, upper = 5, line_length = 1000)
    -
    -  # plot the surface
    -  x <- seq(-50, 50, length= 30)
    -  y <- x
    -  f <- function(x,y){apply(cbind(x,y),1,fr)}
    -  z <- outer(x, y, f)
    -  persp(x, y, z, theta = 30, phi = 30, expand = 0.5, col = "lightblue", ticktype="detailed") -> res
    -  points(trans3d(1, 1, 0, pmat = res), col = 2, pch = 16,cex=2)
    -  points(trans3d(res3$par[1], res3$par[1], res3$ofv, pmat = res), col = "green", pch = 16,cex=1.5)
    -}
    -
    -# box constraints
    -flb <- function(x){
    -  p <- length(x) 
    -  sum(c(1, rep(4, p-1)) * (x - c(1, x[-p])^2)^2) 
    -}
    -
    -## 25-dimensional box constrained
    -if (interactive()){ 
    -  optim(rep(3, 25), flb,lower = rep(2, 25), upper = rep(4, 25),method = "L-BFGS-B") 
    -}
    -res_box <- optim_LS(rep(3, 25), flb,
    -                    lower = rep(2, 25), 
    -                    upper = rep(4, 25),
    -                    line_length = 1000) 
    -#> 
    -#>    Initial parameters: 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 
    -#>    Initial OFV: 3460 
    -#> 
    -#>    Searching parameter 13 
    -#>      Changed from 3 to 2.14414 ; OFV = 3370.22 
    -#>    Searching parameter 22 
    -#>      Changed from 3 to 2.14414 ; OFV = 3280.43 
    -#>    Searching parameter 12 
    -#>      Changed from 3 to 2 ; OFV = 3158.2 
    -#>    Searching parameter 9 
    -#>      Changed from 3 to 2.14414 ; OFV = 3068.42 
    -#>    Searching parameter 8 
    -#>      Changed from 3 to 2 ; OFV = 2946.18 
    -#>    Searching parameter 17 
    -#>      Changed from 3 to 2.14414 ; OFV = 2856.4 
    -#>    Searching parameter 24 
    -#>      Changed from 3 to 2.14414 ; OFV = 2766.62 
    -#>    Searching parameter 10 
    -#>      Changed from 3 to 2 ; OFV = 2643.4 
    -#>    Searching parameter 1 
    -#>      Changed from 3 to 2 ; OFV = 2500.4 
    -#>    Searching parameter 14 
    -#>      Changed from 3 to 2 ; OFV = 2377.18 
    -#>    Searching parameter 2 
    -#>      Changed from 3 to 2 ; OFV = 2249.18 
    -#>    Searching parameter 20 
    -#>      Changed from 3 to 2.14414 ; OFV = 2159.39 
    -#>    Searching parameter 21 
    -#>      Changed from 3 to 2 ; OFV = 2001.94 
    -#>    Searching parameter 4 
    -#>      Changed from 3 to 2.14414 ; OFV = 1912.15 
    -#>    Searching parameter 3 
    -#>      Changed from 3 to 2 ; OFV = 1749.92 
    -#>    Searching parameter 16 
    -#>      Changed from 3 to 2 ; OFV = 1627.69 
    -#>    Searching parameter 5 
    -#>      Changed from 3 to 2 ; OFV = 1504.46 
    -#>    Searching parameter 7 
    -#>      Changed from 3 to 2 ; OFV = 1376.46 
    -#>    Searching parameter 25 
    -#>      Changed from 3 to 4 ; OFV = 1367.69 
    -#>    Searching parameter 11 
    -#>      Changed from 3 to 2 ; OFV = 1199.69 
    -#>    Searching parameter 23 
    -#>      Changed from 3 to 2 ; OFV = 1042.23 
    -#>    Searching parameter 6 
    -#>      Changed from 3 to 2 ; OFV = 874.23 
    -#>    Searching parameter 19 
    -#>      Changed from 3 to 2 ; OFV = 751.996 
    -#>    Searching parameter 18 
    -#>      Changed from 3 to 2 ; OFV = 588.775 
    -#>    Searching parameter 15 
    -#>      Changed from 3 to 2 ; OFV = 420.775 
    -#> 
    -#>    Elapsed time: 0.071 seconds.
    -#> 
    -#>    Final OFV =  420.7749 
    -#>    Parameters: 2 2 2 2.144144 2 2 2 2 2.144144 2 2 2 2.144144 2 2 2 2.144144 2 2 2.144144 2 2.144144 2 2.144144 4 
    -#> 
    -
    -# one-dimensional function
    -if (interactive()){ 
    -  f <- function(x)  abs(x)+cos(x)
    -  res5 <- optim_LS(-20,f,lower=-20, upper=20, line_length = 500)
    -  
    -  curve(f, -20, 20)
    -  abline(v = res5$par, lty = 4,col="green")
    -}  
    -
    -# one-dimensional function
    -f <- function(x)  (x^2+x)*cos(x) # -10 < x < 10
    -res_max <- optim_LS(0,f,lower=-10, upper=10,maximize=TRUE,line_length = 1000) 
    -#> 
    -#>    Initial parameters: 0 
    -#>    Initial OFV: 0 
    -#> 
    -#>    Searching parameter 1 
    -#>      Changed from 0 to 6.55656 ; OFV = 47.7052 
    -#> 
    -#>    Elapsed time: 0.001 seconds.
    -#> 
    -#>    Final OFV =  47.7052 
    -#>    Parameters: 6.556557 
    -#> 
    -
    -if (interactive()){ 
    -  res_min <- optim_LS(0,f,lower=-10, upper=10, line_length = 1000) 
    -  
    -  curve(f, -10, 10)
    -  abline(v = res_min$par, lty = 4,col="green")
    -  abline(v = res_max$par, lty = 4,col="red")
    -}
    -
    -
    -# two-dimensional Rastrigin function
    -#It has a global minimum at f(x) = f(0) = 0.
    -if (interactive()){ 
    -  Rastrigin <- function(x1, x2){
    -    20 + x1^2 + x2^2 - 10*(cos(2*pi*x1) + cos(2*pi*x2))
    -  }
    -  
    -  
    -  x1 <- x2 <- seq(-5.12, 5.12, by = 0.1)
    -  z <- outer(x1, x2, Rastrigin)
    -  
    -  res6 <- optim_LS(c(-4,4),function(x) Rastrigin(x[1], x[2]),
    -                   lower=-5.12, upper=5.12, line_length = 1000)
    -  
    -  # color scale
    -  nrz <- nrow(z)
    -  ncz <- ncol(z)
    -  jet.colors <-
    -    colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",
    -                       "#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000"))
    -  # Generate the desired number of colors from this palette
    -  nbcol <- 100
    -  color <- jet.colors(nbcol)
    -  # Compute the z-value at the facet centres
    -  zfacet <- z[-1, -1] + z[-1, -ncz] + z[-nrz, -1] + z[-nrz, -ncz]
    -  # Recode facet z-values into color indices
    -  facetcol <- cut(zfacet, nbcol)
    -  persp(x1, x2, z, col = color[facetcol], phi = 30, theta = 30)
    -  filled.contour(x1, x2, z, color.palette = jet.colors)
    -}
    -
    -
    -## Parallel computation  
    -## works better when each evaluation takes longer
    -## here we have added extra time to the computations
    -## just to show that it works
    -if (interactive()){ 
    -  res7 <- optim_LS(c(-4,4),function(x){Sys.sleep(0.01); Rastrigin(x[1], x[2])},
    -                   lower=-5.12, upper=5.12, line_length = 200)
    -  res8 <- optim_LS(c(-4,4),function(x){Sys.sleep(0.01); Rastrigin(x[1], x[2])},
    -                   lower=-5.12, upper=5.12, line_length = 200, parallel = TRUE)
    -  res9 <- optim_LS(c(-4,4),function(x){Sys.sleep(0.01); Rastrigin(x[1], x[2])},
    -                   lower=-5.12, upper=5.12, line_length = 200, parallel = TRUE, 
    -                   parallel_type = "snow")
    -}
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/optimize_groupsize-1.png b/docs/reference/optimize_groupsize-1.png deleted file mode 100644 index e99551d0..00000000 Binary files a/docs/reference/optimize_groupsize-1.png and /dev/null differ diff --git a/docs/reference/optimize_groupsize.html b/docs/reference/optimize_groupsize.html deleted file mode 100644 index 21acfa65..00000000 --- a/docs/reference/optimize_groupsize.html +++ /dev/null @@ -1,251 +0,0 @@ - -Title Optimize the proportion of individuals in the design groups — optimize_groupsize • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Title Optimize the proportion of individuals in the design groups

    -
    - -
    -
    optimize_groupsize(
    -  poped.db,
    -  props = c(poped.db$design$groupsize/sum(poped.db$design$groupsize)),
    -  trace = 1,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    props
    -

    The proportions of individuals in each group -(relative to the total number of individuals) -to start the optimization from.

    - - -
    trace
    -

    Should there be tracing of the optimization? Value can be integer values. -Larger numbers give more information.

    - - -
    ...
    -

    Arguments passed to ofv_fim and optim

    - -
    -
    -

    Value

    - - -

    A list of the initial objective function value, optimal proportions, -the objective function value with those proportions, -the optimal number of individuals in each group (with integer number of individuals), -and the objective function value with that number of individuals.

    -
    - -
    -

    Examples

    -
    # 2 design groups with either early or late samples
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=function(x,a,bpop,b,bocc){
    -                                    parameters=c(CL=bpop[1]*exp(b[1]),
    -                                                 V=bpop[2]*exp(b[2]),
    -                                                 KA=bpop[3]*exp(b[3]),
    -                                                 Favail=bpop[4],
    -                                                 DOSE=a[1])
    -                                    return(parameters) 
    -                                  },
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(0.01,0.25),
    -                                  xt=list(c(1,2,3),c(4,5,20,120)),
    -                                  groupsize=50,
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=70,
    -                                  mina=0.01,
    -                                  maxa=100)
    -
    -
    -plot_model_prediction(poped.db)
    -
    -
    -evaluate_design(poped.db)
    -#> $ofv
    -#> [1] 57.34239
    -#> 
    -#> $fim
    -#>                     CL         V        KA         d_CL        d_V        d_KA
    -#> CL         20100.83363 100.60318  57.19595    0.0000000     0.0000   0.0000000
    -#> V            100.60318  47.77375 -18.43690    0.0000000     0.0000   0.0000000
    -#> KA            57.19595 -18.43690  80.55401    0.0000000     0.0000   0.0000000
    -#> d_CL           0.00000   0.00000   0.00000 2019.7601648    73.4525   0.6961553
    -#> d_V            0.00000   0.00000   0.00000   73.4524996 48705.8108 117.2176533
    -#> d_KA           0.00000   0.00000   0.00000    0.6961553   117.2177  51.8762750
    -#> SIGMA[1,1]     0.00000   0.00000   0.00000 1428.9648684 31892.5113 417.9515723
    -#> SIGMA[2,2]     0.00000   0.00000   0.00000  274.2990996   640.9862  10.3145690
    -#>             SIGMA[1,1] SIGMA[2,2]
    -#> CL              0.0000    0.00000
    -#> V               0.0000    0.00000
    -#> KA              0.0000    0.00000
    -#> d_CL         1428.9649  274.29910
    -#> d_V         31892.5113  640.98623
    -#> d_KA          417.9516   10.31457
    -#> SIGMA[1,1] 353788.5599 6967.23365
    -#> SIGMA[2,2]   6967.2337  236.40519
    -#> 
    -#> $rse
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   4.742175   1.908239  11.706099  38.149149  23.388391  23.297863  28.859652 
    -#> SIGMA[2,2] 
    -#>  48.150485 
    -#> 
    -
    -
    -# what are the optimal proportions of 
    -# individuals in the two groups in the study?
    -(n_opt <- optimize_groupsize(poped.db))
    -#> Initial proportions:
    -#>  0.5 0.5 
    -#> 
    -#> initial  value -57.342391 
    -#> final  value -57.747204 
    -#> converged
    -#> 
    -#> Optimized proportions:
    -#>  0.2984998 0.7015002 
    -#> 
    -#> Optimized number of individuals per group
    -#>  OFV:  57.74718 
    -#>  30 70 
    -#> 
    -#> $initial_props
    -#> [1] 0.5 0.5
    -#> 
    -#> $initial_ofv
    -#> [1] 57.34239
    -#> 
    -#> $opt_props
    -#> [1] 0.2984998 0.7015002
    -#> 
    -#> $opt_ofv_with_props
    -#> [1] 57.7472
    -#> 
    -#> $opt_n_per_group
    -#> [1] 30 70
    -#> 
    -#> $opt_ofv_with_n
    -#> [1] 57.74718
    -#> 
    -
    -# How many individuals in the original design are needed to achieve an
    -# efficiency of 1 compared to the optimized design with n=100?
    -optimize_n_eff(poped.db,
    -               ofv_ref=n_opt$opt_ofv_with_n)
    -#> [1] 105.19
    -
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/optimize_n_dist-1.png b/docs/reference/optimize_n_dist-1.png deleted file mode 100644 index 680519a6..00000000 Binary files a/docs/reference/optimize_n_dist-1.png and /dev/null differ diff --git a/docs/reference/optimize_n_dist.html b/docs/reference/optimize_n_dist.html deleted file mode 100644 index b54eb2fb..00000000 --- a/docs/reference/optimize_n_dist.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - - - - - -Title Optimize the proportion of individuals in the design groups — optimize_n_dist • PopED - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - -
    - -
    -
    - - -
    -

    Title Optimize the proportion of individuals in the design groups

    -
    - -
    optimize_n_dist(
    -  poped.db,
    -  props = c(poped.db$design$groupsize/sum(poped.db$design$groupsize)),
    -  ...
    -)
    - -

    Arguments

    - - - - - - - - - - - - - - -
    poped.db

    A PopED database.

    props

    The proportions of individuals in each group -(relative to the total number of individuals) to start the optimization from.

    ...

    Arguments passed to ofv_fim and optim

    - -

    Value

    - -

    A list of the optimal proportions, the optimal number of individuals in each group, -and the initial and final objective function values.

    - -

    Examples

    -
    poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL, - fg_fun=function(x,a,bpop,b,bocc){ - parameters=c(CL=bpop[1]*exp(b[1]), - V=bpop[2]*exp(b[2]), - KA=bpop[3]*exp(b[3]), - Favail=bpop[4], - DOSE=a[1]) - return(parameters) - }, - fError_fun=feps.add.prop, - bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), - notfixed_bpop=c(1,1,1,0), - d=c(CL=0.07, V=0.02, KA=0.6), - sigma=c(PROP=0.01,ADD=0.25), - xt=list(c(1,2,3),c(4,5,20,120)), - groupsize=20, - minxt=0.01, - maxxt=120, - a=70, - mina=0.01, - maxa=100) - - - - -plot_model_prediction(poped.db)
    -(n_opt <- optimize_n_dist(poped.db))
    #> initial value -50.012065 -#> final value -50.416878 -#> converged
    #> $initial_props -#> [1] 0.5 0.5 -#> -#> $initial_ofv -#> [1] 50.01207 -#> -#> $opt_props -#> [1] 0.2984998 0.7015002 -#> -#> $opt_ofv -#> [1] 50.41688 -#> -#> $opt_n_per_group -#> [1] 11.93999 28.06001 -#>
    -
    - -
    - - - -
    - - - - - - - - diff --git a/docs/reference/optimize_n_eff-1.png b/docs/reference/optimize_n_eff-1.png deleted file mode 100644 index e99551d0..00000000 Binary files a/docs/reference/optimize_n_eff-1.png and /dev/null differ diff --git a/docs/reference/optimize_n_eff.html b/docs/reference/optimize_n_eff.html deleted file mode 100644 index bb8e8a55..00000000 --- a/docs/reference/optimize_n_eff.html +++ /dev/null @@ -1,241 +0,0 @@ - -Translate efficiency to number of subjects — optimize_n_eff • PopED - - -
    -
    - - - -
    -
    - - -
    -

    optimize HOW MANY n there should be to achieve efficiency=1 compared to a reference OFV

    -
    - -
    -
    optimize_n_eff(poped.db, ofv_ref, norm_group_fim = NULL, ...)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    ofv_ref
    -

    A reference OFV value to compare to.

    - - -
    norm_group_fim
    -

    The FIM per individual in each design group. If NULL, then -these are computed.

    - - -
    ...
    -

    Arguments passed to evaluate.fim and efficiency.

    - -
    -
    -

    Value

    - - -

    The number of individuals needed.

    -
    - -
    -

    Examples

    -
    # 2 design groups with either early or late samples
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=function(x,a,bpop,b,bocc){
    -                                    parameters=c(CL=bpop[1]*exp(b[1]),
    -                                                 V=bpop[2]*exp(b[2]),
    -                                                 KA=bpop[3]*exp(b[3]),
    -                                                 Favail=bpop[4],
    -                                                 DOSE=a[1])
    -                                    return(parameters) 
    -                                  },
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(0.01,0.25),
    -                                  xt=list(c(1,2,3),c(4,5,20,120)),
    -                                  groupsize=50,
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=70,
    -                                  mina=0.01,
    -                                  maxa=100)
    -
    -
    -plot_model_prediction(poped.db)
    -
    -
    -evaluate_design(poped.db)
    -#> $ofv
    -#> [1] 57.34239
    -#> 
    -#> $fim
    -#>                     CL         V        KA         d_CL        d_V        d_KA
    -#> CL         20100.83363 100.60318  57.19595    0.0000000     0.0000   0.0000000
    -#> V            100.60318  47.77375 -18.43690    0.0000000     0.0000   0.0000000
    -#> KA            57.19595 -18.43690  80.55401    0.0000000     0.0000   0.0000000
    -#> d_CL           0.00000   0.00000   0.00000 2019.7601648    73.4525   0.6961553
    -#> d_V            0.00000   0.00000   0.00000   73.4524996 48705.8108 117.2176533
    -#> d_KA           0.00000   0.00000   0.00000    0.6961553   117.2177  51.8762750
    -#> SIGMA[1,1]     0.00000   0.00000   0.00000 1428.9648684 31892.5113 417.9515723
    -#> SIGMA[2,2]     0.00000   0.00000   0.00000  274.2990996   640.9862  10.3145690
    -#>             SIGMA[1,1] SIGMA[2,2]
    -#> CL              0.0000    0.00000
    -#> V               0.0000    0.00000
    -#> KA              0.0000    0.00000
    -#> d_CL         1428.9649  274.29910
    -#> d_V         31892.5113  640.98623
    -#> d_KA          417.9516   10.31457
    -#> SIGMA[1,1] 353788.5599 6967.23365
    -#> SIGMA[2,2]   6967.2337  236.40519
    -#> 
    -#> $rse
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   4.742175   1.908239  11.706099  38.149149  23.388391  23.297863  28.859652 
    -#> SIGMA[2,2] 
    -#>  48.150485 
    -#> 
    -
    -
    -# what are the optimal proportions of 
    -# individuals in the two groups in the study?
    -(n_opt <- optimize_groupsize(poped.db))
    -#> Initial proportions:
    -#>  0.5 0.5 
    -#> 
    -#> initial  value -57.342391 
    -#> final  value -57.747204 
    -#> converged
    -#> 
    -#> Optimized proportions:
    -#>  0.2984998 0.7015002 
    -#> 
    -#> Optimized number of individuals per group
    -#>  OFV:  57.74718 
    -#>  30 70 
    -#> 
    -#> $initial_props
    -#> [1] 0.5 0.5
    -#> 
    -#> $initial_ofv
    -#> [1] 57.34239
    -#> 
    -#> $opt_props
    -#> [1] 0.2984998 0.7015002
    -#> 
    -#> $opt_ofv_with_props
    -#> [1] 57.7472
    -#> 
    -#> $opt_n_per_group
    -#> [1] 30 70
    -#> 
    -#> $opt_ofv_with_n
    -#> [1] 57.74718
    -#> 
    -
    -# How many individuals in the original design are needed to achieve an
    -# efficiency of 1 compared to the optimized design with n=100?
    -optimize_n_eff(poped.db,
    -               ofv_ref=n_opt$opt_ofv_with_n)
    -#> [1] 105.19
    -
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/optimize_n_rse-1.png b/docs/reference/optimize_n_rse-1.png deleted file mode 100644 index e99551d0..00000000 Binary files a/docs/reference/optimize_n_rse-1.png and /dev/null differ diff --git a/docs/reference/optimize_n_rse.html b/docs/reference/optimize_n_rse.html deleted file mode 100644 index e7243620..00000000 --- a/docs/reference/optimize_n_rse.html +++ /dev/null @@ -1,197 +0,0 @@ - -Optimize the number of subjects based on desired uncertainty of a parameter. — optimize_n_rse • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Optimize the number of subjects, -based on the current design and the desired uncertainty of a single parameter

    -
    - -
    -
    optimize_n_rse(
    -  poped.db,
    -  bpop_idx,
    -  need_rse,
    -  use_percent = TRUE,
    -  allowed_values = seq(poped.db$design$m, sum(poped.db$design$groupsize) * 5, by =
    -    poped.db$design$m)
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    bpop_idx
    -

    The index number of the parameter, currently only bpop parameters are allowed.

    - - -
    need_rse
    -

    The relative standard error (RSE) one would like to achieve (in percent, by default).

    - - -
    use_percent
    -

    Should the RSE be represented as a percentage (T/F)?

    - - -
    allowed_values
    -

    A vector of the allowed total number of subjects in the study.

    - -
    -
    -

    Value

    - - -

    The total number of subjects needed and the RSE of the parameter.

    -
    - -
    -

    Examples

    -
    # 2 design groups with either early or late samples
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=function(x,a,bpop,b,bocc){
    -                                    parameters=c(CL=bpop[1]*exp(b[1]),
    -                                                 V=bpop[2]*exp(b[2]),
    -                                                 KA=bpop[3]*exp(b[3]),
    -                                                 Favail=bpop[4],
    -                                                 DOSE=a[1])
    -                                    return(parameters) 
    -                                  },
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(0.01,0.25),
    -                                  xt=list(c(1,2,3),c(4,5,20,120)),
    -                                  groupsize=50,
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=70,
    -                                  mina=0.01,
    -                                  maxa=100)
    -
    -# plot of the design
    -plot_model_prediction(poped.db)
    -
    -
    -# the current RSE values
    -evaluate_design(poped.db)$rse
    -#>         CL          V         KA       d_CL        d_V       d_KA SIGMA[1,1] 
    -#>   4.742175   1.908239  11.706099  38.149149  23.388391  23.297863  28.859652 
    -#> SIGMA[2,2] 
    -#>  48.150485 
    -
    -# number of individuals if CL should have 10% RSE
    -optimize_n_rse(poped.db,
    -                bpop_idx=1, # for CL
    -                need_rse=10) # the RSE you want
    -#> $n
    -#> [1] 24
    -#> 
    -#> $par_rse
    -#>       CL 
    -#> 9.679923 
    -#> 
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/pargen.html b/docs/reference/pargen.html deleted file mode 100644 index ad7cff05..00000000 --- a/docs/reference/pargen.html +++ /dev/null @@ -1,271 +0,0 @@ - -Parameter simulation — pargen • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Function generates random samples for a list of parameters

    -
    - -
    -
    pargen(par, user_dist_pointer, sample_size, bLHS, sample_number, poped.db)
    -
    - -
    -

    Arguments

    -
    par
    -

    A matrix describing the parameters. Each row is a parameter and -the matrix has three columns:

    1. First column - Type of -distribution (0-fixed, 1-normal, 2-uniform, 3-user specified, 4-lognormal, -5-Truncated normal).

    2. -
    3. Second column - Mean of distribution.

    4. -
    5. Third -column - Variance or range of distribution.

    6. -
    - - -
    user_dist_pointer
    -

    A text string of the name of a function that -generates random samples from a user defined distribution.

    - - -
    sample_size
    -

    The number of random samples per parameter to generate

    - - -
    bLHS
    -

    Logical, indicating if Latin Hypercube Sampling should be used.

    - - -
    sample_number
    -

    The sample number to extract from a user distribution.

    - - -
    poped.db
    -

    A PopED database.

    - -
    -
    -

    Value

    - - -

    A matrix of random samples of size (sample_size x - number_of_parameters)

    -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin example)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define model, parameters, initial design
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  a=c(DOSE=70))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin example)
    -#####################################
    -
    -
    -# Adding 40% Uncertainty to fixed effects log-normal (not Favail)
    -bpop_vals <- c(CL=0.15, V=8, KA=1.0, Favail=1)
    -bpop_vals_ed_ln <- cbind(ones(length(bpop_vals),1)*4, # log-normal distribution
    -                      bpop_vals,
    -                      ones(length(bpop_vals),1)*(bpop_vals*0.4)^2) # 40% of bpop value
    -bpop_vals_ed_ln["Favail",]  <- c(0,1,0)
    -
    -pars.ln <- pargen(par=bpop_vals_ed_ln,
    -               user_dist_pointer=NULL,
    -               sample_size=1000,
    -               bLHS=1,
    -               sample_number=NULL,
    -               poped.db)
    -
    -
    -# Adding 10% Uncertainty to fixed effects normal-distribution (not Favail)
    -bpop_vals_ed_n <- cbind(ones(length(bpop_vals),1)*1, # log-normal distribution
    -                      bpop_vals,
    -                      ones(length(bpop_vals),1)*(bpop_vals*0.1)^2) # 10% of bpop value
    -bpop_vals_ed_n["Favail",]  <- c(0,1,0)
    -
    -pars.n <- pargen(par=bpop_vals_ed_n,
    -               user_dist_pointer=NULL,
    -               sample_size=1000,
    -               bLHS=1,
    -               sample_number=NULL,
    -               poped.db)
    -
    -
    -# Adding 10% Uncertainty to fixed effects uniform-distribution (not Favail)
    -bpop_vals_ed_u <- cbind(ones(length(bpop_vals),1)*2, # uniform distribution
    -                        bpop_vals,
    -                        ones(length(bpop_vals),1)*(bpop_vals*0.1)) # 10% of bpop value
    -bpop_vals_ed_u["Favail",]  <- c(0,1,0)
    -
    -pars.u <- pargen(par=bpop_vals_ed_u,
    -                 user_dist_pointer=NULL,
    -                 sample_size=1000,
    -                 bLHS=1,
    -                 sample_number=NULL,
    -                 poped.db)
    -
    -
    -# Adding user defined distributions
    -bpop_vals_ed_ud <- cbind(ones(length(bpop_vals),1)*3, # user dfined distribution
    -                         bpop_vals,
    -                         bpop_vals*0.1) # 10% of bpop value
    -bpop_vals_ed_ud["Favail",]  <- c(0,1,0)
    -
    -# A normal distribution
    -my_dist <- function(...){
    -  par_vec <- rnorm(c(1,1,1,1),mean=bpop_vals_ed_ud[,2],sd=bpop_vals_ed_ud[,3])
    -}
    -
    -pars.ud <- pargen(par=bpop_vals_ed_ud,
    -                  user_dist_pointer=my_dist,
    -                  sample_size=1000,
    -                  bLHS=1,
    -                  sample_number=NULL,
    -                  poped.db)
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/plot_efficiency_of_windows-1.png b/docs/reference/plot_efficiency_of_windows-1.png deleted file mode 100644 index 244757a2..00000000 Binary files a/docs/reference/plot_efficiency_of_windows-1.png and /dev/null differ diff --git a/docs/reference/plot_efficiency_of_windows-4.png b/docs/reference/plot_efficiency_of_windows-4.png deleted file mode 100644 index e2015aa9..00000000 Binary files a/docs/reference/plot_efficiency_of_windows-4.png and /dev/null differ diff --git a/docs/reference/plot_efficiency_of_windows-6.png b/docs/reference/plot_efficiency_of_windows-6.png deleted file mode 100644 index a56dd459..00000000 Binary files a/docs/reference/plot_efficiency_of_windows-6.png and /dev/null differ diff --git a/docs/reference/plot_efficiency_of_windows.html b/docs/reference/plot_efficiency_of_windows.html deleted file mode 100644 index 8ed195bb..00000000 --- a/docs/reference/plot_efficiency_of_windows.html +++ /dev/null @@ -1,330 +0,0 @@ - -Plot the efficiency of windows — plot_efficiency_of_windows • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Function plots the efficiency of windows around the sample time points. -The function samples from a uniform distribution around the sample time -points for each group (or each individual with deviate_by_id=TRUE, -with slower calculation times) and compares the results with the -design defined in poped.db. The maximal and minimal allowed values for all design variables as -defined in poped.db are respected (e.g. poped.db$design_space$minxt and -poped.db$design_space$maxxt).

    -
    - -
    -
    plot_efficiency_of_windows(
    -  poped.db,
    -  xt_windows = NULL,
    -  xt_plus = xt_windows,
    -  xt_minus = xt_windows,
    -  iNumSimulations = 100,
    -  y_eff = TRUE,
    -  y_rse = TRUE,
    -  ofv_calc_type = poped.db$settings$ofv_calc_type,
    -  mean_line = TRUE,
    -  mean_color = "red",
    -  deviate_by_id = FALSE,
    -  parallel = F,
    -  seed = round(runif(1, 0, 1e+07)),
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A poped database

    - - -
    xt_windows
    -

    The distance on one direction from the optimal sample -times. Can be a number or a matrix of the same size as the xt matrix found -in poped.db$design$xt.

    - - -
    xt_plus
    -

    The upper distance from the optimal sample times (xt + -xt_plus). Can be a number or a matrix of the same size as the xt matrix -found in poped.db$design$xt.

    - - -
    xt_minus
    -

    The lower distance from the optimal sample times (xt - -xt_minus). Can be a number or a matrix of the same size as the xt matrix -found in poped.db$design$xt.

    - - -
    iNumSimulations
    -

    The number of design simulations to make within the -specified windows.

    - - -
    y_eff
    -

    Should one of the plots created have efficiency on the y-axis?

    - - -
    y_rse
    -

    Should created plots include the relative standard error of each -parameter as a value on the y-axis?

    - - -
    ofv_calc_type
    -

    OFV calculation type for FIM

    • 1 = "D-optimality". Determinant of the FIM: det(FIM)

    • -
    • 2 = "A-optimality". Inverse of the sum of the expected parameter variances: -1/trace_matrix(inv(FIM))

    • -
    • 4 = "lnD-optimality". Natural logarithm of the determinant of the FIM: log(det(FIM))

    • -
    • 6 = "Ds-optimality". Ratio of the Determinant of the FIM and the Determinant of the uninteresting -rows and columns of the FIM: det(FIM)/det(FIM_u)

    • -
    • 7 = Inverse of the sum of the expected parameter RSE: 1/sum(get_rse(FIM,poped.db,use_percent=FALSE))

    • -
    - - -
    mean_line
    -

    Should a mean value line be created?

    - - -
    mean_color
    -

    The color of the mean value line.

    - - -
    deviate_by_id
    -

    Should the computations look at deviations per -individual instead of per group?

    - - -
    parallel
    -

    Should we use parallel computations (T/F)? -Other options can be defined in this function and passed -to start_parallel. See especially -the options dlls and mrgsolve_model from that function -if you have a model defined with -compiled code or are using mrgsolve.

    - - -
    seed
    -

    The random seed to use.

    - - -
    ...
    -

    Extra arguments passed to evaluate.fim

    - -
    -
    -

    Value

    - - -

    A ggplot object.

    -
    -
    -

    See also

    -

    Other evaluate_design: -evaluate.fim(), -evaluate_design(), -evaluate_power(), -get_rse(), -model_prediction(), -plot_model_prediction()

    -

    Other Simulation: -model_prediction(), -plot_model_prediction()

    -

    Other Graphics: -plot_model_prediction()

    -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -
    -
    -# Examine efficiency of sampling windows at plus/minus 0.5 hours from 
    -# sample points in the design
    -plot_efficiency_of_windows(poped.db,xt_windows=0.5)
    -
    -
    -
    -if(interactive()){  
    -
    -  plot_efficiency_of_windows(poped.db,
    -                             xt_plus=c( 0.5,1,2,1,2,3,7,1),
    -                             xt_minus=c( 0.1,2,5,4,2,3,6,2))
    -  
    -  plot_efficiency_of_windows(poped.db,xt_windows=c( 0.5,1,2,1,2,3,7,1))
    -  
    -  
    -  plot_efficiency_of_windows(poped.db,
    -                             xt_plus=c( 0.5,1,2,1,2,3,7,1),
    -                             xt_minus=c( 0.1,2,5,4,2,3,6,2),
    -                             y_rse=FALSE)
    -  
    -  plot_efficiency_of_windows(poped.db,
    -                             xt_plus=c( 0.5,1,2,1,2,3,7,1),
    -                             xt_minus=c( 0.1,2,5,4,2,3,6,2),
    -                             y_eff=FALSE)
    -}
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/plot_model_prediction-4.png b/docs/reference/plot_model_prediction-4.png deleted file mode 100644 index 57b77e26..00000000 Binary files a/docs/reference/plot_model_prediction-4.png and /dev/null differ diff --git a/docs/reference/plot_model_prediction-6.png b/docs/reference/plot_model_prediction-6.png deleted file mode 100644 index 4d02e192..00000000 Binary files a/docs/reference/plot_model_prediction-6.png and /dev/null differ diff --git a/docs/reference/plot_model_prediction.html b/docs/reference/plot_model_prediction.html deleted file mode 100644 index b44ad478..00000000 --- a/docs/reference/plot_model_prediction.html +++ /dev/null @@ -1,477 +0,0 @@ - -Plot model predictions — plot_model_prediction • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Function plots model predictions for the typical value in the population, -individual predictions and data predictions.

    -
    - -
    -
    plot_model_prediction(
    -  poped.db,
    -  model_num_points = 100,
    -  groupsize_sim = 100,
    -  separate.groups = F,
    -  sample.times = T,
    -  sample.times.IPRED = F,
    -  sample.times.DV = F,
    -  PRED = T,
    -  IPRED = F,
    -  IPRED.lines = F,
    -  IPRED.lines.pctls = F,
    -  alpha.IPRED.lines = 0.1,
    -  alpha.IPRED = 0.3,
    -  sample.times.size = 4,
    -  DV = F,
    -  alpha.DV = 0.3,
    -  DV.lines = F,
    -  DV.points = F,
    -  alpha.DV.lines = 0.3,
    -  alpha.DV.points = 0.3,
    -  sample.times.DV.points = F,
    -  sample.times.DV.lines = F,
    -  alpha.sample.times.DV.points = 0.3,
    -  alpha.sample.times.DV.lines = 0.3,
    -  y_lab = "Model Predictions",
    -  facet_scales = "fixed",
    -  facet_label_names = T,
    -  model.names = NULL,
    -  DV.mean.sd = FALSE,
    -  PI = FALSE,
    -  PI_alpha = 0.3,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    model_num_points
    -

    How many extra observation rows should be created in the data frame for each group or individual -per model. If used then the points are placed evenly between model_minxt and model_maxxt. This option -is used by plot_model_prediction to simulate the response of the model on a finer grid then the defined design. -If NULL then only the input design is used. Can be a single value or a vector the same length as the number of models.

    - - -
    groupsize_sim
    -

    How many individuals per group should be -simulated when DV=TRUE or IPRED=TRUE to create prediction intervals?

    - - -
    separate.groups
    -

    Should there be separate plots for each group.

    - - -
    sample.times
    -

    Should sample times be shown on the plots.

    - - -
    sample.times.IPRED
    -

    Should sample times be shown based on the IPRED y-values.

    - - -
    sample.times.DV
    -

    Should sample times be shown based on the DV y-values.

    - - -
    PRED
    -

    Should a PRED line be drawn.

    - - -
    IPRED
    -

    Should we simulate individual predictions?

    - - -
    IPRED.lines
    -

    Should IPRED lines be drawn?

    - - -
    IPRED.lines.pctls
    -

    Should lines be drawn at the chosen percentiles of the IPRED values?

    - - -
    alpha.IPRED.lines
    -

    What should the transparency for the IPRED.lines be?

    - - -
    alpha.IPRED
    -

    What should the transparency of the IPRED CI?

    - - -
    sample.times.size
    -

    What should the size of the sample.times be?

    - - -
    DV
    -

    should we simulate observations?

    - - -
    alpha.DV
    -

    What should the transparency of the DV CI?

    - - -
    DV.lines
    -

    Should DV lines be drawn?

    - - -
    DV.points
    -

    Should DV points be drawn?

    - - -
    alpha.DV.lines
    -

    What should the transparency for the DV.lines be?

    - - -
    alpha.DV.points
    -

    What should the transparency for the DV.points be?

    - - -
    sample.times.DV.points
    -

    TRUE or FALSE.

    - - -
    sample.times.DV.lines
    -

    TRUE or FALSE.

    - - -
    alpha.sample.times.DV.points
    -

    What should the transparency for the sample.times.DV.points be?

    - - -
    alpha.sample.times.DV.lines
    -

    What should the transparency for the sample.times.DV.lines be?

    - - -
    y_lab
    -

    The label of the y-axis.

    - - -
    facet_scales
    -

    Can be "free", "fixed", "free_x" or "free_y"

    - - -
    facet_label_names
    -

    TRUE or FALSE

    - - -
    model.names
    -

    A vector of names of the response model/s (the length of the -vector should be equal to the number of response models). It is Null by default.

    - - -
    DV.mean.sd
    -

    Plot the mean and standard deviation of simulated observations.

    - - -
    PI
    -

    Plot prediction intervals for the expected data given the model. -Predictions are based on first-order approximations to -the model variance and a normality assumption of that variance. As such these computations are -more approximate than using DV=T and groupsize_sim = some large number.

    - - -
    PI_alpha
    -

    The transparency of the PI.

    - - -
    ...
    -

    Additional arguments passed to the model_prediction function.

    - -
    -
    -

    Value

    - - -

    A ggplot object. If you would like to further edit this plot don't -forget to load the ggplot2 library using library(ggplot2).

    -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    ## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -library(PopED)
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.md.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         N = floor(xt/TAU) + 1
    -#>         y = (DOSE * Favail/V) * (KA/(KA - CL/V)) * (exp(-CL/V * 
    -#>             (xt - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - 
    -#>             exp(-CL/V * TAU)) - exp(-KA * (xt - (N - 1) * TAU)) * 
    -#>             (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU)))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1104c9b70>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -    return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_file="ff.PK.1.comp.oral.sd.CL",
    -                                  fg_file="sfg",
    -                                  fError_file="feps.prop",
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=0.01,
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0,
    -                                  maxxt=120,
    -                                  a=70)
    -#> Warning: cannot open file 'sfg': No such file or directory
    -#> Error in file(filename, "r", encoding = encoding): cannot open the connection
    -
    -##  create plot of model without variability 
    -plot_model_prediction(poped.db)
    -#> Error in eval(expr, envir, enclos): object 'poped.db' not found
    -
    -##  create plot of model with variability by simulating from OMEGA and SIGMA
    -plot_model_prediction(poped.db,IPRED=TRUE,DV=TRUE)
    -#> Error in eval(expr, envir, enclos): object 'poped.db' not found
    -
    -##  create plot of model with variability by 
    -##  computing the expected variance (using an FO approximation) 
    -##  and then computing a prediction interval 
    -##  based on an assumption of normality
    -##  computation is faster but less accurate 
    -##  compared to using DV=TRUE (and groupsize_sim = 500)
    -plot_model_prediction(poped.db,PI=TRUE)
    -#> Error in eval(expr, envir, enclos): object 'poped.db' not found
    -
    -##-- Model: One comp first order absorption + inhibitory imax
    -## -- works for both mutiple and single dosing  
    -ff <- function(model_switch,xt,parameters,poped.db){
    -  with(as.list(parameters),{
    -    
    -    y=xt
    -    MS <- model_switch
    -    
    -    # PK model
    -    N = floor(xt/TAU)+1
    -    CONC=(DOSE*Favail/V)*(KA/(KA - CL/V)) * 
    -      (exp(-CL/V * (xt - (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - exp(-CL/V * TAU)) - 
    -         exp(-KA * (xt - (N - 1) * TAU)) * (1 - exp(-N * KA * TAU))/(1 - exp(-KA * TAU)))  
    -    
    -    # PD model
    -    EFF = E0*(1 - CONC*IMAX/(IC50 + CONC))
    -    
    -    y[MS==1] = CONC[MS==1]
    -    y[MS==2] = EFF[MS==2]
    -    
    -    return(list( y= y,poped.db=poped.db))
    -  })
    -}
    -
    -## -- parameter definition function 
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c( V=bpop[1]*exp(b[1]),
    -                KA=bpop[2]*exp(b[2]),
    -                CL=bpop[3]*exp(b[3]),
    -                Favail=bpop[4],
    -                DOSE=a[1],
    -                TAU = a[2],
    -                E0=bpop[5]*exp(b[4]),
    -                IMAX=bpop[6],
    -                IC50=bpop[7])
    -  return( parameters ) 
    -}
    -
    -
    -## -- Residual Error function
    -feps <- function(model_switch,xt,parameters,epsi,poped.db){
    -  returnArgs <- ff(model_switch,xt,parameters,poped.db) 
    -  y <- returnArgs[[1]]
    -  poped.db <- returnArgs[[2]]
    -  
    -  MS <- model_switch
    -  
    -  pk.dv <- y*(1+epsi[,1])+epsi[,2]
    -  pd.dv <-  y*(1+epsi[,3])+epsi[,4]
    -  
    -  y[MS==1] = pk.dv[MS==1]
    -  y[MS==2] = pd.dv[MS==2]
    -  
    -  return(list( y= y,poped.db =poped.db )) 
    -}
    -
    -poped.db <- 
    -  create.poped.database(
    -    ff_fun="ff",
    -    fError_fun="feps",
    -    fg_fun="sfg",
    -    groupsize=20,
    -    m=3,
    -    bpop=c(V=72.8,KA=0.25,CL=3.75,Favail=0.9,
    -           E0=1120,IMAX=0.807,IC50=0.0993),  
    -    notfixed_bpop=c(1,1,1,0,1,1,1),
    -    d=c(V=0.09,KA=0.09,CL=0.25^2,E0=0.09), 
    -    sigma=c(0.04,5e-6,0.09,100),
    -    notfixed_sigma=c(0,0,0,0),
    -    xt=c( 1,2,8,240,240,1,2,8,240,240),
    -    minxt=c(0,0,0,240,240,0,0,0,240,240),
    -    maxxt=c(10,10,10,248,248,10,10,10,248,248),
    -    discrete_xt = list(0:248),
    -    G_xt=c(1,2,3,4,5,1,2,3,4,5),
    -    bUseGrouped_xt=1,
    -    model_switch=c(1,1,1,1,1,2,2,2,2,2),
    -    a=list(c(DOSE=20,TAU=24),c(DOSE=40, TAU=24),c(DOSE=0, TAU=24)),
    -    maxa=c(DOSE=200,TAU=40),
    -    mina=c(DOSE=0,TAU=2),
    -    ourzero=0)
    -#> Error in do.call(poped.db$model$fg_pointer, list(0, 0, 0, 0, zeros(poped.db$parameters$NumDocc,     poped.db$parameters$NumOcc))): 'what' must be a function or character string
    -
    -##  create plot of model and design 
    -plot_model_prediction(poped.db,facet_scales="free",
    -                      model.names = c("PK","PD"))
    -#> Error in eval(expr, envir, enclos): object 'poped.db' not found
    -
    -##  create plot of model with variability by  
    -##  computing the expected variance (using an FO approximation) 
    -##  and then computing a prediction interval 
    -##  based on an assumption of normality
    -##  computation is faster but less accurate 
    -##  compared to using DV=TRUE (and groupsize_sim = 500)
    -plot_model_prediction(poped.db,facet_scales="free",
    -                      model.names = c("PK","PD"),
    -                      PI=TRUE,
    -                      separate.groups = TRUE)
    -#> Error in eval(expr, envir, enclos): object 'poped.db' not found
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/poped.choose.html b/docs/reference/poped.choose.html deleted file mode 100644 index 932ecbac..00000000 --- a/docs/reference/poped.choose.html +++ /dev/null @@ -1,141 +0,0 @@ - -Choose between arg1 and arg2 — poped.choose • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Function chooses arg1 unless it is NULL in which case arg2 is chosen.

    -
    - -
    -
    poped.choose(arg1, arg2)
    -
    - -
    -

    Arguments

    -
    arg1
    -

    The first argument

    - - -
    arg2
    -

    The second argument

    - -
    - - -
    -

    Examples

    -
    
    -poped.choose(2,5)
    -#> [1] 2
    -
    -poped.choose("foo",66)
    -#> [1] "foo"
    -
    -poped.choose(NULL,"hello")
    -#> [1] "hello"
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/poped_gui.html b/docs/reference/poped_gui.html deleted file mode 100644 index 250242a4..00000000 --- a/docs/reference/poped_gui.html +++ /dev/null @@ -1,109 +0,0 @@ - -Run the graphical interface for PopED — poped_gui • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Run the graphical interface for PopED

    -
    - -
    -
    poped_gui()
    -
    - - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/poped_optim.html b/docs/reference/poped_optim.html deleted file mode 100644 index 6ea1aea9..00000000 --- a/docs/reference/poped_optim.html +++ /dev/null @@ -1,992 +0,0 @@ - -Optimize a design defined in a PopED database — poped_optim • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Optimize a design defined in a PopED database using the objective function -described in the database (or in the arguments to this function). The -function works for both discrete and -continuous optimization variables.

    -
    - -
    -
    poped_optim(
    -  poped.db,
    -  opt_xt = poped.db$settings$optsw[2],
    -  opt_a = poped.db$settings$optsw[4],
    -  opt_x = poped.db$settings$optsw[3],
    -  opt_samps = poped.db$settings$optsw[1],
    -  opt_inds = poped.db$settings$optsw[5],
    -  method = c("ARS", "BFGS", "LS"),
    -  control = list(),
    -  trace = TRUE,
    -  fim.calc.type = poped.db$settings$iFIMCalculationType,
    -  ofv_calc_type = poped.db$settings$ofv_calc_type,
    -  ds_index = poped.db$parameters$ds_index,
    -  approx_type = poped.db$settings$iApproximationMethod,
    -  d_switch = poped.db$settings$d_switch,
    -  ED_samp_size = poped.db$settings$ED_samp_size,
    -  bLHS = poped.db$settings$bLHS,
    -  use_laplace = poped.db$settings$iEDCalculationType,
    -  out_file = "",
    -  parallel = F,
    -  parallel_type = NULL,
    -  num_cores = NULL,
    -  mrgsolve_model = NULL,
    -  loop_methods = ifelse(length(method) > 1, TRUE, FALSE),
    -  iter_max = 10,
    -  stop_crit_eff = 1.001,
    -  stop_crit_diff = NULL,
    -  stop_crit_rel = NULL,
    -  ofv_fun = poped.db$settings$ofv_fun,
    -  maximize = T,
    -  allow_replicates = TRUE,
    -  allow_replicates_xt = TRUE,
    -  allow_replicates_a = TRUE,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    opt_xt
    -

    Should the sample times be optimized?

    - - -
    opt_a
    -

    Should the continuous design variables be optimized?

    - - -
    opt_x
    -

    Should the discrete design variables be optimized?

    - - -
    opt_samps
    -

    Are the number of sample times per group being optimized?

    - - -
    opt_inds
    -

    Are the number of individuals per group being optimized?

    - - -
    method
    -

    A vector of optimization methods to use in a sequential -fashion. Options are c("ARS","BFGS","LS","GA"). c("ARS") is -for Adaptive Random Search optim_ARS. c("LS") is for -Line Search optim_LS. c("BFGS") is for Method -"L-BFGS-B" from optim. c("GA") is for the -genetic algorithm from ga.

    - - -
    control
    -

    Contains control arguments for each method specified.

    - - -
    trace
    -

    Should the algorithm output results intermittently.

    - - -
    fim.calc.type
    -

    The method used for calculating the FIM. Potential values:

    • 0 = Full FIM. No assumption that fixed and random effects are uncorrelated.

    • -
    • 1 = Reduced FIM. Assume that there is no correlation in the FIM between the fixed and random effects, and set these elements in -the FIM to zero.

    • -
    • 2 = weighted models (placeholder).

    • -
    • 3 = Not currently used.

    • -
    • 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). -This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the residual unexplained variation by default).

    • -
    • 5 = Full FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    • 6 = Calculate one model switch at a time, good for large matrices.

    • -
    • 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    - - -
    ofv_calc_type
    -

    OFV calculation type for FIM

    • 1 = "D-optimality". Determinant of the FIM: det(FIM)

    • -
    • 2 = "A-optimality". Inverse of the sum of the expected parameter variances: -1/trace_matrix(inv(FIM))

    • -
    • 4 = "lnD-optimality". Natural logarithm of the determinant of the FIM: log(det(FIM))

    • -
    • 6 = "Ds-optimality". Ratio of the Determinant of the FIM and the Determinant of the uninteresting -rows and columns of the FIM: det(FIM)/det(FIM_u)

    • -
    • 7 = Inverse of the sum of the expected parameter RSE: 1/sum(get_rse(FIM,poped.db,use_percent=FALSE))

    • -
    - - -
    ds_index
    -

    Ds_index is a vector set to 1 if a parameter is uninteresting, otherwise 0. -size=(1,num unfixed parameters). First unfixed bpop, then unfixed d, then unfixed docc and last unfixed sigma. -Default is the fixed effects being important, everything else not important. Used in conjunction with -ofv_calc_type=6.

    - - -
    approx_type
    -

    Approximation method for model, 0=FO, 1=FOCE, 2=FOCEI, 3=FOI.

    - - -
    d_switch
    -
    • ******START OF CRITERION SPECIFICATION OPTIONS**********

    • -

    D-family design (1) or ED-family design (0) (with or without parameter uncertainty)

    - - -
    ED_samp_size
    -

    Sample size for E-family sampling

    - - -
    bLHS
    -

    How to sample from distributions in E-family calculations. 0=Random Sampling, 1=LatinHyperCube --

    - - -
    use_laplace
    -

    Should the Laplace method be used in calculating the expectation of the OFV?

    - - -
    out_file
    -

    Save output from the optimization to a file.

    - - -
    parallel
    -

    Should we use parallel computations?

    - - -
    parallel_type
    -

    Which type of parallelization should be used? -Can be "snow" or "multicore". "snow" works on Linux-like systems & Windows. "multicore" works only on -Linux-like systems. By default this is chosen for you depending on your operating system. -See start_parallel.

    - - -
    num_cores
    -

    The number of cores to use in the parallelization. By default is set to the number - output from -parallel::detectCores(). -See start_parallel.

    - - -
    mrgsolve_model
    -

    If the computations require a mrgsolve model and you -are using the "snow" method then you need to specify the name of the model -object created by mread or mcode.

    - - -
    loop_methods
    -

    Should the optimization methods be looped for -iter_max iterations, or until the efficiency of the design after the -current series (compared to the start of the series) is less than, or equal to, -stop_crit_eff?

    - - -
    iter_max
    -

    If line search is used then the algorithm tests if line -search (always run at the end of the optimization iteration) changes the -design in any way. If not, the algorithm stops. If yes, then a new -iteration is run unless iter_max iterations have already been run.

    - - -
    stop_crit_eff
    -

    If loop_methods==TRUE, the looping will stop if the -efficiency of the design after the current series (compared to the start of -the series) is less than, or equal to, stop_crit_eff (if maximize==FALSE then 1/stop_crit_eff is the cut -off and the efficiency must be greater than or equal to this value to stop the looping).

    - - -
    stop_crit_diff
    -

    If loop_methods==TRUE, the looping will stop if the -difference in criterion value of the design after the current series (compared to the start of -the series) is less than, or equal to, stop_crit_diff (if maximize==FALSE then -stop_crit_diff is the cut -off and the difference in criterion value must be greater than or equal to this value to stop the looping).

    - - -
    stop_crit_rel
    -

    If loop_methods==TRUE, the looping will stop if the -relative difference in criterion value of the design after the current series (compared to the start of -the series) is less than, or equal to, stop_crit_rel (if maximize==FALSE then -stop_crit_rel is the cut -off and the relative difference in criterion value must be greater than or equal to this value to stop the looping).

    - - -
    ofv_fun
    -

    User defined function used to compute the objective function. The function must have a poped database object as its first -argument and have "..." in its argument list. Can be referenced as a function or as a file name where the function defined in the file has the same name as the file. -e.g. "cost.txt" has a function named "cost" in it.

    - - -
    maximize
    -

    Should the objective function be maximized or minimized?

    - - -
    allow_replicates
    -

    Should the algorithm allow optimized design components to have the same value? If FALSE then -all discrete optimizations will not allow replicates within variable types -(equivalent to allow_replicates_xt=FALSE and allow_replicates_a=FALSE).

    - - -
    allow_replicates_xt
    -

    Should the algorithm allow optimized xt design components to have the same value? If FALSE then -all discrete optimizations will not allow replicates.

    - - -
    allow_replicates_a
    -

    Should the algorithm allow optimized a design components to have the same value? If FALSE then -all discrete optimizations will not allow replicates.

    - - -
    ...
    -

    arguments passed to other functions.

    - -
    -
    -

    Details

    -

    This function takes information from the PopED database supplied as an -argument. The PopED database supplies information about the the model, -parameters, design and methods to use. Some of the arguments coming from the -PopED database can be overwritten; if they are supplied then they are used -instead of the arguments from the PopED database.

    -

    If more than one optimization method is -specified then the methods are run in series. If loop_methods=TRUE -then the series of optimization methods will be run for iter_max -iterations, or until the efficiency of the design after the current series -(compared to the start of the series) is less than stop_crit_eff.

    -
    -
    -

    References

    - -
    1. M. Foracchia, A.C. Hooker, P. Vicini and A. - Ruggeri, "PopED, a software fir optimal experimental design in population - kinetics", Computer Methods and Programs in Biomedicine, 74, 2004.

    2. -
    3. J. - Nyberg, S. Ueckert, E.A. Stroemberg, S. Hennig, M.O. Karlsson and A.C. - Hooker, "PopED: An extended, parallelized, nonlinear mixed effects models - optimal design tool", Computer Methods and Programs in Biomedicine, 108, - 2012.

    4. -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -##############
    -# D-family Optimization
    -##############
    -
    -# below are a number of ways to optimize the problem
    -
    -
    -# ARS+BFGS+LS optimization of dose
    -# optimization with just a few iterations
    -# only to check that things are working
    -out_1 <- poped_optim(poped.db,opt_a =TRUE,
    -                      control = list(ARS=list(iter=2),
    -                                     BFGS=list(maxit=2),
    -                                     LS=list(line_length=2)),
    -                      iter_max = 1)
    -#> ===============================================================================
    -#> Initial design evaluation
    -#> 
    -#> Initial OFV = 55.3964
    -#> 
    -#> Initial design
    -#> expected relative standard error
    -#> (%RSE, rounded to nearest integer)
    -#>    Parameter   Values   RSE_0
    -#>           CL     0.15       5
    -#>            V        8       3
    -#>           KA        1      14
    -#>         d_CL     0.07      30
    -#>          d_V     0.02      37
    -#>         d_KA      0.6      27
    -#>     sig_prop     0.01      32
    -#>      sig_add     0.25      26
    -#> 
    -#> ==============================================================================
    -#> Optimization of design parameters
    -#> 
    -#> * Optimize Covariates
    -#> 
    -#> ************* Iteration 1  for all optimization methods***********************
    -#> 
    -#> *******************************************
    -#> Running Adaptive Random Search Optimization
    -#> *******************************************
    -#> Initial OFV = 55.3964
    -#> 
    -#> Total iterations: 2 
    -#> Elapsed time: 0.011 seconds.
    -#> 
    -#> Final OFV =  55.39645 
    -#> Parameters: 70 
    -#> 
    -#> *******************************************
    -#> Running BFGS Optimization
    -#> *******************************************
    -#> initial  value -55.396450 
    -#> final  value -55.766379 
    -#> stopped after 2 iterations
    -#> 
    -#> *******************************************
    -#> Running Line Search Optimization
    -#> *******************************************
    -#> 
    -#>    Initial parameters: 83.20112 
    -#>    Initial OFV: 55.76638 
    -#> 
    -#>    Searching parameter 1 
    -#>      Changed from 83.2011 to 100 ; OFV = 56.032 
    -#> 
    -#>    Elapsed time: 0.01 seconds.
    -#> 
    -#>    Final OFV =  56.03204 
    -#>    Parameters: 100 
    -#> 
    -#> *******************************************
    -#> Stopping criteria testing
    -#> (Compare between start of iteration and end of iteration)
    -#> *******************************************
    -#> Difference in OFV:  0.636
    -#> Relative difference in OFV:  1.15%
    -#> Efficiency: 
    -#>   ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.0827
    -#> 
    -#>  Efficiency stopping criteria: 
    -#>   Is (1.0827 <= 1.001)?   No.
    -#>   Stopping criteria NOT achieved.
    -#> 
    -#> Stopping criteria NOT achieved.
    -#> 
    -#> ===============================================================================
    -#> FINAL RESULTS
    -#> 
    -#> Optimized Covariates:
    -#> Group 1: 100
    -#> 
    -#> OFV = 56.032
    -#> 
    -#> Efficiency: 
    -#>   ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.0827
    -#> 
    -#> Expected relative standard error
    -#> (%RSE, rounded to nearest integer):
    -#>    Parameter   Values   RSE_0   RSE
    -#>           CL     0.15       5     5
    -#>            V        8       3     3
    -#>           KA        1      14    14
    -#>         d_CL     0.07      30    28
    -#>          d_V     0.02      37    34
    -#>         d_KA      0.6      27    26
    -#>     sig_prop     0.01      32    23
    -#>      sig_add     0.25      26    30
    -#> 
    -#> Total running time: 0.122 seconds
    -
    -
    -# cost function
    -# PRED at 120 hours
    -crit_fcn <- function(poped.db,...){
    -  pred_df <- model_prediction(poped.db)
    -  return(pred_df[pred_df$Time==120,"PRED"])
    -}
    -
    -# maximize cost function
    -out_2 <- poped_optim(poped.db,opt_a =TRUE,
    -                     ofv_fun=crit_fcn,
    -                     control = list(ARS=list(iter=2),
    -                                    BFGS=list(maxit=2),
    -                                    LS=list(line_length=2)),
    -                     iter_max = 2)
    -#> ===============================================================================
    -#> Initial design evaluation
    -#> 
    -#> Initial OFV = 0.939866
    -#> 
    -#> Initial design
    -#> expected relative standard error
    -#> (%RSE, rounded to nearest integer)
    -#>    Parameter   Values   RSE_0
    -#>           CL     0.15       5
    -#>            V        8       3
    -#>           KA        1      14
    -#>         d_CL     0.07      30
    -#>          d_V     0.02      37
    -#>         d_KA      0.6      27
    -#>     sig_prop     0.01      32
    -#>      sig_add     0.25      26
    -#> 
    -#> ==============================================================================
    -#> Optimization of design parameters
    -#> 
    -#> * Optimize Covariates
    -#> 
    -#> ************* Iteration 1  for all optimization methods***********************
    -#> 
    -#> *******************************************
    -#> Running Adaptive Random Search Optimization
    -#> *******************************************
    -#> Initial OFV = 0.939866
    -#> 
    -#> Total iterations: 2 
    -#> Elapsed time: 0.003 seconds.
    -#> 
    -#> Final OFV =  0.9398657 
    -#> Parameters: 70 
    -#> 
    -#> *******************************************
    -#> Running BFGS Optimization
    -#> *******************************************
    -#> initial  value -0.939866 
    -#> final  value -1.014649 
    -#> stopped after 2 iterations
    -#> 
    -#> *******************************************
    -#> Running Line Search Optimization
    -#> *******************************************
    -#> 
    -#>    Initial parameters: 75.56977 
    -#>    Initial OFV: 1.014649 
    -#> 
    -#>    Searching parameter 1 
    -#>      Changed from 75.5698 to 100 ; OFV = 1.34267 
    -#> 
    -#>    Elapsed time: 0.007 seconds.
    -#> 
    -#>    Final OFV =  1.342665 
    -#>    Parameters: 100 
    -#> 
    -#> *******************************************
    -#> Stopping criteria testing
    -#> (Compare between start of iteration and end of iteration)
    -#> *******************************************
    -#> Difference in OFV:  0.403
    -#> Relative difference in OFV:  42.9%
    -#> Efficiency: 
    -#>   (ofv_final / ofv_init) = 1.4286
    -#> 
    -#>  Efficiency stopping criteria: 
    -#>   Is (1.4286 <= 1.001)?   No.
    -#>   Stopping criteria NOT achieved.
    -#> 
    -#> Stopping criteria NOT achieved.
    -#> 
    -#> ************* Iteration 2  for all optimization methods***********************
    -#> 
    -#> *******************************************
    -#> Running Adaptive Random Search Optimization
    -#> *******************************************
    -#> Initial OFV = 1.34267
    -#> 
    -#> Total iterations: 2 
    -#> Elapsed time: 0.003 seconds.
    -#> 
    -#> Final OFV =  1.342665 
    -#> Parameters: 100 
    -#> 
    -#> *******************************************
    -#> Running BFGS Optimization
    -#> *******************************************
    -#> initial  value -1.342665 
    -#> final  value -1.342665 
    -#> converged
    -#> 
    -#> *******************************************
    -#> Running Line Search Optimization
    -#> *******************************************
    -#> 
    -#>    Initial parameters: 100 
    -#>    Initial OFV: 1.342665 
    -#> 
    -#>    Searching parameter 1 
    -#>      Changed from 100 to 100 ; OFV = 1.34267 
    -#> 
    -#>    Elapsed time: 0.004 seconds.
    -#> 
    -#>    Final OFV =  1.342665 
    -#>    Parameters: 100 
    -#> 
    -#> *******************************************
    -#> Stopping criteria testing
    -#> (Compare between start of iteration and end of iteration)
    -#> *******************************************
    -#> Difference in OFV:  0
    -#> Relative difference in OFV:  0%
    -#> Efficiency: 
    -#>   (ofv_final / ofv_init) = 1
    -#> 
    -#>  Efficiency stopping criteria: 
    -#>   Is (1 <= 1.001)?   Yes.
    -#>   Stopping criteria achieved.
    -#> 
    -#> Stopping criteria achieved.
    -#> 
    -#> ===============================================================================
    -#> FINAL RESULTS
    -#> 
    -#> Optimized Covariates:
    -#> Group 1: 100
    -#> 
    -#> OFV = 1.34267
    -#> 
    -#> Efficiency: 
    -#>   (ofv_final / ofv_init) = 1.4286
    -#> 
    -#> Expected relative standard error
    -#> (%RSE, rounded to nearest integer):
    -#>    Parameter   Values   RSE_0   RSE
    -#>           CL     0.15       5     5
    -#>            V        8       3     3
    -#>           KA        1      14    14
    -#>         d_CL     0.07      30    28
    -#>          d_V     0.02      37    34
    -#>         d_KA      0.6      27    26
    -#>     sig_prop     0.01      32    23
    -#>      sig_add     0.25      26    30
    -#> 
    -#> Total running time: 0.182 seconds
    -
    -# minimize the cost function
    -out_3 <- poped_optim(poped.db,opt_a =TRUE,
    -                     ofv_fun=crit_fcn,
    -                     control = list(ARS=list(iter=2),
    -                                    BFGS=list(maxit=2),
    -                                    LS=list(line_length=2)),
    -                     iter_max = 2,
    -                     maximize = FALSE,
    -                     evaluate_fim = FALSE)
    -#> ===============================================================================
    -#> Initial design evaluation
    -#> 
    -#> Initial OFV = 0.939866
    -#> ==============================================================================
    -#> Optimization of design parameters
    -#> 
    -#> * Optimize Covariates
    -#> 
    -#> ************* Iteration 1  for all optimization methods***********************
    -#> 
    -#> *******************************************
    -#> Running Adaptive Random Search Optimization
    -#> *******************************************
    -#> Initial OFV = 0.939866
    -#> 
    -#> Total iterations: 2 
    -#> Elapsed time: 0.003 seconds.
    -#> 
    -#> Final OFV =  0.8123613 
    -#> Parameters: 60.50363 
    -#> 
    -#> *******************************************
    -#> Running BFGS Optimization
    -#> *******************************************
    -#> initial  value 0.812361 
    -#> final  value 0.706775 
    -#> stopped after 2 iterations
    -#> 
    -#> *******************************************
    -#> Running Line Search Optimization
    -#> *******************************************
    -#> 
    -#>    Initial parameters: 52.63973 
    -#>    Initial OFV: 0.7067753 
    -#> 
    -#>    Searching parameter 1 
    -#>      Changed from 52.6397 to 0.01 ; OFV = 0.000134267 
    -#> 
    -#>    Elapsed time: 0.005 seconds.
    -#> 
    -#>    Final OFV =  0.0001342665 
    -#>    Parameters: 0.01 
    -#> 
    -#> *******************************************
    -#> Stopping criteria testing
    -#> (Compare between start of iteration and end of iteration)
    -#> *******************************************
    -#> Difference in OFV:  -0.94
    -#> Relative difference in OFV:  -100%
    -#> Efficiency: 
    -#>   (ofv_final / ofv_init) = 0.00014286
    -#> 
    -#>  Efficiency stopping criteria: 
    -#>   Is (0.00014286 >= 0.999)?   No.
    -#>   Stopping criteria NOT achieved.
    -#> 
    -#> Stopping criteria NOT achieved.
    -#> 
    -#> ************* Iteration 2  for all optimization methods***********************
    -#> 
    -#> *******************************************
    -#> Running Adaptive Random Search Optimization
    -#> *******************************************
    -#> Initial OFV = 0.000134267
    -#> 
    -#> Total iterations: 2 
    -#> Elapsed time: 0.003 seconds.
    -#> 
    -#> Final OFV =  0.0001342665 
    -#> Parameters: 0.01 
    -#> 
    -#> *******************************************
    -#> Running BFGS Optimization
    -#> *******************************************
    -#> initial  value 0.000134 
    -#> final  value 0.000134 
    -#> converged
    -#> 
    -#> *******************************************
    -#> Running Line Search Optimization
    -#> *******************************************
    -#> 
    -#>    Initial parameters: 0.01000001 
    -#>    Initial OFV: 0.0001342667 
    -#> 
    -#>    Searching parameter 1 
    -#>      Changed from 0.01 to 0.01 ; OFV = 0.000134267 
    -#> 
    -#>    Elapsed time: 0.004 seconds.
    -#> 
    -#>    Final OFV =  0.0001342665 
    -#>    Parameters: 0.01 
    -#> 
    -#> *******************************************
    -#> Stopping criteria testing
    -#> (Compare between start of iteration and end of iteration)
    -#> *******************************************
    -#> Difference in OFV:  0
    -#> Relative difference in OFV:  0%
    -#> Efficiency: 
    -#>   (ofv_final / ofv_init) = 1
    -#> 
    -#>  Efficiency stopping criteria: 
    -#>   Is (1 >= 0.999)?   Yes.
    -#>   Stopping criteria achieved.
    -#> 
    -#> Stopping criteria achieved.
    -#> 
    -#> ===============================================================================
    -#> FINAL RESULTS
    -#> 
    -#> Optimized Covariates:
    -#> Group 1: 0.01
    -#> 
    -#> OFV = 0.000134267
    -#> 
    -#> Efficiency: 
    -#>   (ofv_final / ofv_init) = 0.00014286
    -#> 
    -#> Total running time: 0.188 seconds
    -
    -
    -if (FALSE) {
    -  
    -  # RS+BFGS+LS optimization of sample times 
    -  # (longer run time than above but more likely to reach a maximum)
    -  output <- poped_optim(poped.db,opt_xt=T,parallel = TRUE)
    -  
    -  get_rse(output$FIM,output$poped.db)
    -  plot_model_prediction(output$poped.db)
    -  
    -  # optimization with only integer times allowed
    -  poped.db.2 <- poped.db
    -  poped.db.2$design_space$xt_space <- matrix(list(seq(1,120)),1,8)
    -  output_2 <- poped_optim(poped.db.2,opt_xt=T,parallel = TRUE)
    -
    -  get_rse(output_2$FIM,output_2$poped.db)
    -  plot_model_prediction(output_2$poped.db)
    -  
    -  # Examine efficiency of sampling windows
    -  plot_efficiency_of_windows(output_2$poped.db,xt_windows=0.5)
    -  plot_efficiency_of_windows(output_2$poped.db,xt_windows=1)
    -  
    -  # Adaptive Random Search (ARS, just a few samples here)
    -  rs.output <- poped_optim(poped.db,opt_xt=T,method = "ARS",
    -                           control = list(ARS=list(iter=5)))
    -  
    -  get_rse(rs.output$FIM,rs.output$poped.db)
    -  
    -  # line search, DOSE and sample time optimization
    -  ls.output <- poped_optim(poped.db,opt_xt=T,opt_a=T,method = "LS",
    -                           control = list(LS=list(line_length=5)))
    -  
    -  # Adaptive random search, 
    -  # DOSE and sample time optimization
    -  ars.output <- poped_optim(poped.db,opt_xt=T,opt_a=T,method = "ARS",
    -                           control = list(ARS=list(iter=5)))
    -  
    -  # BFGS gradient search from the stats::optim() function, 
    -  # DOSE and sample time optimization
    -  bfgs.output <- poped_optim(poped.db,opt_xt=T,opt_a=T,method = "BFGS",
    -                            control = list(BFGS=list(maxit=5)))
    -  
    -  
    -  # genetic algorithm from the GA::ga() function, 
    -  # DOSE and sample time optimization
    -  ga.output <- poped_optim(poped.db,opt_xt=T,opt_a=F,method = "GA",parallel=T)
    -  
    -  # cost function with GA
    -  # maximize
    -  out_2 <- poped_optim(poped.db,opt_a =TRUE,
    -                       ofv_fun=crit_fcn,
    -                       parallel = T,
    -                       method=c("GA"))
    -  
    -  # cost function with GA
    -  # minimize
    -  out_2 <- poped_optim(poped.db,opt_a =TRUE,
    -                       ofv_fun=crit_fcn,
    -                       parallel = T,
    -                       method=c("GA"),
    -                       iter_max = 1,
    -                       maximize = F,
    -                       evaluate_fim = F)
    -  
    -  # optimize distribution of individuals in 3 groups
    -  poped_db_2 <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                    fg_fun=sfg,
    -                                    fError_fun=feps.add.prop,
    -                                    bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                    notfixed_bpop=c(1,1,1,0),
    -                                    d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                    sigma=c(prop=0.01,add=0.25),
    -                                    groupsize=32,
    -                                    m=3,
    -                                    xt=list(c( 0.5,1,2,6,8),c(36,72,120),
    -                                            c(10,12,14,16,18,20,22,24)),
    -                                    minxt=0.01,
    -                                    maxxt=120,
    -                                    a=c(DOSE=70),
    -                                    mina=c(DOSE=0.01),
    -                                    maxa=c(DOSE=100))
    -  
    -  opt_xt_inds <- 
    -    poped_optim(poped_db_2,
    -                opt_a =TRUE,
    -                opt_inds = TRUE,
    -                control = list(ARS=list(iter=2),
    -                               BFGS=list(maxit=2),
    -                               LS=list(line_length=2)),
    -                iter_max = 1)
    -  
    -  
    -  
    -  ##############
    -  # E-family Optimization
    -  ##############
    -  
    -  # Adding 10% log-normal Uncertainty to fixed effects (not Favail)
    -  bpop_vals <- c(CL=0.15, V=8, KA=1.0, Favail=1)
    -  bpop_vals_ed_ln <- cbind(ones(length(bpop_vals),1)*4, # log-normal distribution
    -                           bpop_vals,
    -                           ones(length(bpop_vals),1)*(bpop_vals*0.1)^2) # 10% of bpop value
    -  bpop_vals_ed_ln["Favail",]  <- c(0,1,0)
    -  bpop_vals_ed_ln
    -  
    -  ## -- Define initial design  and design space
    -  poped.db <- create.poped.database(ff_file="ff.PK.1.comp.oral.sd.CL",
    -                                    fg_file="sfg",
    -                                    fError_file="feps.add.prop",
    -                                    bpop=bpop_vals_ed_ln, 
    -                                    notfixed_bpop=c(1,1,1,0),
    -                                    d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                    sigma=c(0.01,0.25),
    -                                    groupsize=32,
    -                                    xt=c( 0.5,1,2,6,24,36,72,120),
    -                                    minxt=0,
    -                                    maxxt=120,
    -                                    a=70,
    -                                    mina=0,
    -                                    maxa=100)
    -  
    -  
    -  # E_ln(D) optimization using Random search (just a few samples here)
    -  output <- poped_optim(poped.db,opt_xt=TRUE,opt_a=TRUE,d_switch=0,
    -                        method = c("ARS","LS"),
    -                        control = list(ARS=list(iter=2),
    -                                       LS=list(line_length=2)),
    -                        iter_max = 1)
    -  get_rse(output$FIM,output$poped.db)
    -  
    -  # ED with laplace approximation, 
    -  # optimization using Random search (just a few iterations here)
    -  ars.output <- poped_optim(poped.db,opt_xt=T,opt_a=T,method = "ARS",
    -                            d_switch=0,use_laplace=TRUE,#laplace.fim=TRUE,
    -                            parallel=T,
    -                            control = list(ARS=list(iter=5)))
    -  
    -}
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/poped_optim_1.html b/docs/reference/poped_optim_1.html deleted file mode 100644 index 84230246..00000000 --- a/docs/reference/poped_optim_1.html +++ /dev/null @@ -1,358 +0,0 @@ - -Optimization main module for PopED - -Optimize the objective function. The function works for both discrete and -continuous optimization variables. If more than one optimization method is -specified then the methods are run in series. If loop_methods=TRUE -then the series of optimization methods will be run for iter_max -iterations, or until the efficiency of the design after the current series -(compared to the start of the series) is less than stop_crit_eff. — poped_optim_1 • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This function takes information from the PopED database supplied as an -argument. The PopED database supplies information about the the model, -parameters, design and methods to use. Some of the arguments coming from the -PopED database can be overwritten; if they are supplied then they are used -instead of the arguments from the PopED database.

    -
    - -
    -
    poped_optim_1(
    -  poped.db,
    -  opt_xt = poped.db$settings$optsw[2],
    -  opt_a = poped.db$settings$optsw[4],
    -  opt_x = poped.db$settings$optsw[3],
    -  opt_samps = poped.db$settings$optsw[1],
    -  opt_inds = poped.db$settings$optsw[5],
    -  method = c("ARS", "BFGS", "LS"),
    -  control = list(),
    -  trace = TRUE,
    -  fim.calc.type = poped.db$settings$iFIMCalculationType,
    -  ofv_calc_type = poped.db$settings$ofv_calc_type,
    -  approx_type = poped.db$settings$iApproximationMethod,
    -  d_switch = poped.db$settings$d_switch,
    -  ED_samp_size = poped.db$settings$ED_samp_size,
    -  bLHS = poped.db$settings$bLHS,
    -  use_laplace = poped.db$settings$iEDCalculationType,
    -  out_file = "",
    -  parallel = F,
    -  parallel_type = NULL,
    -  num_cores = NULL,
    -  loop_methods = ifelse(length(method) > 1, TRUE, FALSE),
    -  iter_max = 10,
    -  stop_crit_eff = 1.001,
    -  stop_crit_diff = NULL,
    -  stop_crit_rel = NULL,
    -  ofv_fun = poped.db$settings$ofv_fun,
    -  maximize = T,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    opt_xt
    -

    Should the sample times be optimized?

    - - -
    opt_a
    -

    Should the continuous design variables be optimized?

    - - -
    opt_x
    -

    Should the discrete design variables be optimized?

    - - -
    opt_samps
    -

    Are the number of sample times per group being optimized?

    - - -
    opt_inds
    -

    Are the number of individuals per group being optimized?

    - - -
    method
    -

    A vector of optimization methods to use in a sequential -fashion. Options are c("ARS","BFGS","LS","GA"). c("ARS") is -for Adaptive Random Search optim_ARS. c("LS") is for -Line Search optim_LS. c("BFGS") is for Method -"L-BFGS-B" from optim. c("GA") is for the -genetic algorithm from ga.

    - - -
    control
    -

    Contains control arguments for each method specified.

    - - -
    trace
    -

    Should the algorithm output results intermittently.

    - - -
    fim.calc.type
    -

    The method used for calculating the FIM. Potential values:

    • 0 = Full FIM. No assumption that fixed and random effects are uncorrelated.

    • -
    • 1 = Reduced FIM. Assume that there is no correlation in the FIM between the fixed and random effects, and set these elements in -the FIM to zero.

    • -
    • 2 = weighted models (placeholder).

    • -
    • 3 = Not currently used.

    • -
    • 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). -This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the residual unexplained variation by default).

    • -
    • 5 = Full FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    • 6 = Calculate one model switch at a time, good for large matrices.

    • -
    • 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    - - -
    ofv_calc_type
    -

    OFV calculation type for FIM

    • 1 = "D-optimality". Determinant of the FIM: det(FIM)

    • -
    • 2 = "A-optimality". Inverse of the sum of the expected parameter variances: -1/trace_matrix(inv(FIM))

    • -
    • 4 = "lnD-optimality". Natural logarithm of the determinant of the FIM: log(det(FIM))

    • -
    • 6 = "Ds-optimality". Ratio of the Determinant of the FIM and the Determinant of the uninteresting -rows and columns of the FIM: det(FIM)/det(FIM_u)

    • -
    • 7 = Inverse of the sum of the expected parameter RSE: 1/sum(get_rse(FIM,poped.db,use_percent=FALSE))

    • -
    - - -
    approx_type
    -

    Approximation method for model, 0=FO, 1=FOCE, 2=FOCEI, 3=FOI.

    - - -
    d_switch
    -
    • ******START OF CRITERION SPECIFICATION OPTIONS**********

    • -

    D-family design (1) or ED-family design (0) (with or without parameter uncertainty)

    - - -
    ED_samp_size
    -

    Sample size for E-family sampling

    - - -
    bLHS
    -

    How to sample from distributions in E-family calculations. 0=Random Sampling, 1=LatinHyperCube --

    - - -
    use_laplace
    -

    Should the Laplace method be used in calculating the expectation of the OFV?

    - - -
    out_file
    -

    Save output from the optimization to a file.

    - - -
    parallel
    -

    Should we use parallel computations?

    - - -
    parallel_type
    -

    Which type of parallelization should be used? -Can be "snow" or "multicore". "snow" works on Linux-like systems & Windows. "multicore" works only on -Linux-like systems. By default this is chosen for you depending on your operating system. -See start_parallel.

    - - -
    num_cores
    -

    The number of cores to use in the parallelization. By default is set to the number - output from -parallel::detectCores(). -See start_parallel.

    - - -
    loop_methods
    -

    Should the optimization methods be looped for -iter_max iterations, or until the efficiency of the design after the -current series (compared to the start of the series) is less than, or equal to, -stop_crit_eff?

    - - -
    iter_max
    -

    If line search is used then the algorithm tests if line -search (always run at the end of the optimization iteration) changes the -design in any way. If not, the algorithm stops. If yes, then a new -iteration is run unless iter_max iterations have already been run.

    - - -
    stop_crit_eff
    -

    If loop_methods==TRUE, the looping will stop if the -efficiency of the design after the current series (compared to the start of -the series) is less than, or equal to, stop_crit_eff (if maximize==FALSE then 1/stop_crit_eff is the cut -off and the efficiency must be greater than or equal to this value to stop the looping).

    - - -
    stop_crit_diff
    -

    If loop_methods==TRUE, the looping will stop if the -difference in criterion value of the design after the current series (compared to the start of -the series) is less than, or equal to, stop_crit_diff (if maximize==FALSE then -stop_crit_diff is the cut -off and the difference in criterion value must be greater than or equal to this value to stop the looping).

    - - -
    stop_crit_rel
    -

    If loop_methods==TRUE, the looping will stop if the -relative difference in criterion value of the design after the current series (compared to the start of -the series) is less than, or equal to, stop_crit_rel (if maximize==FALSE then -stop_crit_rel is the cut -off and the relative difference in criterion value must be greater than or equal to this value to stop the looping).

    - - -
    ofv_fun
    -

    User defined function used to compute the objective function. The function must have a poped database object as its first -argument and have "..." in its argument list. Can be referenced as a function or as a file name where the function defined in the file has the same name as the file. -e.g. "cost.txt" has a function named "cost" in it.

    - - -
    maximize
    -

    Should the objective function be maximized or minimized?

    - - -
    ...
    -

    arguments passed to other functions.

    - -
    -
    -

    References

    - -
    1. M. Foracchia, A.C. Hooker, P. Vicini and A. - Ruggeri, "PopED, a software fir optimal experimental design in population - kinetics", Computer Methods and Programs in Biomedicine, 74, 2004.

    2. -
    3. J. - Nyberg, S. Ueckert, E.A. Stroemberg, S. Hennig, M.O. Karlsson and A.C. - Hooker, "PopED: An extended, parallelized, nonlinear mixed effects models - optimal design tool", Computer Methods and Programs in Biomedicine, 108, - 2012.

    4. -
    -
    -

    See also

    - -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/poped_optim_2.html b/docs/reference/poped_optim_2.html deleted file mode 100644 index 1d33facf..00000000 --- a/docs/reference/poped_optim_2.html +++ /dev/null @@ -1,352 +0,0 @@ - -Optimization main module for PopED — poped_optim_2 • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Optimize the objective function. The function works for both discrete and -continuous optimization variables. If more than one optimization method is -specified then the methods are run in series. If loop_methods=TRUE -then the series of optimization methods will be run for iter_max -iterations, or until the efficiency of the design after the current series -(compared to the start of the series) is less than stop_crit_eff.

    -
    - -
    -
    poped_optim_2(
    -  poped.db,
    -  opt_xt = poped.db$settings$optsw[2],
    -  opt_a = poped.db$settings$optsw[4],
    -  opt_x = poped.db$settings$optsw[3],
    -  opt_samps = poped.db$settings$optsw[1],
    -  opt_inds = poped.db$settings$optsw[5],
    -  method = c("ARS", "BFGS", "LS"),
    -  control = list(),
    -  trace = TRUE,
    -  fim.calc.type = poped.db$settings$iFIMCalculationType,
    -  ofv_calc_type = poped.db$settings$ofv_calc_type,
    -  approx_type = poped.db$settings$iApproximationMethod,
    -  d_switch = poped.db$settings$d_switch,
    -  ED_samp_size = poped.db$settings$ED_samp_size,
    -  bLHS = poped.db$settings$bLHS,
    -  use_laplace = poped.db$settings$iEDCalculationType,
    -  out_file = "",
    -  parallel = F,
    -  parallel_type = NULL,
    -  num_cores = NULL,
    -  loop_methods = ifelse(length(method) > 1, TRUE, FALSE),
    -  iter_max = 10,
    -  stop_crit_eff = 1.001,
    -  stop_crit_diff = NULL,
    -  stop_crit_rel = NULL,
    -  ofv_fun = poped.db$settings$ofv_fun,
    -  maximize = T,
    -  transform_parameters = F,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    opt_xt
    -

    Should the sample times be optimized?

    - - -
    opt_a
    -

    Should the continuous design variables be optimized?

    - - -
    opt_x
    -

    Should the discrete design variables be optimized?

    - - -
    opt_samps
    -

    Are the number of sample times per group being optimized?

    - - -
    opt_inds
    -

    Are the number of individuals per group being optimized?

    - - -
    method
    -

    A vector of optimization methods to use in a sequential -fashion. Options are c("ARS","BFGS","LS","GA"). c("ARS") is -for Adaptive Random Search optim_ARS. c("LS") is for -Line Search optim_LS. c("BFGS") is for Method -"L-BFGS-B" from optim. c("GA") is for the -genetic algorithm from ga.

    - - -
    control
    -

    Contains control arguments for each method specified.

    - - -
    trace
    -

    Should the algorithm output results intermittently.

    - - -
    fim.calc.type
    -

    The method used for calculating the FIM. Potential values:

    • 0 = Full FIM. No assumption that fixed and random effects are uncorrelated.

    • -
    • 1 = Reduced FIM. Assume that there is no correlation in the FIM between the fixed and random effects, and set these elements in -the FIM to zero.

    • -
    • 2 = weighted models (placeholder).

    • -
    • 3 = Not currently used.

    • -
    • 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). -This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the residual unexplained variation by default).

    • -
    • 5 = Full FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    • 6 = Calculate one model switch at a time, good for large matrices.

    • -
    • 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    - - -
    ofv_calc_type
    -

    OFV calculation type for FIM

    • 1 = "D-optimality". Determinant of the FIM: det(FIM)

    • -
    • 2 = "A-optimality". Inverse of the sum of the expected parameter variances: -1/trace_matrix(inv(FIM))

    • -
    • 4 = "lnD-optimality". Natural logarithm of the determinant of the FIM: log(det(FIM))

    • -
    • 6 = "Ds-optimality". Ratio of the Determinant of the FIM and the Determinant of the uninteresting -rows and columns of the FIM: det(FIM)/det(FIM_u)

    • -
    • 7 = Inverse of the sum of the expected parameter RSE: 1/sum(get_rse(FIM,poped.db,use_percent=FALSE))

    • -
    - - -
    approx_type
    -

    Approximation method for model, 0=FO, 1=FOCE, 2=FOCEI, 3=FOI.

    - - -
    d_switch
    -
    • ******START OF CRITERION SPECIFICATION OPTIONS**********

    • -

    D-family design (1) or ED-family design (0) (with or without parameter uncertainty)

    - - -
    ED_samp_size
    -

    Sample size for E-family sampling

    - - -
    bLHS
    -

    How to sample from distributions in E-family calculations. 0=Random Sampling, 1=LatinHyperCube --

    - - -
    use_laplace
    -

    Should the Laplace method be used in calculating the expectation of the OFV?

    - - -
    out_file
    -

    Save output from the optimization to a file.

    - - -
    parallel
    -

    Should we use parallel computations?

    - - -
    parallel_type
    -

    Which type of parallelization should be used? -Can be "snow" or "multicore". "snow" works on Linux-like systems & Windows. "multicore" works only on -Linux-like systems. By default this is chosen for you depending on your operating system. -See start_parallel.

    - - -
    num_cores
    -

    The number of cores to use in the parallelization. By default is set to the number - output from -parallel::detectCores(). -See start_parallel.

    - - -
    loop_methods
    -

    Should the optimization methods be looped for -iter_max iterations, or until the efficiency of the design after the -current series (compared to the start of the series) is less than, or equal to, -stop_crit_eff?

    - - -
    iter_max
    -

    If line search is used then the algorithm tests if line -search (always run at the end of the optimization iteration) changes the -design in any way. If not, the algorithm stops. If yes, then a new -iteration is run unless iter_max iterations have already been run.

    - - -
    stop_crit_eff
    -

    If loop_methods==TRUE, the looping will stop if the -efficiency of the design after the current series (compared to the start of -the series) is less than, or equal to, stop_crit_eff (if maximize==FALSE then 1/stop_crit_eff is the cut -off and the efficiency must be greater than or equal to this value to stop the looping).

    - - -
    stop_crit_diff
    -

    If loop_methods==TRUE, the looping will stop if the -difference in criterion value of the design after the current series (compared to the start of -the series) is less than, or equal to, stop_crit_diff (if maximize==FALSE then -stop_crit_diff is the cut -off and the difference in criterion value must be greater than or equal to this value to stop the looping).

    - - -
    stop_crit_rel
    -

    If loop_methods==TRUE, the looping will stop if the -relative difference in criterion value of the design after the current series (compared to the start of -the series) is less than, or equal to, stop_crit_rel (if maximize==FALSE then -stop_crit_rel is the cut -off and the relative difference in criterion value must be greater than or equal to this value to stop the looping).

    - - -
    ofv_fun
    -

    User defined function used to compute the objective function. The function must have a poped database object as its first -argument and have "..." in its argument list. Can be referenced as a function or as a file name where the function defined in the file has the same name as the file. -e.g. "cost.txt" has a function named "cost" in it.

    - - -
    maximize
    -

    Should the objective function be maximized or minimized?

    - - -
    transform_parameters
    -

    Should we transform the parameters before optimization?

    - - -
    ...
    -

    arguments passed to other functions.

    - -
    -
    -

    Details

    -

    This function takes information from the PopED database supplied as an -argument. The PopED database supplies information about the the model, -parameters, design and methods to use. Some of the arguments coming from the -PopED database can be overwritten; if they are supplied then they are used -instead of the arguments from the PopED database.

    -
    -
    -

    References

    - -
    1. M. Foracchia, A.C. Hooker, P. Vicini and A. - Ruggeri, "PopED, a software fir optimal experimental design in population - kinetics", Computer Methods and Programs in Biomedicine, 74, 2004.

    2. -
    3. J. - Nyberg, S. Ueckert, E.A. Stroemberg, S. Hennig, M.O. Karlsson and A.C. - Hooker, "PopED: An extended, parallelized, nonlinear mixed effects models - optimal design tool", Computer Methods and Programs in Biomedicine, 108, - 2012.

    4. -
    -
    -

    See also

    - -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/poped_optim_3.html b/docs/reference/poped_optim_3.html deleted file mode 100644 index b08cad30..00000000 --- a/docs/reference/poped_optim_3.html +++ /dev/null @@ -1,363 +0,0 @@ - -Optimization main module for PopED — poped_optim_3 • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Optimize the objective function. The function works for both discrete and -continuous optimization variables. If more than one optimization method is -specified then the methods are run in series. If loop_methods=TRUE -then the series of optimization methods will be run for iter_max -iterations, or until the efficiency of the design after the current series -(compared to the start of the series) is less than stop_crit_eff.

    -
    - -
    -
    poped_optim_3(
    -  poped.db,
    -  opt_xt = poped.db$settings$optsw[2],
    -  opt_a = poped.db$settings$optsw[4],
    -  opt_x = poped.db$settings$optsw[3],
    -  opt_samps = poped.db$settings$optsw[1],
    -  opt_inds = poped.db$settings$optsw[5],
    -  method = c("ARS", "BFGS", "LS"),
    -  control = list(),
    -  trace = TRUE,
    -  fim.calc.type = poped.db$settings$iFIMCalculationType,
    -  ofv_calc_type = poped.db$settings$ofv_calc_type,
    -  ds_index = poped.db$parameters$ds_index,
    -  approx_type = poped.db$settings$iApproximationMethod,
    -  d_switch = poped.db$settings$d_switch,
    -  ED_samp_size = poped.db$settings$ED_samp_size,
    -  bLHS = poped.db$settings$bLHS,
    -  use_laplace = poped.db$settings$iEDCalculationType,
    -  out_file = "",
    -  parallel = F,
    -  parallel_type = NULL,
    -  num_cores = NULL,
    -  loop_methods = ifelse(length(method) > 1, TRUE, FALSE),
    -  iter_max = 10,
    -  stop_crit_eff = 1.001,
    -  stop_crit_diff = NULL,
    -  stop_crit_rel = NULL,
    -  ofv_fun = poped.db$settings$ofv_fun,
    -  maximize = T,
    -  allow_replicates = TRUE,
    -  allow_replicates_xt = TRUE,
    -  allow_replicates_a = TRUE,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    opt_xt
    -

    Should the sample times be optimized?

    - - -
    opt_a
    -

    Should the continuous design variables be optimized?

    - - -
    opt_x
    -

    Should the discrete design variables be optimized?

    - - -
    opt_samps
    -

    Are the number of sample times per group being optimized?

    - - -
    opt_inds
    -

    Are the number of individuals per group being optimized?

    - - -
    method
    -

    A vector of optimization methods to use in a sequential -fashion. Options are c("ARS","BFGS","LS","GA"). c("ARS") is -for Adaptive Random Search optim_ARS. c("LS") is for -Line Search optim_LS. c("BFGS") is for Method -"L-BFGS-B" from optim. c("GA") is for the -genetic algorithm from ga. If opt_inds=TRUE then -this optimization is always added to the end of the sequential optimization.

    - - -
    control
    -

    Contains control arguments specified for each method separately.

    - - -
    trace
    -

    Should the algorithm output results intermittently.

    - - -
    fim.calc.type
    -

    The method used for calculating the FIM. Potential values:

    • 0 = Full FIM. No assumption that fixed and random effects are uncorrelated.

    • -
    • 1 = Reduced FIM. Assume that there is no correlation in the FIM between the fixed and random effects, and set these elements in -the FIM to zero.

    • -
    • 2 = weighted models (placeholder).

    • -
    • 3 = Not currently used.

    • -
    • 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). -This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the residual unexplained variation by default).

    • -
    • 5 = Full FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    • 6 = Calculate one model switch at a time, good for large matrices.

    • -
    • 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    - - -
    ofv_calc_type
    -

    OFV calculation type for FIM

    • 1 = "D-optimality". Determinant of the FIM: det(FIM)

    • -
    • 2 = "A-optimality". Inverse of the sum of the expected parameter variances: -1/trace_matrix(inv(FIM))

    • -
    • 4 = "lnD-optimality". Natural logarithm of the determinant of the FIM: log(det(FIM))

    • -
    • 6 = "Ds-optimality". Ratio of the Determinant of the FIM and the Determinant of the uninteresting -rows and columns of the FIM: det(FIM)/det(FIM_u)

    • -
    • 7 = Inverse of the sum of the expected parameter RSE: 1/sum(get_rse(FIM,poped.db,use_percent=FALSE))

    • -
    - - -
    ds_index
    -

    Ds_index is a vector set to 1 if a parameter is uninteresting, otherwise 0. -size=(1,num unfixed parameters). First unfixed bpop, then unfixed d, then unfixed docc and last unfixed sigma. -Default is the fixed effects being important, everything else not important. Used in conjunction with -ofv_calc_type=6.

    - - -
    approx_type
    -

    Approximation method for model, 0=FO, 1=FOCE, 2=FOCEI, 3=FOI.

    - - -
    d_switch
    -
    • ******START OF CRITERION SPECIFICATION OPTIONS**********

    • -

    D-family design (1) or ED-family design (0) (with or without parameter uncertainty)

    - - -
    ED_samp_size
    -

    Sample size for E-family sampling

    - - -
    bLHS
    -

    How to sample from distributions in E-family calculations. 0=Random Sampling, 1=LatinHyperCube --

    - - -
    use_laplace
    -

    Should the Laplace method be used in calculating the expectation of the OFV?

    - - -
    out_file
    -

    Save output from the optimization to a file.

    - - -
    parallel
    -

    Should we use parallel computations?

    - - -
    parallel_type
    -

    Which type of parallelization should be used? -Can be "snow" or "multicore". "snow" works on Linux-like systems & Windows. "multicore" works only on -Linux-like systems. By default this is chosen for you depending on your operating system. -See start_parallel.

    - - -
    num_cores
    -

    The number of cores to use in the parallelization. By default is set to the number - output from -parallel::detectCores(). -See start_parallel.

    - - -
    loop_methods
    -

    Should the optimization methods be looped for -iter_max iterations, or until the efficiency of the design after the -current series (compared to the start of the series) is less than, or equal to, -stop_crit_eff?

    - - -
    iter_max
    -

    If line search is used then the algorithm tests if line -search (always run at the end of the optimization iteration) changes the -design in any way. If not, the algorithm stops. If yes, then a new -iteration is run unless iter_max iterations have already been run.

    - - -
    stop_crit_eff
    -

    If loop_methods==TRUE, the looping will stop if the -efficiency of the design after the current series (compared to the start of -the series) is less than, or equal to, stop_crit_eff (if maximize==FALSE then 1/stop_crit_eff is the cut -off and the efficiency must be greater than or equal to this value to stop the looping).

    - - -
    stop_crit_diff
    -

    If loop_methods==TRUE, the looping will stop if the -difference in criterion value of the design after the current series (compared to the start of -the series) is less than, or equal to, stop_crit_diff (if maximize==FALSE then -stop_crit_diff is the cut -off and the difference in criterion value must be greater than or equal to this value to stop the looping).

    - - -
    stop_crit_rel
    -

    If loop_methods==TRUE, the looping will stop if the -relative difference in criterion value of the design after the current series (compared to the start of -the series) is less than, or equal to, stop_crit_rel (if maximize==FALSE then -stop_crit_rel is the cut -off and the relative difference in criterion value must be greater than or equal to this value to stop the looping).

    - - -
    ofv_fun
    -

    User defined function used to compute the objective function. The function must have a poped database object as its first -argument and have "..." in its argument list. Can be referenced as a function or as a file name where the function defined in the file has the same name as the file. -e.g. "cost.txt" has a function named "cost" in it.

    - - -
    maximize
    -

    Should the objective function be maximized or minimized?

    - - -
    allow_replicates
    -

    Should the algorithm allow parameters to have the same value?

    - - -
    ...
    -

    arguments passed to other functions.

    - -
    -
    -

    Details

    -

    This function takes information from the PopED database supplied as an -argument. The PopED database supplies information about the the model, -parameters, design and methods to use. Some of the arguments coming from the -PopED database can be overwritten; if they are supplied then they are used -instead of the arguments from the PopED database.

    -
    -
    -

    References

    - -
    1. M. Foracchia, A.C. Hooker, P. Vicini and A. - Ruggeri, "PopED, a software fir optimal experimental design in population - kinetics", Computer Methods and Programs in Biomedicine, 74, 2004.

    2. -
    3. J. - Nyberg, S. Ueckert, E.A. Stroemberg, S. Hennig, M.O. Karlsson and A.C. - Hooker, "PopED: An extended, parallelized, nonlinear mixed effects models - optimal design tool", Computer Methods and Programs in Biomedicine, 108, - 2012.

    4. -
    -
    -

    See also

    - -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/poped_optimize.html b/docs/reference/poped_optimize.html deleted file mode 100644 index d10c7800..00000000 --- a/docs/reference/poped_optimize.html +++ /dev/null @@ -1,664 +0,0 @@ - -Retired optimization module for PopED — poped_optimize • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This function is an older version of poped_optim. Please use poped_optim -unless you have a specific reason to use this function instead.

    -
    - -
    -
    poped_optimize(
    -  poped.db,
    -  ni = NULL,
    -  xt = NULL,
    -  model_switch = NULL,
    -  x = NULL,
    -  a = NULL,
    -  bpop = NULL,
    -  d = NULL,
    -  maxxt = NULL,
    -  minxt = NULL,
    -  maxa = NULL,
    -  mina = NULL,
    -  fmf = 0,
    -  dmf = 0,
    -  trflag = TRUE,
    -  opt_xt = poped.db$settings$optsw[2],
    -  opt_a = poped.db$settings$optsw[4],
    -  opt_x = poped.db$settings$optsw[3],
    -  opt_samps = poped.db$settings$optsw[1],
    -  opt_inds = poped.db$settings$optsw[5],
    -  cfaxt = poped.db$settings$cfaxt,
    -  cfaa = poped.db$settings$cfaa,
    -  rsit = poped.db$settings$rsit,
    -  rsit_output = poped.db$settings$rsit_output,
    -  fim.calc.type = poped.db$settings$iFIMCalculationType,
    -  ofv_calc_type = poped.db$settings$ofv_calc_type,
    -  approx_type = poped.db$settings$iApproximationMethod,
    -  bUseExchangeAlgorithm = poped.db$settings$bUseExchangeAlgorithm,
    -  iter = 1,
    -  d_switch = poped.db$settings$d_switch,
    -  ED_samp_size = poped.db$settings$ED_samp_size,
    -  bLHS = poped.db$settings$bLHS,
    -  use_laplace = poped.db$settings$iEDCalculationType,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database.

    - - -
    ni
    -

    A vector of the number of samples in each group.

    - - -
    xt
    -

    A matrix of sample times. Each row is a vector of sample times for a group.

    - - -
    model_switch
    -

    A matrix that is the same size as xt, specifying which model each sample belongs to.

    - - -
    x
    -

    A matrix for the discrete design variables. Each row is a group.

    - - -
    a
    -

    A matrix of covariates. Each row is a group.

    - - -
    bpop
    -

    Matrix defining the fixed effects, per row (row number = parameter_number) we should have:

    • column 1 the type of the distribution for E-family designs (0 = Fixed, 1 = Normal, 2 = Uniform, - 3 = User Defined Distribution, 4 = lognormal and 5 = truncated normal)

    • -
    • column 2 defines the mean.

    • -
    • column 3 defines the variance of the distribution (or length of uniform distribution).

    • -

    Can also just supply the parameter values as a vector c() if no uncertainty around the -parameter value is to be used. The parameter order of 'bpop' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'bpop' then the order will be worked out automatically.

    - - -
    d
    -

    Matrix defining the diagonals of the IIV (same logic as for the fixed effects -matrix bpop to define uncertainty). One can also just supply the parameter values as a c(). -The parameter order of 'd' is defined in the 'fg_fun' or 'fg_file'. If you use named -arguments in 'd' then the order will be worked out automatically.

    - - -
    maxxt
    -

    Matrix or single value defining the maximum value for each xt sample. If a single value is -supplied then all xt values are given the same maximum value.

    - - -
    minxt
    -

    Matrix or single value defining the minimum value for each xt sample. If a single value is -supplied then all xt values are given the same minimum value

    - - -
    maxa
    -

    Vector defining the max value for each covariate. If a single value is supplied then -all a values are given the same max value

    - - -
    mina
    -

    Vector defining the min value for each covariate. If a single value is supplied then -all a values are given the same max value

    - - -
    fmf
    -

    The initial value of the FIM. If set to zero then it is computed.

    - - -
    dmf
    -

    The initial OFV. If set to zero then it is computed.

    - - -
    trflag
    -

    Should the optimization be output to the screen and to a file?

    - - -
    opt_xt
    -

    Should the sample times be optimized?

    - - -
    opt_a
    -

    Should the continuous design variables be optimized?

    - - -
    opt_x
    -

    Should the discrete design variables be optimized?

    - - -
    opt_samps
    -

    Are the number of sample times per group being optimized?

    - - -
    opt_inds
    -

    Are the number of individuals per group being optimized?

    - - -
    cfaxt
    -

    First step factor for sample times

    - - -
    cfaa
    -

    Stochastic Gradient search first step factor for covariates

    - - -
    rsit
    -

    Number of Random search iterations

    - - -
    rsit_output
    -

    Number of iterations in random search between screen output

    - - -
    fim.calc.type
    -

    The method used for calculating the FIM. Potential values:

    • 0 = Full FIM. No assumption that fixed and random effects are uncorrelated.

    • -
    • 1 = Reduced FIM. Assume that there is no correlation in the FIM between the fixed and random effects, and set these elements in -the FIM to zero.

    • -
    • 2 = weighted models (placeholder).

    • -
    • 3 = Not currently used.

    • -
    • 4 = Reduced FIM and computing all derivatives with respect to the standard deviation of the residual unexplained variation (sqrt(SIGMA) in NONMEM). -This matches what is done in PFIM, and assumes that the standard deviation of the residual unexplained variation is the estimated parameter -(NOTE: NONMEM estimates the variance of the residual unexplained variation by default).

    • -
    • 5 = Full FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    • 6 = Calculate one model switch at a time, good for large matrices.

    • -
    • 7 = Reduced FIM parameterized with A,B,C matrices & derivative of variance.

    • -
    - - -
    ofv_calc_type
    -

    OFV calculation type for FIM

    • 1 = "D-optimality". Determinant of the FIM: det(FIM)

    • -
    • 2 = "A-optimality". Inverse of the sum of the expected parameter variances: -1/trace_matrix(inv(FIM))

    • -
    • 4 = "lnD-optimality". Natural logarithm of the determinant of the FIM: log(det(FIM))

    • -
    • 6 = "Ds-optimality". Ratio of the Determinant of the FIM and the Determinant of the uninteresting -rows and columns of the FIM: det(FIM)/det(FIM_u)

    • -
    • 7 = Inverse of the sum of the expected parameter RSE: 1/sum(get_rse(FIM,poped.db,use_percent=FALSE))

    • -
    - - -
    approx_type
    -

    Approximation method for model, 0=FO, 1=FOCE, 2=FOCEI, 3=FOI.

    - - -
    bUseExchangeAlgorithm
    -

    Use Exchange algorithm (1=TRUE, 0=FALSE)

    - - -
    iter
    -

    The number of iterations entered into the blockheader_2 function.

    - - -
    d_switch
    -
    • ******START OF CRITERION SPECIFICATION OPTIONS**********

    • -

    D-family design (1) or ED-family design (0) (with or without parameter uncertainty)

    - - -
    ED_samp_size
    -

    Sample size for E-family sampling

    - - -
    bLHS
    -

    How to sample from distributions in E-family calculations. 0=Random Sampling, 1=LatinHyperCube --

    - - -
    use_laplace
    -

    Should the Laplace method be used in calculating the expectation of the OFV?

    - - -
    ...
    -

    arguments passed to other functions. See Doptim.

    - -
    -
    -

    Details

    -

    This function optimized the objective function. -The function works for both discrete and continuous optimization variables. -This function takes information from the PopED database supplied as an argument. -The PopED database supplies information about the the model, parameters, design and methods to use. -Some of the arguments coming from the PopED database can be overwritten; -if they are supplied then they are used instead of the arguments from the PopED database.

    -
    -
    -

    References

    - -
    1. M. Foracchia, A.C. Hooker, P. Vicini and A. Ruggeri, "PopED, a software fir optimal -experimental design in population kinetics", Computer Methods and Programs in Biomedicine, 74, 2004.

    2. -
    3. J. Nyberg, S. Ueckert, E.A. Stroemberg, S. Hennig, M.O. Karlsson and A.C. Hooker, "PopED: An extended, -parallelized, nonlinear mixed effects models optimal design tool", -Computer Methods and Programs in Biomedicine, 108, 2012.

    4. -
    -
    -

    See also

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -
    -##############
    -# D-family Optimization
    -##############
    -
    -# below are a number of ways to optimize the problem
    -
    -# RS+SG+LS optimization of DOSE and sample times
    -# optimization with just a few iterations
    -# only to check that things are working
    -out_1 <- poped_optimize(poped.db,opt_a=TRUE,opt_xt=TRUE,
    -                         rsit=2,sgit=2,ls_step_size=2, 
    -                         iter_max=1,out_file = "")
    -#> ===============================================================================
    -#> Initial design evaluation
    -#> 
    -#> Initial OFV = 55.3964
    -#> 
    -#> Initial design
    -#> expected relative standard error
    -#> (%RSE, rounded to nearest integer)
    -#>    Parameter   Values   RSE_0
    -#>           CL     0.15       5
    -#>            V        8       3
    -#>           KA        1      14
    -#>         d_CL     0.07      30
    -#>          d_V     0.02      37
    -#>         d_KA      0.6      27
    -#>     sig_prop     0.01      32
    -#>      sig_add     0.25      26
    -#> 
    -#> ==============================================================================
    -#> Optimization of design parameters
    -#> 
    -#> * Optimize Sampling Schedule
    -#> * Optimize Covariates
    -#> 
    -#> *******************************
    -#> Initial Value
    -#>  OFV(mf) = 55.3964
    -#> *******************************
    -#> 
    -#> RS - It. : 2   OFV : 55.3964
    -#> 
    -#> *******************************
    -#> RS Results
    -#>  OFV(mf) = 55.3964
    -#> 
    -#> Optimized Sampling Schedule
    -#> Group 1:    0.5      1      2      6     24     36     72    120
    -#> 
    -#> Optimized Covariates:
    -#> Group 1: 70
    -#> 
    -#> *********************************
    -#> 
    -#> Run time for random search: 0.012 seconds
    -#> 
    -#> SG - It. : 1  OFV : 55.45   Diff. :     1
    -#> SG - It. : 2  OFV : 55.61   Diff. : 0.002799
    -#> 
    -#> SG - Iteration 2 --------- FINAL -------------------------
    -#> Normalized gradient: Grad_xt(OFV)/OFV
    -#> -0.00262405731976996
    -#>  -0.000132025613933461
    -#>  0.00495628830027523
    -#>  -0.000109893298136573
    -#>  -0.000341253151812552
    -#>  2.72645778558773e-05
    -#>  0.000160461624573026
    -#>  3.06020413801048e-05
    -#> xt opt:
    -#> 0.210318514650852
    -#>  0.950298514650852
    -#>  2.28968148534915
    -#>  5.71031851465085
    -#>  23.7103185146509
    -#>  36.2896814853491
    -#>  72.2896814853491
    -#>  120
    -#> Normalized gradient: Grad_a(OFV)/OFV
    -#> 6.312896e-04
    -#> aopt:
    -#> 7.024140e+01
    -#> OFV(mf)    : 55.6095
    -#> diff       : 0.00279928
    -#> *************************************************************
    -#> Stochastic gradient run time: 0.189 seconds
    -#> 
    -#> *****************************
    -#>             Line Search
    -#> 
    -#> Searching xt8 on group 1
    -#> Searching xt3 on group 1
    -#> Searching xt6 on group 1
    -#> group 1 -- xt[6] changed from  36.2897 to  0.01
    -#>      OFV(MF) changed from 55.6095 to 55.7789 
    -#> group 1 -- xt[6] changed from  0.01 to  120
    -#>      OFV(MF) changed from 55.7789 to 55.8761 
    -#> Searching xt4 on group 1
    -#> Searching xt5 on group 1
    -#> Searching xt1 on group 1
    -#> group 1 -- xt[1] changed from  0.210319 to  0.01
    -#>      OFV(MF) changed from 55.8761 to 55.9642 
    -#> group 1 -- xt[1] changed from  0.01 to  120
    -#>      OFV(MF) changed from 55.9642 to 56.0271 
    -#> Searching xt7 on group 1
    -#> group 1 -- xt[7] changed from  72.2897 to  120
    -#>      OFV(MF) changed from 56.0271 to 56.0561 
    -#> Searching xt2 on group 1
    -#>     OFV(MF): 56.0561
    -#> 
    -#> Best value for OFV(MF) = 56.0561
    -#> 
    -#> Best value for xt:
    -#> Group 1: 0.9503   2.29   5.71  23.71    120    120    120    120
    -#> 
    -#> Searching a1 on individual/group 1
    -#> group 1 -- a[1] changed from  70.2414 to  100
    -#>      OFV(MF) changed from 56.0561 to 56.8149 
    -#>     OFV(MF): 56.8149
    -#> Best value for OFV(MF) = 56.8149
    -#> 
    -#> Best value for a: 
    -#> Group 1: 100 [0.01,100]
    -#> 
    -#> 
    -#> Line search run time: 0.108 seconds
    -#> ***************************
    -#> 
    -#> ===============================================================================
    -#> FINAL RESULTS
    -#> Optimized Sampling Schedule
    -#> Group 1: 0.9503   2.29   5.71  23.71    120    120    120    120
    -#> 
    -#> Optimized Covariates:
    -#> Group 1: 100
    -#> 
    -#> OFV = 56.8149
    -#> 
    -#> Efficiency: 
    -#>   ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.194
    -#> 
    -#> Expected relative standard error
    -#> (%RSE, rounded to nearest integer):
    -#>    Parameter   Values   RSE_0   RSE
    -#>           CL     0.15       5     5
    -#>            V        8       3     3
    -#>           KA        1      14    14
    -#>         d_CL     0.07       0     0
    -#>          d_V     0.02      37    34
    -#>         d_KA      0.6       0     0
    -#>     sig_prop     0.01      32    24
    -#>      sig_add     0.25      26    16
    -#> 
    -#> Total running time: 0.31 seconds
    -
    -if (FALSE) {
    -  
    -  # RS+SG+LS optimization of sample times 
    -  # (longer run time than above but more likely to reach a maximum)
    -  output <- poped_optimize(poped.db,opt_xt=T)
    -  get_rse(output$fmf,output$poped.db)
    -  plot_model_prediction(output$poped.db)
    -  
    -  # MFEA optimization with only integer times allowed
    -  mfea.output <- poped_optimize(poped.db,opt_xt=1,
    -                                bUseExchangeAlgorithm=1,
    -                                EAStepSize=1)
    -  get_rse(mfea.output$fmf,mfea.output$poped.db)
    -  plot_model_prediction(mfea.output$poped.db)
    -  
    -  # Examine efficiency of sampling windows
    -  plot_efficiency_of_windows(mfea.output$poped.db,xt_windows=0.5)
    -  plot_efficiency_of_windows(mfea.output$poped.db,xt_windows=1)
    -  
    -  # Random search (just a few samples here)
    -  rs.output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,rsit=20,
    -                              bUseRandomSearch= 1,
    -                              bUseStochasticGradient = 0,
    -                              bUseBFGSMinimizer = 0,
    -                              bUseLineSearch = 0)
    -  get_rse(rs.output$fmf,rs.output$poped.db)
    -  
    -  # line search, DOSE and sample time optimization
    -  ls.output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,
    -                              bUseRandomSearch= 0,
    -                              bUseStochasticGradient = 0,
    -                              bUseBFGSMinimizer = 0,
    -                              bUseLineSearch = 1,
    -                              ls_step_size=10)
    -  
    -  # Stochastic gradient search, DOSE and sample time optimization
    -  sg.output <- poped_optimize(poped.db,opt_xt=1,opt_a=1, 
    -                              bUseRandomSearch= 0,
    -                              bUseStochasticGradient = 1,
    -                              bUseBFGSMinimizer = 0,
    -                              bUseLineSearch = 0,
    -                              sgit=20)
    -  
    -  # BFGS search, DOSE and sample time optimization
    -  bfgs.output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,
    -                                bUseRandomSearch= 0,
    -                                bUseStochasticGradient = 0,
    -                                bUseBFGSMinimizer = 1,
    -                                bUseLineSearch = 0)
    -  
    -  ##############
    -  # E-family Optimization
    -  ##############
    -  
    -  # Adding 10% log-normal Uncertainty to fixed effects (not Favail)
    -  bpop_vals <- c(CL=0.15, V=8, KA=1.0, Favail=1)
    -  bpop_vals_ed_ln <- cbind(ones(length(bpop_vals),1)*4, # log-normal distribution
    -                           bpop_vals,
    -                           ones(length(bpop_vals),1)*(bpop_vals*0.1)^2) # 10% of bpop value
    -  bpop_vals_ed_ln["Favail",]  <- c(0,1,0)
    -  bpop_vals_ed_ln
    -  
    -  ## -- Define initial design  and design space
    -  poped.db <- create.poped.database(ff_file="ff.PK.1.comp.oral.sd.CL",
    -                                    fg_file="sfg",
    -                                    fError_file="feps.add.prop",
    -                                    bpop=bpop_vals_ed_ln, 
    -                                    notfixed_bpop=c(1,1,1,0),
    -                                    d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                    sigma=c(0.01,0.25),
    -                                    groupsize=32,
    -                                    xt=c( 0.5,1,2,6,24,36,72,120),
    -                                    minxt=0,
    -                                    maxxt=120,
    -                                    a=70,
    -                                    mina=0,
    -                                    maxa=100)
    -  
    -  # ED optimization using Random search (just a few samples here)
    -  output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,rsit=10,d_switch=0)
    -  get_rse(output$fmf,output$poped.db)
    -  
    -  # ED with laplace approximation, 
    -  # optimization using Random search (just a few samples here)
    -  output <- poped_optimize(poped.db,opt_xt=1,opt_a=1,rsit=10,
    -                           d_switch=0,use_laplace=TRUE,laplace.fim=TRUE)
    -  get_rse(output$fmf,output$poped.db)
    -  
    -  
    -}
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/rand.html b/docs/reference/rand.html deleted file mode 100644 index 18b2ae58..00000000 --- a/docs/reference/rand.html +++ /dev/null @@ -1,157 +0,0 @@ - -Function written to match MATLAB's rand function — rand • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Generate random samples from a uniform distribution [0,1] and return in matrix form

    -
    - -
    -
    rand(dim1, dim2 = NULL)
    -
    - -
    -

    Arguments

    -
    dim1
    -

    The dimension of the matrix (if square), otherwise the number of rows.

    - - -
    dim2
    -

    The number of columns, if different from the number of rows.

    - -
    -
    -

    Value

    - - -

    Matrix of random generated samples.

    -
    -
    -

    See also

    -

    Other MATLAB: -cell(), -diag_matlab(), -feval(), -fileparts(), -isempty(), -ones(), -randn(), -size(), -tic(), -toc(), -zeros()

    -
    - -
    -

    Examples

    -
    
    -rand(2,3)
    -#>           [,1]      [,2]      [,3]
    -#> [1,] 0.8447178 0.2868302 0.2885822
    -#> [2,] 0.8602158 0.6164877 0.9087107
    -
    -rand(5)
    -#>           [,1]      [,2]       [,3]      [,4]      [,5]
    -#> [1,] 0.9049117 0.5940931 0.24494388 0.5344482 0.1869131
    -#> [2,] 0.1723104 0.3337554 0.24043885 0.2955405 0.9123031
    -#> [3,] 0.7052867 0.3833964 0.07207165 0.5733157 0.2817364
    -#> [4,] 0.2017357 0.4239477 0.63541968 0.8786657 0.1743530
    -#> [5,] 0.8945690 0.6280580 0.82835438 0.2438678 0.1254093
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/randn.html b/docs/reference/randn.html deleted file mode 100644 index 8b738e9a..00000000 --- a/docs/reference/randn.html +++ /dev/null @@ -1,157 +0,0 @@ - -Function written to match MATLAB's randn function — randn • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Generate random samples from a standardized normal distribution and return in matrix form.

    -
    - -
    -
    randn(dim1, dim2 = NULL)
    -
    - -
    -

    Arguments

    -
    dim1
    -

    The dimension of the matrix (if square), otherwise the number of rows.

    - - -
    dim2
    -

    The number of columns, if different from the number of rows.

    - -
    -
    -

    Value

    - - -

    Matrix of random generated samples.

    -
    -
    -

    See also

    -

    Other MATLAB: -cell(), -diag_matlab(), -feval(), -fileparts(), -isempty(), -ones(), -rand(), -size(), -tic(), -toc(), -zeros()

    -
    - -
    -

    Examples

    -
    
    -randn(2,3)
    -#>           [,1]       [,2]       [,3]
    -#> [1,] 0.1815624 -0.1510503 -1.9365325
    -#> [2,] 0.7038866 -0.8166760  0.2953898
    -
    -randn(5)
    -#>            [,1]       [,2]       [,3]        [,4]       [,5]
    -#> [1,]  0.3087733 -0.7993793  1.0554095 -0.84689349  1.3576308
    -#> [2,] -0.2202427  2.0292053  0.2182924 -0.04316951 -0.3313580
    -#> [3,]  1.0525170  1.0148143 -0.1949883  0.14934471  1.1190877
    -#> [4,] -1.1703753  0.1793560  1.3504137 -0.19473851 -0.7110720
    -#> [5,]  1.9194861  0.2573688 -0.6135336 -0.92924791  0.6451075
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/randperm.html b/docs/reference/randperm.html deleted file mode 100644 index c7234836..00000000 --- a/docs/reference/randperm.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - -Function written to match MATLAB's randperm function — randperm • PopED - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    A wrapper for the sample function.

    - -
    - -
    randperm(num)
    - -

    Arguments

    - - - - - - -
    num

    Either a vector of one or more elements from which to choose, or a positive integer.

    - -

    Value

    - -

    See sample

    - -

    See also

    - -

    Other MATLAB: cell, - diag_matlab, feval, - fileparts, isempty, - ones, randn, - rand, size, - tic, toc, zeros

    - - -

    Examples

    -
    -randperm(c(2,3,4,5,6))
    #> [1] 3 2 6 5 4
    -randperm(10)
    #> [1] 2 5 9 8 3 10 1 7 4 6
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - - - - diff --git a/docs/reference/shrinkage.html b/docs/reference/shrinkage.html deleted file mode 100644 index 0363feb5..00000000 --- a/docs/reference/shrinkage.html +++ /dev/null @@ -1,220 +0,0 @@ - -Predict shrinkage of empirical Bayes estimates (EBEs) in a population model — shrinkage • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Predict shrinkage of empirical Bayes estimates (EBEs) in a population model

    -
    - -
    -
    shrinkage(poped.db, use_mc = FALSE, num_sim_ids = 1000, use_purrr = FALSE)
    -
    - -
    -

    Arguments

    -
    poped.db
    -

    A PopED database

    - - -
    use_mc
    -

    Should the calculation be based on monte-carlo simulations. If -not then then a first order approximation is used

    - - -
    num_sim_ids
    -

    If use_mc=TRUE, how many individuals should be -simulated to make the computations.

    - - -
    use_purrr
    -

    If use_mc=TRUE then should the method use the package -purrr in calculations? This may speed up computations (potentially).

    - -
    -
    -

    Value

    - - -

    The shrinkage computed in variance units, standard deviation units - and the relative standard errors of the EBEs.

    -
    -
    -

    References

    - -
    1. Combes, F. P., Retout, S., - Frey, N., & Mentre, F. (2013). Prediction of shrinkage of individual - parameters using the Bayesian information matrix in non-linear mixed effect - models with evaluation in pharmacokinetics. Pharmaceutical Research, 30(9), - 2355-67. doi:10.1007/s11095-013-1079-3 -.

    2. -
    3. Hennig, S., Nyberg, J., Fanta, S., Backman, J. - T., Hoppu, K., Hooker, A. C., & Karlsson, M. O. (2012). Application of the - optimal design approach to improve a pretransplant drug dose finding design - for ciclosporin. Journal of Clinical Pharmacology, 52(3), 347-360. - doi:10.1177/0091270010397731 -.

    4. -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin example)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define model, parameters, initial design
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  a=c(DOSE=70))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin example)
    -#####################################
    -
    -shrinkage(poped.db)
    -#> # A tibble: 3 × 5
    -#>     d_CL    d_V   d_KA type       group
    -#>    <dbl>  <dbl>  <dbl> <chr>      <chr>
    -#> 1 0.0244 0.174  0.0301 shrink_var grp_1
    -#> 2 0.0123 0.0910 0.0152 shrink_sd  grp_1
    -#> 3 0.0413 0.0590 0.134  se         grp_1
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/size.html b/docs/reference/size.html deleted file mode 100644 index a9b3e09d..00000000 --- a/docs/reference/size.html +++ /dev/null @@ -1,154 +0,0 @@ - -Function written to match MATLAB's size function — size • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Function written to match MATLAB's size function

    -
    - -
    -
    size(obj, dimension.index = NULL)
    -
    - -
    -

    Arguments

    -
    obj
    -

    An object you want to know the various dimensions of. Typically a matrix.

    - - -
    dimension.index
    -

    Which dimension you are interested in.

    - -
    -
    -

    Value

    - - -

    The dimensions of the object or specific dimension you are interested in.

    -
    -
    -

    See also

    -

    Other MATLAB: -cell(), -diag_matlab(), -feval(), -fileparts(), -isempty(), -ones(), -randn(), -rand(), -tic(), -toc(), -zeros()

    -
    - -
    -

    Examples

    -
    
    -size(c(2,3,4,5,6))
    -#> [1] 1 5
    -
    -size(10)
    -#> [1] 1 1
    -
    -size(zeros(4,7))
    -#> [1] 4 7
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/start_parallel.html b/docs/reference/start_parallel.html deleted file mode 100644 index cd4fb748..00000000 --- a/docs/reference/start_parallel.html +++ /dev/null @@ -1,165 +0,0 @@ - -Start parallel computational processes — start_parallel • PopED - - -
    -
    - - - -
    -
    - - -
    -

    This tool chooses the type of parallelization process to use based on the -computer OS being used. For windows the default is "snow" and for Linux-like -systems the default is "multicore"

    -
    - -
    -
    start_parallel(
    -  parallel = TRUE,
    -  num_cores = NULL,
    -  parallel_type = NULL,
    -  seed = NULL,
    -  dlls = NULL,
    -  mrgsolve_model = NULL,
    -  ...
    -)
    -
    - -
    -

    Arguments

    -
    parallel
    -

    Should the parallel functionality start up?

    - - -
    num_cores
    -

    How many cores to use. Default is -parallel::detectCores(). See detectCores for more information.

    - - -
    parallel_type
    -

    Which type of parallelization should be used? Can be -"snow" or "multicore". "snow" works on Linux-like systems & Windows. -"multicore" works only on Linux-like systems. By default this is chosen -for you depending on your operating system.

    - - -
    seed
    -

    The random seed to use.

    - - -
    dlls
    -

    If the computations require compiled code (DLL's) and you are -using the "snow" method then you need to specify the name of the DLL's without -the extension as a text vector c("this_file","that_file").

    - - -
    mrgsolve_model
    -

    If the computations require a mrgsolve model and you -are using the "snow" method" then you need to specify the name of the model -object created by mread or mcode

    - - -
    ...
    -

    Arguments passed to makeCluster

    - -
    -
    -

    Value

    - - -

    An atomic vector (TRUE or FALSE) with two attributes: "type" and "cores".

    -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/summary.poped_optim.html b/docs/reference/summary.poped_optim.html deleted file mode 100644 index 0edc839d..00000000 --- a/docs/reference/summary.poped_optim.html +++ /dev/null @@ -1,322 +0,0 @@ - -Display a summary of output from poped_optim — summary.poped_optim • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Display a summary of output from poped_optim

    -
    - -
    -
    # S3 method for poped_optim
    -summary(object, ...)
    -
    - -
    -

    Arguments

    -
    object
    -

    An object returned from poped_optim to summarize.

    - - -
    ...
    -

    Additional arguments. Passed to blockfinal.

    - -
    - -
    -

    Examples

    -
    library(PopED)
    -
    -############# START #################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -## Warfarin example from software comparison in:
    -## Nyberg et al., "Methods and software tools for design evaluation 
    -##   for population pharmacokinetics-pharmacodynamics studies", 
    -##   Br. J. Clin. Pharm., 2014. 
    -
    -## Optimization using an additive + proportional reidual error  
    -## to avoid sample times at very low concentrations (time 0 or very late samples).
    -
    -## find the parameters that are needed to define from the structural model
    -ff.PK.1.comp.oral.sd.CL
    -#> function (model_switch, xt, parameters, poped.db) 
    -#> {
    -#>     with(as.list(parameters), {
    -#>         y = xt
    -#>         y = (DOSE * Favail * KA/(V * (KA - CL/V))) * (exp(-CL/V * 
    -#>             xt) - exp(-KA * xt))
    -#>         return(list(y = y, poped.db = poped.db))
    -#>     })
    -#> }
    -#> <bytecode: 0x1205aa458>
    -#> <environment: namespace:PopED>
    -
    -## -- parameter definition function 
    -## -- names match parameters in function ff
    -sfg <- function(x,a,bpop,b,bocc){
    -  parameters=c(CL=bpop[1]*exp(b[1]),
    -               V=bpop[2]*exp(b[2]),
    -               KA=bpop[3]*exp(b[3]),
    -               Favail=bpop[4],
    -               DOSE=a[1])
    -  return(parameters) 
    -}
    -
    -## -- Define initial design  and design space
    -poped.db <- create.poped.database(ff_fun=ff.PK.1.comp.oral.sd.CL,
    -                                  fg_fun=sfg,
    -                                  fError_fun=feps.add.prop,
    -                                  bpop=c(CL=0.15, V=8, KA=1.0, Favail=1), 
    -                                  notfixed_bpop=c(1,1,1,0),
    -                                  d=c(CL=0.07, V=0.02, KA=0.6), 
    -                                  sigma=c(prop=0.01,add=0.25),
    -                                  groupsize=32,
    -                                  xt=c( 0.5,1,2,6,24,36,72,120),
    -                                  minxt=0.01,
    -                                  maxxt=120,
    -                                  a=c(DOSE=70),
    -                                  mina=c(DOSE=0.01),
    -                                  maxa=c(DOSE=100))
    -
    -############# END ###################
    -## Create PopED database
    -## (warfarin model for optimization)
    -#####################################
    -
    -##############
    -# D-family Optimization
    -##############
    -
    -
    -# ARS+BFGS+LS optimization of dose
    -# optimization with just a few iterations
    -# only to check that things are working
    -out_1 <- poped_optim(poped.db,opt_a =TRUE,
    -                      control = list(ARS=list(iter=2),
    -                                     BFGS=list(maxit=2),
    -                                     LS=list(line_length=2)),
    -                      iter_max = 1)
    -#> ===============================================================================
    -#> Initial design evaluation
    -#> 
    -#> Initial OFV = 55.3964
    -#> 
    -#> Initial design
    -#> expected relative standard error
    -#> (%RSE, rounded to nearest integer)
    -#>    Parameter   Values   RSE_0
    -#>           CL     0.15       5
    -#>            V        8       3
    -#>           KA        1      14
    -#>         d_CL     0.07      30
    -#>          d_V     0.02      37
    -#>         d_KA      0.6      27
    -#>     sig_prop     0.01      32
    -#>      sig_add     0.25      26
    -#> 
    -#> ==============================================================================
    -#> Optimization of design parameters
    -#> 
    -#> * Optimize Covariates
    -#> 
    -#> ************* Iteration 1  for all optimization methods***********************
    -#> 
    -#> *******************************************
    -#> Running Adaptive Random Search Optimization
    -#> *******************************************
    -#> Initial OFV = 55.3964
    -#> 
    -#> Total iterations: 2 
    -#> Elapsed time: 0.007 seconds.
    -#> 
    -#> Final OFV =  55.39645 
    -#> Parameters: 70 
    -#> 
    -#> *******************************************
    -#> Running BFGS Optimization
    -#> *******************************************
    -#> initial  value -55.396450 
    -#> final  value -55.766379 
    -#> stopped after 2 iterations
    -#> 
    -#> *******************************************
    -#> Running Line Search Optimization
    -#> *******************************************
    -#> 
    -#>    Initial parameters: 83.20112 
    -#>    Initial OFV: 55.76638 
    -#> 
    -#>    Searching parameter 1 
    -#>      Changed from 83.2011 to 100 ; OFV = 56.032 
    -#> 
    -#>    Elapsed time: 0.015 seconds.
    -#> 
    -#>    Final OFV =  56.03204 
    -#>    Parameters: 100 
    -#> 
    -#> *******************************************
    -#> Stopping criteria testing
    -#> (Compare between start of iteration and end of iteration)
    -#> *******************************************
    -#> Difference in OFV:  0.636
    -#> Relative difference in OFV:  1.15%
    -#> Efficiency: 
    -#>   ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.0827
    -#> 
    -#>  Efficiency stopping criteria: 
    -#>   Is (1.0827 <= 1.001)?   No.
    -#>   Stopping criteria NOT achieved.
    -#> 
    -#> Stopping criteria NOT achieved.
    -#> 
    -#> ===============================================================================
    -#> FINAL RESULTS
    -#> 
    -#> Optimized Covariates:
    -#> Group 1: 100
    -#> 
    -#> OFV = 56.032
    -#> 
    -#> Efficiency: 
    -#>   ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.0827
    -#> 
    -#> Expected relative standard error
    -#> (%RSE, rounded to nearest integer):
    -#>    Parameter   Values   RSE_0   RSE
    -#>           CL     0.15       5     5
    -#>            V        8       3     3
    -#>           KA        1      14    14
    -#>         d_CL     0.07      30    28
    -#>          d_V     0.02      37    34
    -#>         d_KA      0.6      27    26
    -#>     sig_prop     0.01      32    23
    -#>      sig_add     0.25      26    30
    -#> 
    -#> Total running time: 0.131 seconds
    -
    -
    -summary(out_1)
    -#> ===============================================================================
    -#> FINAL RESULTS
    -#> 
    -#> Optimized Covariates:
    -#> Group 1: 100
    -#> 
    -#> OFV = 56.032
    -#> 
    -#> Efficiency: 
    -#>   ((exp(ofv_final) / exp(ofv_init))^(1/n_parameters)) = 1.0827
    -#> 
    -#> Expected relative standard error
    -#> (%RSE, rounded to nearest integer):
    -#>    Parameter   Values   RSE_0   RSE
    -#>           CL     0.15       5     5
    -#>            V        8       3     3
    -#>           KA        1      14    14
    -#>         d_CL     0.07      30    28
    -#>          d_V     0.02      37    34
    -#>         d_KA      0.6      27    26
    -#>     sig_prop     0.01      32    23
    -#>      sig_add     0.25      26    30
    -#> 
    -#> Total running time: 0.131 seconds
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/test.csv b/docs/reference/test.csv deleted file mode 100644 index 1df899ac..00000000 --- a/docs/reference/test.csv +++ /dev/null @@ -1,61 +0,0 @@ -ID,Time,DV,IPRED,PRED,AMT,Group,Model,WT,AGE -1,0.5,.,.,.,1000,1,1,70,50 -1,0.5,.,.,.,.,1,1,70,50 -1,1,.,.,.,.,1,1,70,50 -1,2,.,.,.,.,1,1,70,50 -1,6,.,.,.,.,1,1,70,50 -1,10,.,.,.,20,1,1,70,50 -1,24,.,.,.,.,1,1,70,50 -1,36,.,.,.,.,1,1,70,50 -1,72,.,.,.,.,1,1,70,50 -1,120,.,.,.,.,1,1,70,50 -2,0.5,.,.,.,1000,1,1,70,50 -2,0.5,.,.,.,.,1,1,70,50 -2,1,.,.,.,.,1,1,70,50 -2,2,.,.,.,.,1,1,70,50 -2,6,.,.,.,.,1,1,70,50 -2,10,.,.,.,20,1,1,70,50 -2,24,.,.,.,.,1,1,70,50 -2,36,.,.,.,.,1,1,70,50 -2,72,.,.,.,.,1,1,70,50 -2,120,.,.,.,.,1,1,70,50 -3,0.5,.,.,.,1000,1,1,70,50 -3,0.5,.,.,.,.,1,1,70,50 -3,1,.,.,.,.,1,1,70,50 -3,2,.,.,.,.,1,1,70,50 -3,6,.,.,.,.,1,1,70,50 -3,10,.,.,.,20,1,1,70,50 -3,24,.,.,.,.,1,1,70,50 -3,36,.,.,.,.,1,1,70,50 -3,72,.,.,.,.,1,1,70,50 -3,120,.,.,.,.,1,1,70,50 -4,0.5,.,.,.,1000,2,1,60,45 -4,0.5,.,.,.,.,2,1,60,45 -4,1,.,.,.,.,2,1,60,45 -4,2,.,.,.,.,2,1,60,45 -4,6,.,.,.,.,2,1,60,45 -4,10,.,.,.,20,2,1,60,45 -4,24,.,.,.,.,2,1,60,45 -4,36,.,.,.,.,2,1,60,45 -4,72,.,.,.,.,2,1,60,45 -4,120,.,.,.,.,2,1,60,45 -5,0.5,.,.,.,1000,2,1,60,45 -5,0.5,.,.,.,.,2,1,60,45 -5,1,.,.,.,.,2,1,60,45 -5,2,.,.,.,.,2,1,60,45 -5,6,.,.,.,.,2,1,60,45 -5,10,.,.,.,20,2,1,60,45 -5,24,.,.,.,.,2,1,60,45 -5,36,.,.,.,.,2,1,60,45 -5,72,.,.,.,.,2,1,60,45 -5,120,.,.,.,.,2,1,60,45 -6,0.5,.,.,.,1000,2,1,60,45 -6,0.5,.,.,.,.,2,1,60,45 -6,1,.,.,.,.,2,1,60,45 -6,2,.,.,.,.,2,1,60,45 -6,6,.,.,.,.,2,1,60,45 -6,10,.,.,.,20,2,1,60,45 -6,24,.,.,.,.,2,1,60,45 -6,36,.,.,.,.,2,1,60,45 -6,72,.,.,.,.,2,1,60,45 -6,120,.,.,.,.,2,1,60,45 diff --git a/docs/reference/test_for_max.html b/docs/reference/test_for_max.html deleted file mode 100644 index 473fa4d7..00000000 --- a/docs/reference/test_for_max.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - -Test if any matrix element is above a max value. — test_for_max • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Function tests is any matrix element is above a maximum value. For those elements -the function sets those values to the maximum value.

    - - -
    test_for_max(mat, max_mat)
    - -

    Arguments

    -
    -
    mat
    -
    A matrix.
    -
    max_mat
    -
    A matrix the same size as mat with the maximum allowed value of that element.
    -
    - -

    Value

    - -

    A matrix

    - -

    See also

    - -

    Other matrix_manipulation: diag_matlab, - test_for_min, test_for_zeros

    - - -

    Examples

    -
    -test_for_max(cbind(2,3,4,5,6),cbind(4,4,4,4,4))
    #> [,1] [,2] [,3] [,4] [,5] -#> [1,] 2 3 4 4 4
    -test_for_max(ones(6)*45,ones(6)*40)
    #> [,1] [,2] [,3] [,4] [,5] [,6] -#> [1,] 40 40 40 40 40 40 -#> [2,] 40 40 40 40 40 40 -#> [3,] 40 40 40 40 40 40 -#> [4,] 40 40 40 40 40 40 -#> [5,] 40 40 40 40 40 40 -#> [6,] 40 40 40 40 40 40
    - - -
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/test_for_min.html b/docs/reference/test_for_min.html deleted file mode 100644 index df5bfadb..00000000 --- a/docs/reference/test_for_min.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - -Test if any matrix element is above a minimum value. — test_for_min • PopED - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - - -

    Function tests is any matrix element is above a minimum value. For those elements -the function sets those values to the minimum value.

    - - -
    test_for_min(mat, min_mat)
    - -

    Arguments

    -
    -
    mat
    -
    A matrix.
    -
    min_mat
    -
    A matrix the same size as mat with the minimum allowed value of that element.
    -
    - -

    Value

    - -

    A matrix

    - -

    See also

    - -

    Other matrix_manipulation: diag_matlab, - test_for_max, test_for_zeros

    - - -

    Examples

    -
    -test_for_min(cbind(2,3,4,5,6),cbind(4,4,4,4,4))
    #> [,1] [,2] [,3] [,4] [,5] -#> [1,] 4 4 4 5 6
    -test_for_min(ones(6)*45,ones(6)*40)
    #> [,1] [,2] [,3] [,4] [,5] [,6] -#> [1,] 45 45 45 45 45 45 -#> [2,] 45 45 45 45 45 45 -#> [3,] 45 45 45 45 45 45 -#> [4,] 45 45 45 45 45 45 -#> [5,] 45 45 45 45 45 45 -#> [6,] 45 45 45 45 45 45
    - - - -
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - diff --git a/docs/reference/test_for_zeros.html b/docs/reference/test_for_zeros.html deleted file mode 100644 index 849999b2..00000000 --- a/docs/reference/test_for_zeros.html +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - - - -Test if any matrix element is zero. — test_for_zeros • PopED - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - -
    - -
    -
    - - -
    - -

    Function tests is any matrix element is zero. For those elements -the function sets those values to the minimum value allowed (not zero). -This is used to avoid numerical problems in the FIM calculation.

    - -
    - -
    test_for_zeros(mat, ourzero)
    - -

    Arguments

    - - - - - - - - - - -
    mat

    A matrix.

    ourzero

    A matrix the same size as mat with the value that zero should be reassigned to.

    - -

    Value

    - -

    A matrix

    - -

    See also

    - -

    Other matrix_manipulation: diag_matlab

    - - -

    Examples

    -
    -test_for_zeros(cbind(2,3,0,5,6),1e-18)
    #> [,1] [,2] [,3] [,4] [,5] -#> [1,] 2 3 1e-18 5 6
    -test_for_zeros(zeros(6),1e-7)
    #> [,1] [,2] [,3] [,4] [,5] [,6] -#> [1,] 1e-07 1e-07 1e-07 1e-07 1e-07 1e-07 -#> [2,] 1e-07 1e-07 1e-07 1e-07 1e-07 1e-07 -#> [3,] 1e-07 1e-07 1e-07 1e-07 1e-07 1e-07 -#> [4,] 1e-07 1e-07 1e-07 1e-07 1e-07 1e-07 -#> [5,] 1e-07 1e-07 1e-07 1e-07 1e-07 1e-07 -#> [6,] 1e-07 1e-07 1e-07 1e-07 1e-07 1e-07
    -test_for_zeros(cbind(1,2,3,NA,0),1e-5)
    #> [,1] [,2] [,3] [,4] [,5] -#> [1,] 1 2 3 NA 1e-05
    - - -
    -
    - -
    - -
    - - -
    -

    Site built with pkgdown.

    -
    - -
    -
    - - - - - - diff --git a/docs/reference/test_mat_size.html b/docs/reference/test_mat_size.html deleted file mode 100644 index 67944efd..00000000 --- a/docs/reference/test_mat_size.html +++ /dev/null @@ -1,140 +0,0 @@ - -Test to make sure that matricies are the right size — test_mat_size • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Test to make sure that matricies are the right size

    -
    - -
    -
    test_mat_size(correct_size, mat, name)
    -
    - -
    -

    Arguments

    -
    correct_size
    -

    the correct size of a matrix

    - - -
    mat
    -

    The matrix to test.

    - - -
    name
    -

    The name of the matrix as a string.

    - -
    - -
    -

    Examples

    -
    
    -test_mat_size(c(2,3),zeros(2,3),"foo")
    -#> [1] 1
    -
    -if (FALSE) {
    -  test_mat_size(c(2,3),zeros(2,6),"foo")
    -}
    -
    -test_mat_size(c(1,3),c(2,6,7),"foo")
    -#> [1] 1
    -
    -
    -
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/tic.html b/docs/reference/tic.html deleted file mode 100644 index 03cac89b..00000000 --- a/docs/reference/tic.html +++ /dev/null @@ -1,158 +0,0 @@ - -Timer function (as in MATLAB) — tic • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Function to start a timer. Stop with toc().

    -
    - -
    -
    tic(gcFirst = FALSE, name = ".poped_savedTime")
    -
    - -
    -

    Arguments

    -
    gcFirst
    -

    Perform garbage collection?

    - - -
    name
    -

    The saved name of the time object.

    - -
    -
    -

    Note

    -

    This is a modified version of the same function in the matlab R-package.

    -
    -
    -

    See also

    -

    Other MATLAB: -cell(), -diag_matlab(), -feval(), -fileparts(), -isempty(), -ones(), -randn(), -rand(), -size(), -toc(), -zeros()

    -
    - -
    -

    Examples

    -
    
    -tic()
    -toc()
    -#> Elapsed time: 0 seconds.
    -
    -tic(name="foo")
    -toc()
    -#> Elapsed time: 0.001 seconds.
    -tic()
    -toc()
    -#> Elapsed time: 0 seconds.
    -toc()
    -#> Elapsed time: 0.001 seconds.
    -tic()
    -toc(name="foo")
    -#> Elapsed time: 0.003 seconds.
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/toc.html b/docs/reference/toc.html deleted file mode 100644 index 505677b0..00000000 --- a/docs/reference/toc.html +++ /dev/null @@ -1,158 +0,0 @@ - -Timer function (as in MATLAB) — toc • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Function to stop a timer. Start with tic().

    -
    - -
    -
    toc(echo = TRUE, name = ".poped_savedTime")
    -
    - -
    -

    Arguments

    -
    echo
    -

    Print time to screen?

    - - -
    name
    -

    The saved name of the time object.

    - -
    -
    -

    Note

    -

    This is a modified version of the same function in the matlab R-package.

    -
    -
    -

    See also

    -

    Other MATLAB: -cell(), -diag_matlab(), -feval(), -fileparts(), -isempty(), -ones(), -randn(), -rand(), -size(), -tic(), -zeros()

    -
    - -
    -

    Examples

    -
    
    -tic()
    -toc()
    -#> Elapsed time: 0 seconds.
    -
    -tic(name="foo")
    -toc()
    -#> Elapsed time: 0.001 seconds.
    -tic()
    -toc()
    -#> Elapsed time: 0 seconds.
    -toc()
    -#> Elapsed time: 0 seconds.
    -tic()
    -toc(name="foo")
    -#> Elapsed time: 0.002 seconds.
    -
    -
    -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/tryCatch.W.E.html b/docs/reference/tryCatch.W.E.html deleted file mode 100644 index aa416c68..00000000 --- a/docs/reference/tryCatch.W.E.html +++ /dev/null @@ -1,128 +0,0 @@ - -tryCatch both warnings (with value) and errors — tryCatch.W.E • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Catch *and* save both errors and warnings, and in the case of -a warning, also keep the computed result.

    -
    - -
    -
    tryCatch.W.E(expr)
    -
    - -
    -

    Arguments

    -
    expr
    -

    an R expression to evaluate

    - -
    -
    -

    Value

    - - -

    a list with 'value' and 'warning', where - 'value' may be an error caught.

    -
    -
    -

    Author

    -

    Martin Maechler, The R Core Team

    -
    - -
    - -
    - - -
    - - - - - - - - diff --git a/docs/reference/zeros.html b/docs/reference/zeros.html deleted file mode 100644 index b7ae2531..00000000 --- a/docs/reference/zeros.html +++ /dev/null @@ -1,161 +0,0 @@ - -Create a matrix of zeros. — zeros • PopED - - -
    -
    - - - -
    -
    - - -
    -

    Create a matrix of zeros of size (dim1 x dim2).

    -
    - -
    -
    zeros(dim1, dim2 = NULL)
    -
    - -
    -

    Arguments

    -
    dim1
    -

    The dimension of the matrix (if square) or the number of rows.

    - - -
    dim2
    -

    The number of columns

    - -
    -
    -

    Value

    - - -

    A matrix of zeros.

    -
    -
    -

    See also

    -

    Other MATLAB: -cell(), -diag_matlab(), -feval(), -fileparts(), -isempty(), -ones(), -randn(), -rand(), -size(), -tic(), -toc()

    -
    - -
    -

    Examples

    -
    
    -zeros(3)
    -#>      [,1] [,2] [,3]
    -#> [1,]    0    0    0
    -#> [2,]    0    0    0
    -#> [3,]    0    0    0
    -zeros(0,3)
    -#>      [,1] [,2] [,3]
    -zeros(4,7)
    -#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7]
    -#> [1,]    0    0    0    0    0    0    0
    -#> [2,]    0    0    0    0    0    0    0
    -#> [3,]    0    0    0    0    0    0    0
    -#> [4,]    0    0    0    0    0    0    0
    -zeros(1,4)
    -#>      [,1] [,2] [,3] [,4]
    -#> [1,]    0    0    0    0
    -
    -
    -
    - -
    - - -
    - - - - - - - -