Quantcast
Channel: Yet Another Math Programming Consultant
Viewing all articles
Browse latest Browse all 809

Unit Loss Function

$
0
0

A standard normal unit loss function can be described as:

   image

where f(x) is the standard normal density function and F(x) is the standard normal CDF. See: http://planetmath.org/unitnormallossfunction.

Often we want to solve UNL(x)=c for x.

GAMS Version

$ontext

  
Standard Normal Unit Loss Function (UNL)

  
solve UNL(x)=c
  
for a given c

  
Method: solve f(x) - x * (1-F(x)) = c
  
where f is standard normal density function and F is the standard
  
normal CDF.

$offtext


scalar c /0.0331/;

variable x;
equation e;

e..  1/sqrt(2*pi)*exp(-0.5*sqr(x)) - x * (1-errorf(x)) =e= c;

* initial value
x.l = 1;

model m /e/;
solve m using cns;
display x.l;

This solves with CONOPT very quickly, we get:

image

Wolfram Alpha

The input is easy:

image

The output is unfortunately:

image

R

Super easy input, due to predefined functions for normal pdf and cdf. We give an interval of [0,100] to search:

image


Viewing all articles
Browse latest Browse all 809

Trending Articles