weighted_sum_score {WeightMyItems}R Documentation

Calculate Weighted Sum Scores Using the Kılıç & Doğan (2019) Method

Description

This function first weights an item-response matrix using the 'item_weighting' function and then calculates the total (sum) score for each individual.

Usage

weighted_sum_score(x, threshold = 1)

Arguments

x

A numeric data.frame or matrix. Rows should represent individuals, and columns should represent items. The method was designed for dichotomous (0-1) data.

threshold

The threshold value for applying the weighting, passed to the 'item_weighting' function. The article uses a value of 1.

Value

A numeric vector containing the total weighted score for each individual (each row).

Examples

# Generate sample dichotomous data
set.seed(123)
my_data <- as.data.frame(
  matrix(rbinom(200 * 10, 1, 0.6), nrow = 200)
)

# Calculate weighted sum scores
total_scores <- weighted_sum_score(my_data, threshold = 1)

# View the first few scores
cat("--- Weighted Total Scores (Head) ---\n")
print(head(total_scores))

# Compare with simple unweighted scores
unweighted_scores <- rowSums(my_data)
cat("\n--- Unweighted Total Scores (Head) ---\n")
print(head(unweighted_scores))

[Package WeightMyItems version 0.1.4 Index]