Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
kfino
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
Isabelle Sanchez
kfino
Commits
ade17252
Commit
ade17252
authored
3 years ago
by
Isabelle Sanchez
Browse files
Options
Downloads
Patches
Plain Diff
add minp parameter in kfino_fit()
parent
93925805
No related branches found
No related tags found
No related merge requests found
Pipeline
#55129
passed
3 years ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
R/kfino.R
+10
-8
10 additions, 8 deletions
R/kfino.R
man/kfino_fit.Rd
+7
-2
7 additions, 2 deletions
man/kfino_fit.Rd
with
17 additions
and
10 deletions
R/kfino.R
+
10
−
8
View file @
ade17252
...
...
@@ -26,7 +26,8 @@
#' @param sigma2_pp numeric, variance of pp, related to the unit of Yvar,
#' default 5
#' @param K numeric, cst in the outlier function (trapezoid), by default K=2
#' increasing K, XXX
#' increasing K, XXX
#' @param minp numeric, minimal pp probability to be correctly weighted.
#'
#' @details The initialization parameter vector X contains:
#' \describe{
...
...
@@ -38,7 +39,9 @@
#' or entirely constructed by the function. In the optimisation step, this
#' vector is initialized according to the input data (between the expert
#' range) using quantile of the Y distribution (varying between 0.2 and 0.8 for
#' m0 and 0.5 for mm). pp is a sequence varying between 0.4 and 0.8.
#' m0 and 0.5 for mm). pp is a sequence varying between minp to (minp+0.3). A
#' sub-sampling is performed to speed the algorithm if the number of possible
#' observations studied is greater than 500.
#'
#' @importFrom stats dnorm quantile na.omit
#' @importFrom dplyr mutate filter left_join arrange %>%
...
...
@@ -85,8 +88,8 @@
kfino_fit
<-
function
(
datain
,
Tvar
,
Yvar
,
expertMin
=
NULL
,
expertMax
=
NULL
,
X
=
NULL
,
doOptim
=
TRUE
,
threshold
=
0.5
,
aa
=
0.001
,
sigma2_mm
=
0.05
,
sigma2_pp
,
K
=
2
){
doOptim
=
TRUE
,
threshold
=
0.5
,
aa
=
0.001
,
sigma2_mm
=
0.05
,
sigma2_pp
,
K
=
2
,
minp
=
0.4
){
if
(
any
(
is.null
(
expertMin
)
|
is.null
(
expertMax
))
)
stop
(
'You have to define expertMin and expertMax.'
)
...
...
@@ -106,7 +109,6 @@ kfino_fit<-function(datain,Tvar,Yvar,
mutate
(
rowNum
=
row_number
(),
flag1
=
if_else
(
.data
[[
Yvar
]]
>
expertMin
&
.data
[[
Yvar
]]
<=
expertMax
,
"OK"
,
"Bad"
))
tp.dt
<-
datain
%>%
filter
(
.data
$
flag1
==
"OK"
)
Y
<-
tp.dt
[,
Yvar
]
...
...
@@ -416,7 +418,7 @@ kfino_fit<-function(datain,Tvar,Yvar,
for
(
m0
in
seq
(
bornem0
[
1
],
bornem0
[
2
],
2
)
){
for
(
mm
in
seq
((
m0
-5
),(
m0
+20
),
2
)
){
for
(
p
in
seq
(
0.4
,
0.7
,
0.1
)){
for
(
p
in
seq
(
minp
,(
minp
+
0.3
)
,
0.1
)){
# A voir si 50 sous-echantillons au hasard suffisent. Comme dans
# Robbins Monroe, permet aussi de reduire l'impact de la troncature
Subechant
=
sort
(
sample
(
1
:
NN
,
50
))
...
...
@@ -448,7 +450,7 @@ kfino_fit<-function(datain,Tvar,Yvar,
resultat
=
FK_para_connu_tronc
(
param
)
}
else
if
(
N
>
50
){
# optim sans sous-echantillonage
# optim sans sous-echantillon
n
age
print
(
"-------:"
)
print
(
"Optimisation of initial parameters - result:"
)
print
(
"no sub-sampling performed:"
)
...
...
@@ -466,7 +468,7 @@ kfino_fit<-function(datain,Tvar,Yvar,
for
(
m0
in
seq
(
bornem0
[
1
],
bornem0
[
2
],
2
)
){
for
(
mm
in
seq
((
m0
-5
),(
m0
+20
),
2
)
){
for
(
p
in
seq
(
0.4
,
0.7
,
0.1
)){
for
(
p
in
seq
(
minp
,(
minp
+
0.3
)
,
0.1
)){
V
=
KBO_vraiss
(
c
(
mm
,
p
,
m0
))
if
(
V
>
Vopt
){
Vopt
=
V
...
...
This diff is collapsed.
Click to expand it.
man/kfino_fit.Rd
+
7
−
2
View file @
ade17252
...
...
@@ -16,7 +16,8 @@ kfino_fit(
aa = 0.001,
sigma2_mm = 0.05,
sigma2_pp,
K = 2
K = 2,
minp = 0.4
)
}
\arguments{
...
...
@@ -49,6 +50,8 @@ default 5}
\item{K}{numeric, cst in the outlier function (trapezoid), by default K=2
increasing K, XXX}
\item{minp}{numeric, minimal pp probability to be correctly weighted.}
}
\value{
a S3 list with two data frames and a list of vectors of
...
...
@@ -75,7 +78,9 @@ It can be given by the user following his knowledge of the animal or dataset
or entirely constructed by the function. In the optimisation step, this
vector is initialized according to the input data (between the expert
range) using quantile of the Y distribution (varying between 0.2 and 0.8 for
m0 and 0.5 for mm). pp is a sequence varying between 0.4 and 0.8.
m0 and 0.5 for mm). pp is a sequence varying between minp to (minp+0.3). A
sub-sampling is performed to speed the algorithm if the number of possible
observations studied is greater than 500.
}
\examples{
data(spring1)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment