Type: | Package |
Title: | Principal Component Analysis Applied to Ridit Scoring |
Version: | 1.1.0 |
Maintainer: | Robert D. Lieberthal <rlieberthal@gmail.com> |
Description: | Implements the 'PRIDIT' (Principal Component Analysis applied to 'RIDITs') scoring system described in Brockett et al. (2002) <doi:10.1111/1539-6975.00027>. Provides functions for ridit scoring originally developed by Bross (1958) <doi:10.2307/2527727>, calculating 'PRIDIT' weights, and computing final 'PRIDIT' scores for multivariate analysis of ordinal data. |
License: | Apache License (≥ 2) |
URL: | https://github.com/rlieberthal/PRIDIT |
BugReports: | https://github.com/rlieberthal/PRIDIT/issues |
Encoding: | UTF-8 |
LazyData: | true |
Depends: | R (≥ 4.0.0) |
Suggests: | testthat (≥ 3.0.0), knitr, rmarkdown |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
RoxygenNote: | 7.3.2 |
Packaged: | 2025-07-20 18:03:48 UTC; rlieberthal |
Author: | Robert D. Lieberthal [aut, cre] |
Repository: | CRAN |
Date/Publication: | 2025-07-20 18:20:02 UTC |
pridit: Principal Component Analysis Applied to Ridit Scoring
Description
The pridit package provides functions for implementing the PRIDIT (Principal Component Analysis applied to RIDITs) scoring system.
Author(s)
Maintainer: Robert D. Lieberthal rlieberthal@gmail.com
See Also
Useful links:
Calculate the PRIDIT scores for a ridit matrix
Description
This function takes ridit scores and PRIDIT weights to calculate final PRIDIT scores for each observation.
Usage
PRIDITscore(riditscores, id_vector, weightvec)
Arguments
riditscores |
A data frame where the first column represents IDs. The IDs uniquely identify each row in the matrix. The remaining columns contain the ridit scores for each ID. |
id_vector |
A vector of IDs corresponding to the observations. |
weightvec |
A numeric vector of PRIDIT weights (from PRIDITweight function). |
Value
A data frame with two columns: "Claim.ID" containing the IDs and "PRIDITscore" containing the calculated PRIDIT scores (ranging from -1 to 1).
References
Brockett, P. L., Derrig, R. A., Golden, L. L., Levine, A., & Alpert, M. (2002). Fraud classification using principal component analysis of RIDITs. Journal of Risk and Insurance, 69(3), 341-371.
Examples
# Complete workflow example
test_data <- data.frame(
ID = c("A", "B", "C", "D", "E"),
var1 = c(0.9, 0.85, 0.89, 1.0, 0.89),
var2 = c(0.99, 0.92, 0.90, 1.0, 0.93),
var3 = c(1.0, 0.99, 0.98, 1.0, 0.99)
)
# Step 1: Calculate ridit scores
ridit_result <- ridit(test_data)
# Step 2: Calculate PRIDIT weights
weights <- PRIDITweight(ridit_result)
# Step 3: Calculate final PRIDIT scores
final_scores <- PRIDITscore(ridit_result, test_data$ID, weights)
print(final_scores)
Calculate the PRIDIT weights for a ridit matrix
Description
This function takes a ridit-scored matrix and returns PRIDIT weights for each variable as a vector using Principal Component Analysis.
Usage
PRIDITweight(riditscores)
Arguments
riditscores |
A data frame where the first column represents IDs. The IDs uniquely identify each row in the matrix. The remaining columns contain the ridit scores for each ID. |
Value
A numeric vector containing PRIDIT weights for each variable.
References
Brockett, P. L., Derrig, R. A., Golden, L. L., Levine, A., & Alpert, M. (2002). Fraud classification using principal component analysis of RIDITs. Journal of Risk and Insurance, 69(3), 341-371.
Examples
# Create sample data and calculate ridit scores first
test_data <- data.frame(
ID = c("A", "B", "C", "D", "E"),
var1 = c(0.9, 0.85, 0.89, 1.0, 0.89),
var2 = c(0.99, 0.92, 0.90, 1.0, 0.93),
var3 = c(1.0, 0.99, 0.98, 1.0, 0.99)
)
# First calculate ridit scores
ridit_result <- ridit(test_data)
# Then calculate PRIDIT weights
weights <- PRIDITweight(ridit_result)
print(weights)
Calculate the ridit values for a matrix
Description
This function takes a matrix of data and returns the matrix transformed as ridit values using the method developed by Bross (1958) and modified by Brockett et al. (2002).
Usage
ridit(allrawdata)
Arguments
allrawdata |
A data frame where the first column represents IDs. The IDs uniquely identify each row in the matrix. The remaining columns contain the numerical data for each ID. |
Value
A data frame with the first column containing IDs (named "Claim.ID") and the remaining columns containing ridit scores for each variable.
References
Bross, I. D. (1958). How to use ridit analysis. Biometrics, 14(1), 18-38. doi:10.2307/2527727
Brockett, P. L., Derrig, R. A., Golden, L. L., Levine, A., & Alpert, M. (2002). Fraud classification using principal component analysis of RIDITs. Journal of Risk and Insurance, 69(3), 341-371. doi:10.1111/1539-6975.00027
Examples
# Create sample data
test_data <- data.frame(
ID = c("A", "B", "C", "D", "E"),
var1 = c(0.9, 0.85, 0.89, 1.0, 0.89),
var2 = c(0.99, 0.92, 0.90, 1.0, 0.93),
var3 = c(1.0, 0.99, 0.98, 1.0, 0.99)
)
# Calculate ridit scores
ridit_result <- ridit(test_data)
print(ridit_result)
Test dataset for PRIDIT analysis
Description
A sample dataset containing health quality metrics for 5 healthcare providers, used to demonstrate the PRIDIT scoring methodology.
Usage
test
Format
A data frame with 5 rows and 4 variables:
- ID
Character. Unique identifier for each healthcare provider (A through E)
- Smoking_cessation
Numeric. Smoking cessation counseling rate (0.85-1.0)
- ACE_Inhibitor
Numeric. ACE inhibitor prescription rate (0.90-1.0)
- Proper_Antibiotic
Numeric. Proper antibiotic usage rate (0.98-1.0)
Source
Synthetic data created for package examples
Examples
data(test)
head(test)
# Calculate PRIDIT scores
ridit_scores <- ridit(test)
weights <- PRIDITweight(ridit_scores)
final_scores <- PRIDITscore(ridit_scores, test$ID, weights)