# Sortostat/Optimal sorting cutoffs

## Contents

## Problem

What is the optimal cut-off percentile for choosing a chamber to be sorted if you have N sorts (trials) remaining until you must take the sort to preserve a constant dilution rate?

## Analytical Solution

### Definition of variables

**Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle \emph E[X_N] = }**
expected value of the optimal percentage that can be returned from N trials

**Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle \emph S_i = }**
random variable representing the percentile returned from the ith trial

- all trials are assumed to be independent therefore
**Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle \emph S_i = S}**, for all i

**Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle \emph C_i = }**
the cut-off percentile for the ith trial.

### General

**Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle \emph E[X_N] = P(S>C_1) E[S|S>C_1] + }**

**Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle \emph (1-P(S>C_1))(P(S>C_2)E[S|S>C_2]) + }**

**Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle \emph (1-P(S>C_1))(1-P(S>C_2))(P(S>C_3)E[S|S>C_2]) + }**

**Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle \emph ... }**

**Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle \emph (1-P(S>C_1))(1-P(S>C_2))...(1-P(S>C_{N-1})E[S_N] }**

### Simplified

Since **Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle \emph (1-P(S>C_1))}**
can be factored out of every term after the first above, the solution can be simplified and solved recursively:

**Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle \emph E[X_N] = P(S>C_N) E[S|S>C_N] + (1-P(S>C_N))E[X_{N-1}]}**

base case:

**Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://api.formulasearchengine.com/v1/":): {\displaystyle \emph E[X_1] = \int_0^\infty P(S)*S dS}**

- e.g., if you have only 1 trial then you expect to get the mean of the distribution for S.

## Simulation Solution

Since our probability skills were pretty sad, we (Alex Mallet) simulated it to confirm our analytical results. MATLAB file can be found here.