For several potential reasons, a sample specific percentage of reads from labelled RNA might be lost. This percentage can be estimated from data of this sample and an equivalent 4sU naive control (see details).

## Usage

```
Estimate4sUDropoutPercentage(data, pairs = Findno4sUPairs(data), ...)
Estimate4sUDropoutPercentageForSample(
data,
w4sU,
no4sU,
ntr = w4sU,
LFC.fun = lfc::PsiLFC,
type = c("spearman", "quantreg", "linear", "lowess"),
bootstrap = FALSE
)
```

## Arguments

- data
a grandR object

- pairs
a no4sU pairs list as generated by Findno4sUPairs

- ...
further arguments to be passed to or from other methods.

- w4sU
the name of a 4sU sample

- no4sU
the name(s) of equivalent no4sU sample(s)

- ntr
the name of a sample to take NTRs from (usually equal to w4sU)

- LFC.fun
function to compute log fold change (default: PsiLFC, other viable option: NormLFC)

- type
one of "spearman","quantreg","linear" or "lowess" (see details)

- bootstrap
if TRUE, perform a single bootstrap sample (by drawing genes with replacement)

## Value

the percentage of 4sU dropout for a single sample (Estimate4sUDropoutPercentageForSample) or all samples (Estimate4sUDropoutPercentage)

## Details

The percentage of 4sU dropout is estimated by numerical optimization of the factor f that has to be multiplied with the NTR to mitigate the effect of 4sU dropout. The exact objective function depends on the type parameter:

spearman: f is estimated such that the spearman correlation coefficient of the log2 fold change 4sU/no4sU vs the ntr rank is 0

quantreg: f is estimated such that the slope of a median regression with the the ntr rank as independent variable and the log2 fold change 4sU/no4sU as dependent variable is 0

linear: f is estimated such that the slope of a linear regression with the the ntr rank as independent variable and the log2 fold change 4sU/no4sU as dependent variable is 0

lowess: f is estimated by minimizing the sum-of-squares of the residuals from a lowess regression with the the ntr rank as independent variable and the log2 fold change 4sU/no4sU as dependent variable is 0

Once f is computed the percentage of 4sU dropout is f/(f+1).