staple_multi_mat: STAPLE on Multi-class matrix

Description Usage Arguments Value Examples

View source: R/staple_multi_mat.R

Description

STAPLE on Multi-class matrix

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
staple_multi_mat(
  x,
  sens_init = 0.99999,
  spec_init = 0.99999,
  max_iter = 10000,
  tol = .Machine$double.eps,
  prior = "mean",
  verbose = TRUE,
  trace = 25,
  ties.method = c("first", "random", "last"),
  drop_all_same = FALSE
)

Arguments

x

a nxr matrix where there are n raters and r elements rated

sens_init

Initialize matrix for sensitivity (p)

spec_init

Initialize matrix for specificity (q)

max_iter

Maximum number of iterations to run

tol

Tolerance for convergence

prior

Either "mean" or a matrix of prior probabilities,

verbose

print diagnostic messages

trace

Number for modulus to print out verbose iterations

ties.method

Method passed to max.col for hard segmentation

drop_all_same

drop all records where they are all the same. DO NOT use in practice, only for validation of past results

Value

List of matrix output sensitivities, specificities, and matrix of probabilities

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
rm(list = ls())
x = matrix(rbinom(5000, size = 5, prob = 0.5), ncol = 1000)
  sens_init = 0.99999
  spec_init = 0.99999
  max_iter = 10000
  tol = .Machine$double.eps
  prior = "mean"
  verbose = TRUE
  trace = 25
  ties.method = "first"

res = staple_multi_mat(x)
xx = rbind(colMeans(x >= 2) > 0.5, colMeans(x >= 2) >= 0.5)
res = staple_multi_mat(xx, prior = rep(0.5, 1000))
res_bin = staple_bin_mat(xx, prior = rep(0.5, 1000))
testthat::expect_equal(res$sensitivity[,"1"], res_bin$sensitivity)

muschellij2/stapler documentation built on May 17, 2020, 3:39 a.m.