-
Notifications
You must be signed in to change notification settings - Fork 20
/
ofv_criterion.R
53 lines (46 loc) · 1.53 KB
/
ofv_criterion.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#' Normalize an objective function by the size of the FIM matrix
#'
#' 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 \code{\link{ofv_fim}}.
#'
#' @param ofv_f An objective function
#' @param num_parameters The number of parameters to use for normalization
#' @param poped.db a poped database
#' @inheritParams ofv_fim
#'
#' @return The specified criterion value.
#'
#' @family FIM
#'
#'
#' @example tests/testthat/examples_fcn_doc/warfarin_optimize.R
#' @example tests/testthat/examples_fcn_doc/examples_ofv_criterion.R
#'
#' @export
ofv_criterion <- function(ofv_f,
num_parameters,
poped.db,
ofv_calc_type=poped.db$settings$ofv_calc_type){
#Input: the ofv
#Return the single value that should be maximized
criterion_value = 0
if(ofv_calc_type==0){
criterion_value=ofv_f
}
if((ofv_calc_type==1) ){#D-Optimal Design
criterion_value = ofv_f^(1/num_parameters)
}
if((ofv_calc_type==4) ){#D-Optimal Design
criterion_value = exp(ofv_f)^(1/num_parameters)
}
if((ofv_calc_type==2) ){#A-Optimal Design
criterion_value=ofv_f/num_parameters
}
if((ofv_calc_type==3) ){#S-Optimal Design
stop(sprintf('Criterion for S-optimal design not implemented yet'))
}
if((ofv_calc_type==6) ){#Ds-Optimal design
criterion_value = ofv_f^(1/sum(poped.db$parameters$ds_index))
}
return( criterion_value )
}