| Title: | An Item Weighting Method for Item Response Matrices |
|---|---|
| Description: | Applies the item weighting method from Kilic & Dogan (2019) <doi:10.21031/epod.516057>. To improve construct validity, this method re-computes scores by utilizing the item discrimination index in conjunction with a condition established upon person ability and item difficulty. |
| Authors: | Abdullah Faruk Kilic [aut, cre] |
| Maintainer: | Abdullah Faruk Kilic <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.4 |
| Built: | 2026-05-21 06:37:36 UTC |
| Source: | https://github.com/cran/WeightMyItems |
This function weights an item-response matrix using the method proposed by Kilic & Dogan (2019). The method is based on adding the item reliability index (corrected item-total correlation) to the original score if the sum of the person's average score and the item's difficulty index exceeds a certain threshold (default is 1).
item_weighting(x, threshold = 1)item_weighting(x, threshold = 1)
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. The article uses a value of 1. |
A new data.frame of the same dimensions with weighted scores.
Kilic, A. F., & Dogan, N. (2019). The effect of item weighting on reliability and validity. Journal of Measurement and Evaluation in Education and Psychology, 10(2), 149-164. DOI: 10.21031/epod.516057
## Example 1: Dichotomous Data (as in the original study) set.seed(123) n_students_dich <- 200 n_items_dich <- 10 dich_data <- as.data.frame( matrix( rbinom(n_students_dich * n_items_dich, 1, 0.6), nrow = n_students_dich ) ) cat("--- Original Dichotomous Data (Head) ---\n") print(head(dich_data)) weighted_dich <- item_weighting(dich_data) cat("\n--- Weighted Dichotomous Data (Head) ---\n") print(head(weighted_dich)) ## Example 2: 5-Point Likert-Type Data # Note: The function was designed for 0-1 data. With Likert data, # the person's average score will likely be > 1, causing the weighting # condition to be met for almost all responses. set.seed(456) n_students_likert <- 150 n_items_likert <- 15 likert_data <- as.data.frame( matrix( sample(1:5, size = n_students_likert * n_items_likert, replace = TRUE), nrow = n_students_likert ) ) cat("\n--- Original 5-Point Likert Data (Head) ---\n") print(head(likert_data)) weighted_likert <- item_weighting(likert_data) cat("\n--- Weighted 5-Point Likert Data (Head) ---\n") print(head(weighted_likert))## Example 1: Dichotomous Data (as in the original study) set.seed(123) n_students_dich <- 200 n_items_dich <- 10 dich_data <- as.data.frame( matrix( rbinom(n_students_dich * n_items_dich, 1, 0.6), nrow = n_students_dich ) ) cat("--- Original Dichotomous Data (Head) ---\n") print(head(dich_data)) weighted_dich <- item_weighting(dich_data) cat("\n--- Weighted Dichotomous Data (Head) ---\n") print(head(weighted_dich)) ## Example 2: 5-Point Likert-Type Data # Note: The function was designed for 0-1 data. With Likert data, # the person's average score will likely be > 1, causing the weighting # condition to be met for almost all responses. set.seed(456) n_students_likert <- 150 n_items_likert <- 15 likert_data <- as.data.frame( matrix( sample(1:5, size = n_students_likert * n_items_likert, replace = TRUE), nrow = n_students_likert ) ) cat("\n--- Original 5-Point Likert Data (Head) ---\n") print(head(likert_data)) weighted_likert <- item_weighting(likert_data) cat("\n--- Weighted 5-Point Likert Data (Head) ---\n") print(head(weighted_likert))
This function first weights an item-response matrix using the 'item_weighting' function and then calculates the mean score for each individual.
weighted_mean_score(x, threshold = 1)weighted_mean_score(x, threshold = 1)
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. |
A numeric vector containing the weighted mean score for each individual (each row).
# Generate sample dichotomous data set.seed(123) my_data <- as.data.frame( matrix(rbinom(200 * 10, 1, 0.6), nrow = 200) ) # Calculate weighted mean scores mean_scores <- weighted_mean_score(my_data, threshold = 1) # View the first few mean scores cat("--- Weighted Mean Scores (Head) ---\n") print(head(mean_scores)) # Compare with simple unweighted mean scores unweighted_means <- rowMeans(my_data) cat("\n--- Unweighted Mean Scores (Head) ---\n") print(head(unweighted_means))# Generate sample dichotomous data set.seed(123) my_data <- as.data.frame( matrix(rbinom(200 * 10, 1, 0.6), nrow = 200) ) # Calculate weighted mean scores mean_scores <- weighted_mean_score(my_data, threshold = 1) # View the first few mean scores cat("--- Weighted Mean Scores (Head) ---\n") print(head(mean_scores)) # Compare with simple unweighted mean scores unweighted_means <- rowMeans(my_data) cat("\n--- Unweighted Mean Scores (Head) ---\n") print(head(unweighted_means))
This function first weights an item-response matrix using the 'item_weighting' function and then calculates the total (sum) score for each individual.
weighted_sum_score(x, threshold = 1)weighted_sum_score(x, threshold = 1)
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. |
A numeric vector containing the total weighted score for each individual (each row).
# 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))# 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))