Skip to contents

To extract a quality report from the csv file containing the diagnostics matrix.

Usage

extract_QR(matrix_output_file, sep = ";", dec = ",")

Arguments

matrix_output_file

the csv file containing the diagnostics matrix.

sep

the separator used in the csv file (by default, sep = ";")

dec

the decimal separator used in the csv file (by default, dec = ",")

Value

a QR_matrix object.

Details

This function generates a quality report from a csv file containing diagnostics (usually from the file demetra_m.csv). The demetra_m.csv file can be generated by launching the cruncher (functions cruncher or cruncher_and_param) with the default export parameters, having used the default option csv_layout = "vtable" to format the output tables of the functions cruncher_and_param and create_param_file when creating the parameters file.

This function returns a QR_matrix object, which is a list of 3 objects:

  • modalities, a data.frame containing several indicators and their categorical quality (Good, Uncertain, Bad, Severe).

  • values, a data.frame containing the same indicators and the values that lead to their quality category (i.e.: p-values, statistics, etc.) as well as additional variables that don't have a modality/quality (series frequency and arima model).

  • score_formula that will store the formula used to calculate the score (when relevant). Its initial value is NULL.

Examples

# Path of matrix demetra_m
demetra_path <- file.path(
    system.file("extdata", package = "JDCruncheR"),
    "WS/ws_ipi/Output/SAProcessing-1",
    "demetra_m.csv"
)

# Extract the quality report from the demetra_m file
QR <- extract_QR(demetra_path)

print(QR)
#> The quality report matrix has 13 observations
#> There are 18 indicators in the modalities matrix and 20 indicators in the values matrix
#> 
#> The quality report matrix contains the following variables:
#> series  qs_residual_sa_on_sa  f_residual_sa_on_sa  qs_residual_sa_on_i  f_residual_sa_on_i  f_residual_td_on_sa  f_residual_td_on_i  residuals_independency  residuals_normality  residuals_homoskedasticity  residuals_skewness  residuals_kurtosis  oos_mean  oos_mse  m7  q  q_m2  pct_outliers  frequency  arima_model
#> 
#> The variables exclusively found in the values matrix are:
#> frequency  arima_model
#> 
#> No score was calculated

