# [R] Bi variate minimization problem

BARLAS Marios 247554 Marios.BARLAS at cea.fr
Sat Jan 20 12:20:47 CET 2018

```Dear all,

I'm working on the following problem:

Assume two datasets: Y, Y that represent the same physical quantity Q. Dataset X contains values of Q after an event A while dataset Y contains values of Q after an event B.

In R X, Y are vectors of the same length, containing effectivelly a number of observations of Q in each state.

Q is a continous variable.

Now, the two datasets should ideally not have any range of overlapping values. That is

max(x) << min (Y)

but that is not the reality of the problem. there are usually overlaps, bigger or smaller.

Now, what I want to do is the following:

Suppose that we choose a value P so that.

Any X <= P is understood as belonging to group X while
any Y > P is understood as belonging to group Y.

now any values of X > P or of Y <= P are wrongly understood as belonging to Y nad X effectively.

Hence we have Xerr -- > Sum( X >P) and Yerror --> Sum(Y<=P).

I want to solve this bivariate optimization problem where I want to at the same time minimize the error of X and Y for a given P. Ultimately the target is to optimize the value of P so that the errors of both X and Y are optimized.

Does any1 have some functions in mind that can help with parts of this problem ? It's not impossible to write the algorithm but it will take time and things like convergence and robustness need to be checked.... !