get_weights
returns the weights for constructing the composite indicator.
Arguments
- data
data matrix of binary elementary indicators (without missing values).
- method
method for getting the set of weights. Possible choices are:
"equal"
,"experts"
or"irt"
. See Details.- expert_weights
user-provided expert weights (if any).
- ...
optional arguments for
mirt::mirt()
function. See Details.
Details
This function returns a vector of weights, whose dimension is equal to the
number of elementary indicators in data
(say, \(Q\)). Three choices are offered:
"equal"
: each elementary indicator receives the same weight, equal to \(1/Q\);"experts"
: each elementary indicator receives a specific weight provided by experts. The user can provide the weights provided by his/her own experts (through argumentexpert_weights
), otherwise the weights provided by our pool of experts is used;"irt"
: each elementary indicator receives a specific weights provided by the IRT framework.
Specifically, a unidimensional 2PL IRT model is estimated on data
through mirt::mirt()
function,
for which possible additional arguments can be provided (...
), such as estimation algorithm,
numerical optimiser, convergence threshold, etc. Once the model is fitted, weights are computed
by rescaling the estimated discrimination parameters (in such a way they sum to 1).
Note: for the moment, IRT weights can be obtained only when the elementary indicators are all binary.
Examples
if (FALSE) {
if (interactive()) {
# sample of 100k contracts
set.seed(12345)
i <- sample(1:nrow(mock_data_core), size = 1e5)
mock_sample0 <- mock_data_core[sort(i), ]
# indicators for companies
mock_sample <- tidyr::unnest(mock_sample0, aggiudicatari, keep_empty = TRUE)
mock_sample_variants <- tidyr::unnest(mock_sample, varianti, keep_empty = TRUE)
out_companies <- ind_all(
data = mock_sample,
data_ind8 = mock_sample_variants,
emergency_name = "coronavirus",
target_unit = "companies"
)
indicator_data_matrix <- create_indicator_matrix(out_companies)
w <- get_weights(indicator_data_matrix, method = "equal")
w
w <- get_weights(indicator_data_matrix, method = "experts")
w
}
}