To extract a quality report from the csv file containing the diagnostics matrix.
Usage
extract_QR(file, x, thresholds = getOption("jdc_thresholds"), ...)Arguments
- file
the csv file containing the diagnostics matrix. This argument supersedes the argument
matrix_output_file.- x
data.frame containing the diagnostics matrix.
- thresholds
listof numerical vectors. Thresholds applied to the various tests in order to classify into modalitiesGood,Uncertain,BadandSevere. By default, the value of the"jdc_threshold"option is used. You can call theget_thresholdsfunction to see what thethresholdsobject should look like.- ...
Other paramemeter to pass to
read_demetra_msuch assep(the separator used in the csv file. By default,sep = ";") anddec(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, adata.framecontaining several indicators and their categorical quality (Good, Uncertain, Bad, Severe).values, adata.framecontaining 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_formulathat will store the formula used to calculate the score (when relevant). Its initial value isNULL.
If x is supplied, the file and matrix_output_file
arguments are ignored. The file argument also designates the path to
the file containing the diagnostic matrix (which can be imported into R in
parallel and used with the x argument).
See also
Other QR_matrix functions:
rbind.QR_matrix(),
sort,
weighted_score(),
write(),
write.JVS_matrix(),
write.QR_matrix(),
write.mQR_matrix()
Examples
# Path of matrix demetra_m
demetra_path <- file.path(
system.file("extdata", package = "JDCruncheR"),
"WS/WS_world/Output/SAProcessing-1",
"demetra_m.csv"
)
# Extract the quality report from the demetra_m file
QR <- extract_QR(file = demetra_path)
#> Multiple column found for extraction of diagnostics.seas-i-qs:2, diagnostics.seas-i-qs
#> Last column selected
#> Multiple column found for extraction of diagnostics.seas-i-f:2, diagnostics.seas-i-f
#> Last column selected
print(QR)
#> The quality report matrix has 6 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 residuals_homoskedasticity residuals_skewness residuals_kurtosis residuals_normality residuals_independency qs_residual_s_on_sa f_residual_s_on_sa qs_residual_sa_on_i f_residual_sa_on_i f_residual_td_on_sa f_residual_td_on_i oos_mean oos_mse q q_m2 m7 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 residuals_homoskedasticity residuals_skewness
#> 1 Siachen Glacier (frozen) Good Good
#> 2 Nagorno-Karabakh (frozen) Good Good
#> 3 Mongolia (frozen) Good Good
#> 4 India (frozen) Good Good
#> 5 Nepal (frozen) Uncertain Uncertain
#> 6 Philippines (frozen) Uncertain Good
#> residuals_kurtosis residuals_normality residuals_independency
#> 1 Good Good Good
#> 2 Good Good Good
#> 3 Good Good Bad
#> 4 Good Good Uncertain
#> 5 Good Good Good
#> 6 Good Good Uncertain
#> qs_residual_s_on_sa f_residual_s_on_sa qs_residual_sa_on_i f_residual_sa_on_i
#> 1 Good Good Good Good
#> 2 Good Good Good Good
#> 3 Severe Good Good Good
#> 4 Good Good Good Good
#> 5 Good Good Good Good
#> 6 Good Good Good Good
#> f_residual_td_on_sa f_residual_td_on_i oos_mean oos_mse q q_m2 m7
#> 1 Good Good Good Good Good Good Good
#> 2 Good Good Good Good Good Good Good
#> 3 Good Good Good Good Good Good Good
#> 4 Good Good Good Good Good Good Good
#> 5 Good Good Good Good Good Good Good
#> 6 Good Uncertain Good Good Good Good Good
#> pct_outliers
#> 1 Bad
#> 2 Bad
#> 3 Good
#> 4 Bad
#> 5 Bad
#> 6 Uncertain
# Or:
QR[["modalities"]]
#> series residuals_homoskedasticity residuals_skewness
#> 1 Siachen Glacier (frozen) Good Good
#> 2 Nagorno-Karabakh (frozen) Good Good
#> 3 Mongolia (frozen) Good Good
#> 4 India (frozen) Good Good
#> 5 Nepal (frozen) Uncertain Uncertain
#> 6 Philippines (frozen) Uncertain Good
#> residuals_kurtosis residuals_normality residuals_independency
#> 1 Good Good Good
#> 2 Good Good Good
#> 3 Good Good Bad
#> 4 Good Good Uncertain
#> 5 Good Good Good
#> 6 Good Good Uncertain
#> qs_residual_s_on_sa f_residual_s_on_sa qs_residual_sa_on_i f_residual_sa_on_i
#> 1 Good Good Good Good
#> 2 Good Good Good Good
#> 3 Severe Good Good Good
#> 4 Good Good Good Good
#> 5 Good Good Good Good
#> 6 Good Good Good Good
#> f_residual_td_on_sa f_residual_td_on_i oos_mean oos_mse q q_m2 m7
#> 1 Good Good Good Good Good Good Good
#> 2 Good Good Good Good Good Good Good
#> 3 Good Good Good Good Good Good Good
#> 4 Good Good Good Good Good Good Good
#> 5 Good Good Good Good Good Good Good
#> 6 Good Uncertain Good Good Good Good Good
#> pct_outliers
#> 1 Bad
#> 2 Bad
#> 3 Good
#> 4 Bad
#> 5 Bad
#> 6 Uncertain