prob_discr_pairwise function

Calculates Probability of pairwise discrimination

Calculates Probability of pairwise discrimination

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

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

Returns

a list with two elements:

  • outputprobmatraprob_matr - a n\times nmatrix,wherematrix, wheren$ 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.

Details

In order to estimate PCDs, for a given pair of input values xix_i and xjx_j, we propose to fit a logistic regression model using response data corresponding to the two considered inputs, i.e. yuly^l_u, for l{i,j}l\in\{i,j\} and uu ranging from 1 to nln_l. To ensure that both inputs have equal contribution to the calculated discriminability, equal probabilities should be assigned, P(X)=(P(xi),P(xj))=(1/2,1/2)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, yy, to the correct input value is estimated as

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

Note that P(xjY=y)=1P(xiY=y)P(x_j|Y=y)=1-P(x_i|Y=y) as well as P^lr(xjY=y;P(X))=1P^lr(xiY=y;P(X))\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 yliy^i_l yields PCDs

PCDxi,xj=121nil=1nimax{P^lr(xiY=yil;P(X)),P^lr(xilY=y;P(X))}+ 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))\} + 121njl=1njmax{P^lr(xiY=yjl;P(X)),P^lr(xjY=yjl;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.

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))
  • Maintainer: Tomasz Jetka
  • License: GPL (>= 3)
  • Last published: 2023-11-19