Function to weight a pre-calculated score
Arguments
- x
a
QR_matrix
ormQR_matrix
object- pond
the weights to use. Can be an integer, a vector of integers, the name of one of the quality report variables or a list of weights for the
mQR_matrix
objects.
See also
Other QR_matrix functions:
export_xlsx()
,
export_xlsx.QR_matrix()
,
export_xlsx.mQR_matrix()
,
extract_QR()
,
rbind.QR_matrix()
,
sort()
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)
# Compute the score
QR <- compute_score(QR, n_contrib_score = 2)
# Weighted score
QR <- weighted_score(QR, 2)
print(QR)
#> The quality report matrix has 13 observations
#> There are 20 indicators in the modalities matrix and 24 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 score 1_highest_contrib_score 2_highest_contrib_score score_pond
#>
#> The variables exclusively found in the values matrix are:
#> frequency arima_model 1_highest_contrib_score 2_highest_contrib_score
#>
#> The smallest score is 75 and the greatest is 515
#> The average score is 318.462 and its standard deviation is 158.224
#>
#> The following formula was used to calculate the score:
#> 30 * qs_residual_sa_on_sa + 30 * f_residual_sa_on_sa + 20 * qs_residual_sa_on_i + 20 * f_residual_sa_on_i + 30 * f_residual_td_on_sa + 20 * f_residual_td_on_i + 15 * oos_mean + 10 * oos_mse + 15 * residuals_independency + 5 * residuals_homoskedasticity + 5 * residuals_skewness + 5 * m7 + 5 * q_m2
# Extract the weighted score
QR$modalities$score_pond
#> [1] 280 210 560 490 150 480 920 1010 920 1030 600 610 1020