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
Show more breadcrumbs
Isabelle Sanchez
kfino
Commits
cf354171
Commit
cf354171
authored
2 years ago
by
sanchezi
Browse files
Options
Downloads
Patches
Plain Diff
fonction loi_outlier externe
parent
7e3aa72b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#55336
passed
2 years ago
Stage: build
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
NAMESPACE
+1
-0
1 addition, 0 deletions
NAMESPACE
R/utils.R
+31
-20
31 additions, 20 deletions
R/utils.R
man/loi_outlier.Rd
+32
-0
32 additions, 0 deletions
man/loi_outlier.Rd
with
64 additions
and
20 deletions
NAMESPACE
+
1
−
0
View file @
cf354171
...
...
@@ -5,6 +5,7 @@ export(KBO_known)
export(kfino_fit)
export(kfino_fit2)
export(kfino_plot)
export(loi_outlier)
importFrom(dplyr,"%>%")
importFrom(dplyr,.data)
importFrom(dplyr,arrange)
...
...
This diff is collapsed.
Click to expand it.
R/utils.R
+
31
−
20
View file @
cf354171
#' loi_outlier This function defines an outlier distribution (Surface of a
#' trapezium) and uses input parameters given in the main function kfino_fit()
#'
#' @param y numeric, point
#' @param K numeric, constant value
#' @param expertMin numeric, the minimal weight expected by the user
#' @param expertMax numeric, the maximal weight expected by the user
#'
#' @details this function is used to calculate an outlier distribution
#' following a trapezium shape
#' @return a numeric value
#' @export
#'
#' @examples
#' loi_outlier(2,5,10,45)
loi_outlier
<-
function
(
y
,
K
,
expertMin
,
expertMax
){
2
/
((
K
+1
)
*
(
expertMax
-
expertMin
))
+
(
2
*
(
K
-1
)
/
(
K
+1
))
*
((
y
-
expertMin
)
/
((
expertMax
-
expertMin
)
^
2
))
}
#--------------------------------------------------------------------------
#' KBO_known
#'
#' @param param list, a list of 10 input parameters for mm, pp and m0
...
...
@@ -28,19 +53,12 @@ KBO_known<-function(param,threshold,Y,Tps,N){
# paramètre de troncature
kappa
<
-10
#--- function defining an outlier distribution (Surface of a trapezium)
# uses expertMin and expertMax
loi_outlier
<-
function
(
y
){
2
/
((
K
+1
)
*
(
expertMax
-
expertMin
))
+
(
2
*
(
K
-1
)
/
(
K
+1
))
*
((
y
-
expertMin
)
/
((
expertMax
-
expertMin
)
^
2
))
}
# initialisation (1.1.1)
#--------------------
m1
=
(
sigma2_pp
*
m0
+
Y
[
1
]
*
sigma2_m0
)
/
(
sigma2_m0
+
sigma2_pp
)
sigma1
=
(
sigma2_m0
*
sigma2_pp
)
/
(
sigma2_m0
+
sigma2_pp
)
l0
<-
loi_outlier
(
Y
[
1
])
l0
<-
loi_outlier
(
Y
[
1
]
,
K
,
expertMin
,
expertMax
)
loinorm1
<-
dnorm
(
Y
[
1
],
m0
,
sqrt
(
sigma2_m0
+
sigma2_pp
))
p0
=
((
1
-
pp
)
*
l0
)
/
(
pp
*
loinorm1
+
(
1
-
pp
)
*
l0
)
...
...
@@ -71,7 +89,7 @@ KBO_known<-function(param,threshold,Y,Tps,N){
qnew
=
rep
(
0
,
2
^
(
k
+1
))
diffTps
<-
Tps
[
k
+1
]
-
Tps
[
k
]
#--- numérateur de pu0
tpbeta
<-
loi_outlier
(
Y
[
k
+1
])
tpbeta
<-
loi_outlier
(
Y
[
k
+1
]
,
K
,
expertMin
,
expertMax
)
pnew
[
1
:
(
2
^
k
)]
=
p
[
1
:
(
2
^
k
)]
*
(
1
-
pp
)
*
tpbeta
Lnew
[
1
:
(
2
^
k
)]
=
L
[
1
:
(
2
^
k
)]
*
tpbeta
...
...
@@ -117,7 +135,7 @@ KBO_known<-function(param,threshold,Y,Tps,N){
diffTps
<-
Tps
[
k
+1
]
-
Tps
[
k
]
#--- numérateur de pu0
tpbeta
<-
loi_outlier
(
Y
[
k
+1
])
tpbeta
<-
loi_outlier
(
Y
[
k
+1
]
,
K
,
expertMin
,
expertMax
)
pnew
[
1
:
(
2
^
kappa
)]
=
p
[
1
:
(
2
^
kappa
)]
*
(
1
-
pp
)
*
tpbeta
Lnew
[
1
:
(
2
^
kappa
)]
=
L
[
1
:
(
2
^
kappa
)]
*
tpbeta
...
...
@@ -200,13 +218,6 @@ KBO_L<-function(param,Y,Tps,N,dix){
sigma2_pp
<-
param
[[
"sigma2_pp"
]]
K
<-
param
[[
"K"
]]
#--- function defining an outlier distribution (Surface of a trapezium)
# uses expertMin and expertMax
loi_outlier
<-
function
(
y
){
2
/
((
K
+1
)
*
(
expertMax
-
expertMin
))
+
(
2
*
(
K
-1
)
/
(
K
+1
))
*
((
y
-
expertMin
)
/
((
expertMax
-
expertMin
)
^
2
))
}
#---- paramètre de troncature
# Ici je met kappa =7, ca me fais retirer les proba <0.01 au lieu de 0.001
# comme qd kappa=10 mais ca divise par 10 le temps de calcul
...
...
@@ -217,7 +228,7 @@ KBO_L<-function(param,Y,Tps,N,dix){
m1
=
(
sigma2_pp
*
m0
+
Y
[
1
]
*
sigma2_m0
)
/
(
sigma2_m0
+
sigma2_pp
)
sigma1
=
(
sigma2_m0
*
sigma2_pp
)
/
(
sigma2_m0
+
sigma2_pp
)
l0
<-
loi_outlier
(
Y
[
1
])
l0
<-
loi_outlier
(
Y
[
1
]
,
K
,
expertMin
,
expertMax
)
loinorm1
<-
dnorm
(
Y
[
1
],
m0
,
sqrt
(
sigma2_m0
+
sigma2_pp
))
p0
=
((
1
-
pp
)
*
l0
)
/
(
pp
*
loinorm1
+
(
1
-
pp
)
*
l0
)
...
...
@@ -242,7 +253,7 @@ KBO_L<-function(param,Y,Tps,N,dix){
qnew
=
rep
(
0
,
2
^
(
k
+1
))
diffTps
<-
Tps
[
k
+1
]
-
Tps
[
k
]
#--- numérateur de pu0
tpbeta
<-
loi_outlier
(
Y
[
k
+1
])
tpbeta
<-
loi_outlier
(
Y
[
k
+1
]
,
K
,
expertMin
,
expertMax
)
pnew
[
1
:
(
2
^
k
)]
=
p
[
1
:
(
2
^
k
)]
*
(
1
-
pp
)
*
tpbeta
Lnew
[
1
:
(
2
^
k
)]
=
L
[
1
:
(
2
^
k
)]
*
tpbeta
mnew
[
1
:
(
2
^
k
)]
=
m
[
1
:
(
2
^
k
)]
*
exp
(
-
aa
*
diffTps
)
+
mm
*
(
1
-
exp
(
-
aa
*
diffTps
))
#m_u0
...
...
@@ -277,7 +288,7 @@ KBO_L<-function(param,Y,Tps,N,dix){
qnew
=
rep
(
0
,
2
^
(
kappa
+1
))
diffTps
<-
Tps
[
k
+1
]
-
Tps
[
k
]
#--- numérateur de pu0
tpbeta
<-
loi_outlier
(
Y
[
k
+1
])
tpbeta
<-
loi_outlier
(
Y
[
k
+1
]
,
K
,
expertMin
,
expertMax
)
pnew
[
1
:
(
2
^
kappa
)]
=
p
[
1
:
(
2
^
kappa
)]
*
(
1
-
pp
)
*
tpbeta
Lnew
[
1
:
(
2
^
kappa
)]
=
L
[
1
:
(
2
^
kappa
)]
*
tpbeta
mnew
[
1
:
(
2
^
kappa
)]
=
m
[
1
:
(
2
^
kappa
)]
*
exp
(
-
aa
*
diffTps
)
+
mm
*
(
1
-
exp
(
-
aa
*
diffTps
))
#m_u0
...
...
This diff is collapsed.
Click to expand it.
man/loi_outlier.Rd
0 → 100644
+
32
−
0
View file @
cf354171
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{loi_outlier}
\alias{loi_outlier}
\title{loi_outlier This function defines an outlier distribution (Surface of a
trapezium) and uses input parameters given in the main function kfino_fit()}
\usage{
loi_outlier(y, K, expertMin, expertMax)
}
\arguments{
\item{y}{numeric, point}
\item{K}{numeric, constant value}
\item{expertMin}{numeric, the minimal weight expected by the user}
\item{expertMax}{numeric, the maximal weight expected by the user}
}
\value{
a numeric value
}
\description{
loi_outlier This function defines an outlier distribution (Surface of a
trapezium) and uses input parameters given in the main function kfino_fit()
}
\details{
this function is used to calculate an outlier distribution
following a trapezium shape
}
\examples{
loi_outlier(2,5,10,45)
}
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