prob_discr_pairwise: Calculates Probability of pairwise discrimination

View source: R/prob_discr_pairwise.R

prob_discr_pairwiseR Documentation

Calculates Probability of pairwise discrimination

Description

Estimates probabilities of correct discrimination (PCDs) between each pair of input/signal values using a logistic regression model.

Usage

prob_discr_pairwise(
  dataRaw,
  signal = "input",
  response = NULL,
  side_variables = NULL,
  formula_string = NULL,
  output_path = NULL,
  scale = TRUE,
  lr_maxit = 1000,
  MaxNWts = 5000,
  diagnostics = TRUE
)

Arguments

dataRaw

must be a data.frame object

signal

is a character object with names of columns of dataRaw to be treated as channel's input.

response

is a character vector with names of columns of dataRaw to be treated as channel's output

side_variables

(optional) is a character vector that indicates side variables' columns of data, if NULL no side variables are included

formula_string

(optional) is a character object that includes a formula syntax to use in logistic regression model. If NULL, a standard additive model of response variables is assumed. Only for advanced users.

output_path

is a directory where a pie chart with calculated probabilities will be saved. If NULL, the graph will not be created.

scale

is a logical indicating if the response variables should be scaled and centered before fitting logistic regression

lr_maxit

is a maximum number of iteration of fitting algorithm of logistic regression. Default is 1000.

MaxNWts

is a maximum acceptable number of weights in logistic regression algorithm. Default is 5000.

diagnostics

is a logical indicating if details of logistic regression fitting should be included in output list

Details

In order to estimate PCDs, for a given pair of input values x_i and x_j, we propose to fit a logistic regression model using response data corresponding to the two considered inputs, i.e. y^l_u, for l\in\{i,j\} and u ranging from 1 to n_l. To ensure that both inputs have equal contribution to the calculated discriminability, equal probabilities should be assigned, P(X) = (P(x_i),P(x_j))=(1/2,1/2). Once the regression model is fitted, probability of assigning a given cellular response, y, to the correct input value is estimated as

\max \{ \hat{P}_{lr}(x_i|Y=y;P(X)), \hat{P}_{lr}(x_j|Y=y;P(X))\}.

Note that P(x_j|Y=y)=1-P(x_i|Y=y) as well as \hat{P}_{lr}(x_j|Y=y;P(X))=1-\hat{P}_{lr}(x_i|Y=y;P(X)) The average of the above probabilities over all observations y^i_l yields PCDs

PCD_{x_i,x_j}=\frac{1}{2}\frac{1}{n_i}\sum_{l=1}^{n_i}\max\{ \hat{P}_{lr}(x_i|Y=y_i^l;P(X)),\hat{P}_{lr}(x_i^l|Y=y;P(X))\} +

\frac{1}{2} \frac{1}{n_j} \sum_{l=1}^{n_j} \max \{ \hat{P}_{lr}(x_i|Y=y_j^l;P(X)), \hat{P}_{lr}(x_j|Y=y_j^l;P(X))\}.

Additional parameters: lr_maxit and maxNWts are the same as in definition of multinom function from nnet package. An alternative model formula (using formula_string arguments) should be provided if data are not suitable for description by logistic regression (recommended only for advanced users). Preliminary scaling of data (argument scale) should be used similarly as in other data-driven approaches, e.g. if response variables are comparable, scaling (scale=FALSE) can be omitted, while if they represent different phenomenon (varying by units and/or magnitude) scaling is recommended.

Value

a list with two elements:

  • output$prob_matr - a n\times n matrix, where n is the number of inputs, with probabilities of correct discrimination between pairs of input values.

  • output$diagnostics - (if diagnostics=TRUE) a list corresponding to logistic regression models fitted for each pair of input values. Each element consists of three sub-elements: 1) nnet_model - nnet object summarising logistic regression model; 2) prob_lr - probabilities of assignment obtained from logistic regression model; 3) confusion_matrix - confusion matrix of classificator.

References

[1] Jetka T, Nienaltowski K, Winarski T, Blonski S, Komorowski M, Information-theoretic analysis of multivariate single-cell signaling responses using SLEMI, PLoS Comput Biol, 15(7): e1007132, 2019, https://doi.org/10.1371/journal.pcbi.1007132.

Examples

## Calculate probabilities of discrimination for nfkb dataset
 it=21 # choose from 0, 3, 6, ..., 120 for measurements at other time points
 output=prob_discr_pairwise(dataRaw=data_nfkb[data_nfkb$signal%in%c("0ng","1ng","100ng"),],
                            signal = "signal",
                           response = paste0("response_",it))


SLEMI documentation built on Nov. 20, 2023, 1:06 a.m.