kfino_plot {kfino}R Documentation

kfino_plot a graphical function for the result of a kfino run

Description

kfino_plot a graphical function for the result of a kfino run

Usage

kfino_plot(
  resuin,
  typeG,
  Tvar,
  Yvar,
  Ident,
  title = NULL,
  labelX = NULL,
  labelY = NULL
)

Arguments

resuin

a list resulting of the kfino algorithm

typeG

char, type of graphic, either detection of outliers (with qualitative or quantitative display) or prediction. must be "quanti" or "quali" or "prediction"

Tvar

char, time variable in the data.frame datain

Yvar

char, variable which was analysed in the data.frame datain

Ident

char, column name of the individual id to be analyzed

title

char, a graph title

labelX

char, a label for x-axis

labelY

char, a label for y-axis

Details

The produced graphic can be, according to typeG:

quali

This plot shows the detection of outliers with a qualitative rule: OK values (black), KO values (outliers, purple) and OOR values (out of range values defined by the user in 'kfino_fit', red)

quanti

This plot shows the detection of outliers with a quantitative display using the calculated probability of the kfino algorithm

prediction

This plot shows the prediction of the analyzed variable plus the OK values. Prediction corresponds to E[X_t | Y_1...t] for each time point t. Between 2 time points, we used a simple linear interpolation.

Value

a ggplot2 graphic

Examples

data(spring1)
library(dplyr)

print(colnames(spring1))

# --- Without Optimisation on initial parameters
param2<-list(m0=41,
             mm=45,
             pp=0.5,
             aa=0.001,
             expertMin=30,
             expertMax=75,
             sigma2_m0=1,
             sigma2_mm=0.05,
             sigma2_pp=5,
             K=2,
             seqp=seq(0.5,0.7,0.1))
resu2<-kfino_fit(datain=spring1,
              Tvar="dateNum",Yvar="Poids",
              param=param2,
              doOptim=FALSE)

# flags are qualitative
kfino_plot(resuin=resu2,typeG="quali",
            Tvar="Day",Yvar="Poids",Ident="IDE",
            title="kfino spring1",
            labelX="Time (day)",labelY="Weight (kg)")

# flags are quantitative
kfino_plot(resuin=resu2,typeG="quanti",
            Tvar="Day",Yvar="Poids",Ident="IDE")

# predictions on OK values
kfino_plot(resuin=resu2,typeG="prediction",
            Tvar="Day",Yvar="Poids",Ident="IDE")

[Package kfino version 1.0.0 Index]