get_optimal_threshold: Get optimal threshold

View source: R/thresholding_algos.R

get_optimal_thresholdR Documentation

Get optimal threshold

Description

Thresholds counts according to the Bayes-optimal decision boundary. When a covariate matrix is present, the decision boundary that is used is the mean of the Bayes-optimal decision boundaries across all examples.

Usage

get_optimal_threshold(
  g_intercept,
  g_perturbation,
  g_fam,
  pi,
  covariate_matrix = NULL,
  g_covariate_coefs = NULL,
  g_offset = NULL
)

Arguments

g_intercept

intercept for gRNA model

g_perturbation

perturbation coefficient for gRNA model

g_fam

family object describing distribution of g

pi

probability of perturbation

covariate_matrix

(optional) matrix of technical covariates

g_covariate_coefs

(optional) coefficients corresponding to technical factors

g_offset

(optional) the offset vector

Value

an integer (0/1) vector of thresholded counts.

Examples

## Not run: 
library(magrittr)
m_fam <- g_fam <- poisson() %>% augment_family_object()
m_intercept <- 2; m_perturbation <- -1; g_intercept <- -2; g_perturbation <- 1
pi <- 0.2; n <- 1000; B <- 500; alpha <- 0.95
m_offset <- g_offset <- NULL
bdy <- get_optimal_threshold(g_intercept, g_perturbation, g_fam, pi)

## End(Not run)

timothy-barry/glmeiv documentation built on Jan. 30, 2024, 3:46 p.m.