# Extract the modalities matrix:
QR$modalities
#>    series qs_residual_sa_on_sa f_residual_sa_on_sa qs_residual_sa_on_i
#> 1  RF0610                 Good                Good                Good
#> 2  RF0620                 Good                Good                Good
#> 3  RF0811                 Good                Good                Good
#> 4  RF0812                 Good                Good                Good
#> 5  RF0893                 Good                Good                Good
#> 6  RF0899                 Good                Good                Good
#> 7  RF1011               Severe                Good              Severe
#> 8  RF1012               Severe                Good              Severe
#> 9  RF1013                  Bad                Good           Uncertain
#> 10 RF1020               Severe                Good              Severe
#> 11 RF1031                  Bad                Good                 Bad
#> 12 RF1032                 Good                Good                Good
#> 13 RF1039               Severe                Good              Severe
#>    f_residual_sa_on_i f_residual_td_on_sa f_residual_td_on_i
#> 1                Good                 Bad          Uncertain
#> 2                Good                Good               Good
#> 3                Good              Severe                Bad
#> 4                Good              Severe             Severe
#> 5                Good                Good               Good
#> 6                Good                 Bad                Bad
#> 7                Good              Severe             Severe
#> 8                Good              Severe             Severe
#> 9                Good              Severe             Severe
#> 10               Good              Severe             Severe
#> 11               Good           Uncertain          Uncertain
#> 12               Good              Severe             Severe
#> 13               Good              Severe             Severe
#>    residuals_independency residuals_normality residuals_homoskedasticity
#> 1                    Good                Good                       Good
#> 2                    Good                 Bad                        Bad
#> 3                     Bad                 Bad                        Bad
#> 4                     Bad                Good                       Good
#> 5               Uncertain                Good                       Good
#> 6                     Bad                Good                       Good
#> 7                     Bad                Good                       Good
#> 8                     Bad                Good                       Good
#> 9                     Bad                 Bad                        Bad
#> 10                    Bad           Uncertain                       Good
#> 11                    Bad                 Bad                  Uncertain
#> 12                    Bad                Good                       Good
#> 13                    Bad                 Bad                  Uncertain
#>    residuals_skewness residuals_kurtosis  oos_mean   oos_mse   m7    q q_m2
#> 1                Good               Good      Good       Bad Good Good Good
#> 2                 Bad                Bad       Bad       Bad Good Good Good
#> 3                 Bad                Bad      Good Uncertain Good  Bad  Bad
#> 4                Good               Good      Good      Good Good Good Good
#> 5                Good               Good       Bad      Good Good  Bad  Bad
#> 6                Good               Good       Bad      Good Good Good Good
#> 7                Good               Good      Good      Good Good  Bad  Bad
#> 8                Good               Good       Bad      Good Good  Bad  Bad
#> 9                 Bad                Bad       Bad      Good  Bad  Bad  Bad
#> 10               Good               Good       Bad Uncertain Good Good  Bad
#> 11          Uncertain          Uncertain Uncertain       Bad Good Good Good
#> 12               Good               Good       Bad      Good Good  Bad  Bad
#> 13          Uncertain          Uncertain       Bad Uncertain Good Good Good
#>    pct_outliers
#> 1     Uncertain
#> 2           Bad
#> 3          Good
#> 4          Good
#> 5          Good
#> 6          Good
#> 7          Good
#> 8          Good
#> 9          Good
#> 10         Good
#> 11    Uncertain
#> 12         Good
#> 13         Good
# Or:
QR[["modalities"]]
#>    series qs_residual_sa_on_sa f_residual_sa_on_sa qs_residual_sa_on_i
#> 1  RF0610                 Good                Good                Good
#> 2  RF0620                 Good                Good                Good
#> 3  RF0811                 Good                Good                Good
#> 4  RF0812                 Good                Good                Good
#> 5  RF0893                 Good                Good                Good
#> 6  RF0899                 Good                Good                Good
#> 7  RF1011               Severe                Good              Severe
#> 8  RF1012               Severe                Good              Severe
#> 9  RF1013                  Bad                Good           Uncertain
#> 10 RF1020               Severe                Good              Severe
#> 11 RF1031                  Bad                Good                 Bad
#> 12 RF1032                 Good                Good                Good
#> 13 RF1039               Severe                Good              Severe
#>    f_residual_sa_on_i f_residual_td_on_sa f_residual_td_on_i
#> 1                Good                 Bad          Uncertain
#> 2                Good                Good               Good
#> 3                Good              Severe                Bad
#> 4                Good              Severe             Severe
#> 5                Good                Good               Good
#> 6                Good                 Bad                Bad
#> 7                Good              Severe             Severe
#> 8                Good              Severe             Severe
#> 9                Good              Severe             Severe
#> 10               Good              Severe             Severe
#> 11               Good           Uncertain          Uncertain
#> 12               Good              Severe             Severe
#> 13               Good              Severe             Severe
#>    residuals_independency residuals_normality residuals_homoskedasticity
#> 1                    Good                Good                       Good
#> 2                    Good                 Bad                        Bad
#> 3                     Bad                 Bad                        Bad
#> 4                     Bad                Good                       Good
#> 5               Uncertain                Good                       Good
#> 6                     Bad                Good                       Good
#> 7                     Bad                Good                       Good
#> 8                     Bad                Good                       Good
#> 9                     Bad                 Bad                        Bad
#> 10                    Bad           Uncertain                       Good
#> 11                    Bad                 Bad                  Uncertain
#> 12                    Bad                Good                       Good
#> 13                    Bad                 Bad                  Uncertain
#>    residuals_skewness residuals_kurtosis  oos_mean   oos_mse   m7    q q_m2
#> 1                Good               Good      Good       Bad Good Good Good
#> 2                 Bad                Bad       Bad       Bad Good Good Good
#> 3                 Bad                Bad      Good Uncertain Good  Bad  Bad
#> 4                Good               Good      Good      Good Good Good Good
#> 5                Good               Good       Bad      Good Good  Bad  Bad
#> 6                Good               Good       Bad      Good Good Good Good
#> 7                Good               Good      Good      Good Good  Bad  Bad
#> 8                Good               Good       Bad      Good Good  Bad  Bad
#> 9                 Bad                Bad       Bad      Good  Bad  Bad  Bad
#> 10               Good               Good       Bad Uncertain Good Good  Bad
#> 11          Uncertain          Uncertain Uncertain       Bad Good Good Good
#> 12               Good               Good       Bad      Good Good  Bad  Bad
#> 13          Uncertain          Uncertain       Bad Uncertain Good Good Good
#>    pct_outliers
#> 1     Uncertain
#> 2           Bad
#> 3          Good
#> 4          Good
#> 5          Good
#> 6          Good
#> 7          Good
#> 8          Good
#> 9          Good
#> 10         Good
#> 11    Uncertain
#> 12         Good
#> 13         Good