Commit c056397c authored by Dorchies David's avatar Dorchies David
Browse files

fix(ErroCrit_GAPX): parameter range of 20 instead of 40

- also add a test on a priori parameter set with NA

Refs #111
Showing with 13 additions and 2 deletions
+13 -2
......@@ -18,7 +18,7 @@ CreateErrorCrit_GAPX <- function(FUN_TRANSFO) {
ParamOpt <- EC$VarSim[!EC$TS_ignore]
## ErrorCrit
Crit <- 1 - sum(((ParamApr - ParamOpt) / 40)^2)^0.5
Crit <- 1 - sum(((ParamApr - ParamOpt) / 20)^2)^0.5
if (is.numeric(Crit) & is.finite(Crit)) {
CritValue <- Crit
......
......@@ -28,5 +28,16 @@ test_that("ErrorCrit should return 1 for same parameters", {
test_that("ErrorCrit should return 1-nbParam^0.5/40 for ParamT shifted by 1", {
ParamT <- ParamT + 1
IC <- CreateInputsCrit(ErrorCrit_GAPX, InputsModel, RunOptions, Obs = ParamT, VarObs = "ParamT")
expect_equal(ErrorCrit_GAPX(IC, OutputsModel)$CritValue, 1 - RunOptions$FeatFUN_MOD$NbParam^0.5 / 40)
expect_equal(ErrorCrit_GAPX(IC, OutputsModel)$CritValue,
1 - RunOptions$FeatFUN_MOD$NbParam^0.5 / 20)
})
test_that("ErrorCrit should return 1-(nbParam-1)^0.5/40 for ParamT shifted by 1 with one NA", {
ParamT <- ParamT + 1
ParamT[1] <- NA
IC <- CreateInputsCrit(ErrorCrit_GAPX, InputsModel, RunOptions, Obs = ParamT, VarObs = "ParamT")
expect_equal(suppressWarnings(ErrorCrit_GAPX(IC, OutputsModel)$CritValue),
1 - (RunOptions$FeatFUN_MOD$NbParam - 1)^0.5 / 20)
expect_warning(ErrorCrit_GAPX(IC, OutputsModel)$CritValue,
regexp = "criterion GAPX computed on less than 4 parameters")
})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment