Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HYCAR-Hydro
airGR
Commits
c056397c
Commit
c056397c
authored
Jun 24, 2021
by
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
parent
e03b26b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
R/CreateErrorCrit_GAPX.R
View file @
c056397c
...
...
@@ -18,7 +18,7 @@ CreateErrorCrit_GAPX <- function(FUN_TRANSFO) {
ParamOpt
<-
EC
$
VarSim
[
!
EC
$
TS_ignore
]
## ErrorCrit
Crit
<-
1
-
sum
(((
ParamApr
-
ParamOpt
)
/
4
0
)
^
2
)
^
0.5
Crit
<-
1
-
sum
(((
ParamApr
-
ParamOpt
)
/
2
0
)
^
2
)
^
0.5
if
(
is.numeric
(
Crit
)
&
is.finite
(
Crit
))
{
CritValue
<-
Crit
...
...
tests/testthat/test-CreateErrorCrit_GAPX.R
View file @
c056397c
...
...
@@ -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"
)
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment