MyNixOS website logo
Description

Optimized Integer Risk Score Models.

Implements an optimized approach to learning risk score models, where sparsity and integer constraints are integrated into the model-fitting process.

riskscores

CRANstatus

Risk scores are sparse linear models that map an integer linear combination of covariates to the probability of an outcome occurring. Unlike regression models, risk score models consist of integer coefficients for often dichotomous variables. This allows risk score predictions to be easily computed by adding or subtracting a few small numbers.

Risk scores developed heuristically by altering logistic regression models have decreased performance, as there is a fundamental trade-off between the model’s simplicity and its predictive accuracy. In contrast, this package presents an optimization approach to learning risk scores, where the constraints for sparsity and integer coefficients are integrated into the model-fitting process, rather than implemented afterward.

Installation

You can install the development version of riskscores from GitHub with:

# install.packages("devtools")
devtools::install_github("hjeglinton/riskscores", build_vignettes = TRUE)

Example

We’ll fit a risk score model to predict breast cancer from biopsy data. More details can be found in the package’s vignette.

library(riskscores)

# Prepare data
y <- breastcancer[,1]
X <- as.matrix(breastcancer[,-1])

# Fit risk score model 
mod <- risk_mod(X, y, lambda0 = 0.058)

The integer risk score model can be viewed by calling mod$model_card. An individual’s risk score can be calculated by multiplying each covariate response by its respective number of points and then adding all points together. In our example below, a patient with a ClumpThickness value of 1, a BareNuclei value of 5, and a BlandChromatin value of 10 would receive a score of $10(1) + 7(5) + 8(10) = 125$.

Points
ClumpThickness10
BareNuclei7
BlandChromatin8

Each score can then be mapped to a risk probability. The mod$score_map dataframe maps an integer range of scores to their associated risk. We can see that a patient who received a score of 125 would have a 77.9% risk of their tissue sample being malignant.

ScoreRisk
250.0006
500.0054
750.0446
1000.2886
1250.7788
1500.9683
1750.9962
2000.9996
Metadata

Version

1.1.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows