30
Introduction Conjugate gradient Use of determinants Proof of the determinant theory and criteria for adopting a new direction Unexplained complex Powell’s conditions for inclusion of a new direction Error in source code and in Intel C-compiler Conclusion References IMaCH is proposing to measure Health Expectancy with one index REVES 2015. Singapore Nicolas Brouard Christopher Heathcote National Institute for Demographic Studies (INED) and Austalian National University (ANU) REVES Singapore, 3 June 2015 N. Brouard/Ch. Heathcote IMaCh’s index

IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

  • Upload
    others

  • View
    18

  • Download
    0

Embed Size (px)

Citation preview

Page 1: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

IMaCH is proposing to measure HealthExpectancy with one index

REVES 2015. Singapore

Nicolas Brouard Christopher Heathcote

National Institute for Demographic Studies (INED) and Austalian National University (ANU)

REVES Singapore, 3 June 2015

N. Brouard/Ch. Heathcote IMaCh’s index

Page 2: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

IntroductionBack to the mid 90’sMaximum Likelihood surface

Conjugate gradientConjugate gradient methodExample in two dimensionsAlgorithm of conjugate gradient and limits

Powell’s theorem on maximal determinant and benefit in optimizationPowells method maximizing the determinants of different sets ofdirections

Proof of the determinant theory and criteria for adopting a new directionExample of Powell’s conjugate/determinant method

Unexplained complex Powell’s conditions for inclusion of a new directionPowell’s strange conditions

Error in source code and in Intel C-compilerError in C-code with Intel C-compilerError in original bracketing function of NRC libraryWhat consequences of the NRC library error on IMaCh results?

Conclusion N. Brouard/Ch. Heathcote IMaCh’s index

Page 3: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Back to the mid 90’sMaximum Likelihood surface

IMaCh, for Interpolated Markov Chain, is a software which provides periodHealth Expectancy (HE) estimated from a cross-longitudinal survey.Information required is only the age and status (Healthy, Unhealthy or Death)at each interview. Such data are now available in a few countries includingAsian countries. HEs can be estimated by socio-economic status includingcovariates or different health statuses. The main current difficulty inherent toHE computed from transitions between health statuses resides in thecomputation itself. Because of different time exposures between successiveinterviews, the program maximises the likelihood of the sample based on amultinomial logistic model of a monthly transition probability (Lièvre et al.,2003).

N. Brouard/Ch. Heathcote IMaCh’s index

Page 4: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Back to the mid 90’sMaximum Likelihood surface

Convergence itself and time to convergence are crucial. In recent versionsof IMaCh various algorithms as well as various implementations of thesealgorithms are explored. The quickest method used so far was analgorithm of M.J.D. Powell published in 1964 (Powell, 1964) andimplemented via the Numerical Recipes in C library (Press et al., 1992).

N. Brouard/Ch. Heathcote IMaCh’s index

Page 5: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Back to the mid 90’sMaximum Likelihood surface

But compiled versions using the Intel C compiler in order to run efficientlyon recent Windows 64-bit, gave more accurate results than the traditionalGNU C compiler used so far. Investigations showed that NRC test forstopping iterations was inadequate as well as Powell’s criteria (whichseems to have never be clearly understood) is over defined. These twoerrors might explain why, sometimes, convergence could not be reachedwith a monthly transition but did converge with an annual transitionmodel. About 40 years later, M.J.D. Powell published a series of newalgorithms named NEWUOA (Powell, 2006) and BOBYQUA (Powell,2002) with their corresponding “public domain” Fortran code.

N. Brouard/Ch. Heathcote IMaCh’s index

Page 6: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Back to the mid 90’sMaximum Likelihood surface

These new algorithms are claimed (Rios and Sahinidis, 2013) to be moreadapted to maximization of function with hundred of variables which isthe case when covariates and health statuses are numerous. Thecomparison doesn’t include Powell’s determinant/conjugate gradientmethods because no software, except NRC, is available. The GNUsoftware library (GSL) doesn’t implement this Powell algorithm but a fewothers which are unfortunately 5 times slower.

N. Brouard/Ch. Heathcote IMaCh’s index

Page 7: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Back to the mid 90’sMaximum Likelihood surface

If there is only one scientific publication on the statistical method and onthe period Health Expectancy index produced by the program, there wasno presentation of the algorithm which are used by this program.Probably more than 30 scientific publications produced results from thisprogram. Fiona Matthews, Vikki O’Neill, Carol Jagger and Pia Wohlandpresented at the last REVES meeting in Edinburgh a Comparison ofmethods and programs for calculating health life expectancies, andIMaCh competed well.In the early 90’s when we designed with Agnès Lièvre and ChristopherHeathcote (ANU) the program we wanted to avoid to reinvent the wheeland to trust specialists in Optimization computing, using a very efficientalgorithm and a well known, ready to use, package; today we have toreconsider both decisions.

N. Brouard/Ch. Heathcote IMaCh’s index

Page 8: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Back to the mid 90’sMaximum Likelihood surface

I IMaCH software: one single publication focusing on the statisticaland demographical method to compute on single index from across-longitudinal survey (Lièvre et al., 2003);

I but no publication on the algorithms used; optimization was not ourjob. . .

I but the job of famous mathematicians specialized in algorithms likeMJD Powell (Powell, 1964);

I also, do not reinvent the wheel: use a famous scientific library (Presset al., 1992);

I But could we trust them? The hidden face and burden of computersoftwares.

N. Brouard/Ch. Heathcote IMaCh’s index

Page 9: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Back to the mid 90’sMaximum Likelihood surface

Maximum Likelihood Estimatorsconsist in finding the maximum ofmultivariable function. Here is anexample of minimizing a functionof two parameters, like mean andstandard deviation. Importance ofcontour maps in the theory ofoptimization.

-2 -1 0 1 2 3 4 5 6

-6

-4

-2

0

2

4

6

0

50

100

150

200

250

x

y

N. Brouard/Ch. Heathcote IMaCh’s index

Page 10: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Conjugate gradient methodExample in 2DAlgorithm of conjugate gradient and limits

We can deduce the gradient atpoint X as the sum of the twovectors ∇f (P), the gradient of fat P and the Hessian matrix HX .

f (X ) = f (P)+ ∇f (x)TX + 12X

tHX + · · ·∇f (X ) = ∇f (P)+H(P)X

Minimum of the function issearched.

N. Brouard/Ch. Heathcote IMaCh’s index

Page 11: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Conjugate gradient methodExample in 2DAlgorithm of conjugate gradient and limits

If p is the extremum then∇f (p) = 0 and at any point x ,∇f (x) = H(p)x

N. Brouard/Ch. Heathcote IMaCh’s index

Page 12: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Conjugate gradient methodExample in 2DAlgorithm of conjugate gradient and limits

From minimum in direction v ,how to find a direction u suchthat any point of u is still aminimum in direction v : v and uare conjugate.

N. Brouard/Ch. Heathcote IMaCh’s index

Page 13: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Conjugate gradient methodExample in 2DAlgorithm of conjugate gradient and limits

Finding the conjugate u of v :from minimum v take randomdirections w up to (random) x1,minimize in direction v and findx2; u is direction (x2 - x).

N. Brouard/Ch. Heathcote IMaCh’s index

Page 14: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Conjugate gradient methodExample in 2DAlgorithm of conjugate gradient and limits

From an initial randompoint P0 and two randomor canonical directions ξ1and ξ2, find P1, P2 andP(1)0 at iteration 1 and

the extremum P(2)0 at

second and last iteration.

N. Brouard/Ch. Heathcote IMaCh’s index

Page 15: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Conjugate gradient methodExample in 2DAlgorithm of conjugate gradient and limits

Data: Conjugate gradientsResult: Minimum of a function ftake n directions ξr and a point P0;while For each r = 1,n do

calculate λr which minimizes minλr f (Pr−1 + λr ξr );

and set point Pr = Pr−1 + λr ξr ;endwhile For each r = 1,n−1 do

set ξr−1 = ξrendReplace ξn = Pn −P0 ;Minimize Pn + λ(Pn −P0);Set new P0 = Pn + λminξn (error in Powell: was P0 = P0 + λminξn) Goback to the beginning of current section with a new PO and new set ofrotated ξi : ξ1 is dropped and new ξn is old Pn −P0;

Algorithm 1: Powell conjugated gradientsalgorithm

But this simple algorithm doesn’t behavesatisfactorily when dimension are biggerthan 5 Powell (1964) because the newdirection might tend to be colinear toanother direction and the maximum be ina space of lower dimensions and not anextremum.And thus sometimes it can be betterNOT to use direction Pn−P0 but to keepthe set of directions of previous iteration.

N. Brouard/Ch. Heathcote IMaCh’s index

Page 16: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Powells method maximizing the determinants of different sets of directions

Powell’s theorem on maximal determinant of A-normeddirections

The determinant of twoA-normed (A = 1

2H)directions reaches amaximum when bothdirections are conjugated

N. Brouard/Ch. Heathcote IMaCh’s index

Page 17: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Powells method maximizing the determinants of different sets of directions

Powells method with evaluation of the determinantThe brilliant idea of Powell consists in exploiting this property and proving thatthe inclusion of the direction P0 −Pn should be accepted only if the newdirection improves the ‘conjugation’ of the n directions, that is correspond to anincrease of the determinant of the new set compared to the determinant of theformer set. The new direction p0 −pn is a linear combination of each direction(p0 −p1), (p1 −p2) which also corresponds to a decrease of the function∆1 = f (p1)− f ((p0), ∆2 = f (p2)− f ((p1). It can be seen that if we useA-normed vectors for each direction, each decrease is exactly the square of thecoordinate αi :

f (p2)− f (p1) = ∆i = (α1ξ1)T A(α1ξ1) = α21 ||ξ1 ||A

pn −p0 = α1ξ1 + α2ξ2 + · · ·+ αi ξi + · · ·+ αnξn = µξ

det(ξ1 ,ξ2 , . . . ,ξi−1 ,ξp ,ξi , . . . ,ξn) =αiµ

det(ξ1 ,ξ2 , . . . ,ξi , . . . ,ξn)

maxi=1,n

αi ≥ µ .

Also the estimation of the minimum of the function in the direction p0 −pn iscostly and might be not necessary but only the curvature of the function in orderto get the A-normed value of its direction (named ξp ). In fact only its length µ

is needed: ||p0 −pn ||= µ||ξp ||A .In order to estimate the curvature, the function is estimated at pointf (p0 +2(pn −p0)) because the parabola is unique and the second derivative canbe obtained. In summary the criteria FOR inclusion is simply:

maxi=1,n

{f (pi−1)− f (pi )}= ∆ > µ =f (p0)−2f (pn) + f (p0 +2(pn −p0))

2 (1)

p0 pn pp

µ~ξp µmin~ξp

x1 x2 xm

f(p0) = f1

Parabola fp

Real function f

x3

f2

f3

fs

p0 + 2(pn − p0)

N. Brouard/Ch. Heathcote IMaCh’s index

Page 18: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Powells method maximizing the determinants of different sets of directions

In the example shown, if ξ is replacing e1 atnext iteration, (||e1||A = 1), the numericalvalue of the determinant of the new set ofdirections:det(ξ ,e2) =

√∆1µ

det(e1,e2) = 0.29is lower than the determinant obtained if ξ

is replacing e2:det(e1,ξ ) =

√∆2µ

det(e1,e2) = 0.88.Also,

√∆2 = 3.44 is bigger than µ = 2.75

meaning that there is a real gain in thereplacement of e2 for next iteration.

As the real function will probably notbehave as a parabola between P0 andP0 +2(P2−P0), the minimum of the realfunction must be found along that directionuntil new point P(p)

0 ((p) for Powell) isfound.A new iteration is started with P(p)

0 and thedirections (ξ

(p)1 = ξ1,ξ

(p)2 = P2−P0). The

red dotted line explained these new pointsP(p)1 and P(p)

2 .Direction P(p)

0 ,P(p)2 conducts to extremum.

N. Brouard/Ch. Heathcote IMaCh’s index

Page 19: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Example of Powell’s conjugate/determinant method

This example shows howat P2, the minimum indirection P2−P0, is notestimated (costly) butcalculated if the functionwas behaving like aquadratic function(parabola). From P(1)

0 ,direction ξ2 is droppedbecause (1) it correspondsto the maximum gap ∆2(2) the A−normeddistance between P2 andP1 is bigger than theA−normed distancebetween P0 and P2:||P2−P1||A > ||P0−P2||A

or√

∆2 = α2 > µ .

N. Brouard/Ch. Heathcote IMaCh’s index

Page 20: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Powell’s strange conditions

Strangely, M. D. Powell doesn’t use his own criteria but a more complexinequality, that doesn’t seem to be understood in the literature probablybecause it is not fully understandable. Using Powell’s simplified notations,here is an excerpt from his article for NOT inclusion.[...] µ is predicted as

We can remark that the condition for a new direction to be included is one ofthe 3 equivalent inequalities:

µ2 < ∆⇐⇒ 0< f1 −2f2 + f3 < 2∆⇐⇒ f1 − f2 −∆ <

f1 − f32

If f3 ≤ f1 and f1 − f2 ≥∆ the right most inequality can be squared (adding a

parasite solution)

0≤ (f1 − f2 −∆)2 ≤ (f1 − f3)2

4 .

Multiplying it by former inequality:

0< f1 −2f2 + f3 < 2∆

we get, Powell’s inequality FOR inclusion of the new direction:

(f1 −2f2 + f3)(f1 − f2 −∆)2 <(f1 − f3)2

2 ∆

the equality being obtained for ∆ = µ2 but a parasite solution has beenadded:

∆ = λ2 =

2(f1 − f2)2

f1 −2f2 + f3(2)

and Powell’s condition FOR inclusion is unfortunately equivalent to:

µ2 < ∆ < λ

2

f1 −2f2 + f32 = µ

2 < ∆ < λ2 =

2(f1 − f2)2

f1 −2f2 + f3

N. Brouard/Ch. Heathcote IMaCh’s index

Page 21: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Powell’s strange conditions

On the right is a case where the new directionwill not be accepted according to Powell’sinequality (red) even if the new set of directionwas more conjugate.In reality, this parasite solution is not alteringsubstantially the speed of convergence but itseemed important to discuss that point.Remark It can be seen from Acton (1970)famous book entitled “Numerical methods thatwork” quoted below (p. 465) that his commentdoesn’t refer neither to the necessary increase ofthe determinant in order to get conjugatedirections, nor to the useless second limit λ .

N. Brouard/Ch. Heathcote IMaCh’s index

Page 22: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Error in C-code with Intel C-compilerError in original bracketing function of NRC libraryWhat consequences of the NRC library error on IMaCh results?

A more important error concerns thebracketing function published in NRC (Presset al., 1992) and the error was found whilerunning IMaCh on Windows 64 bit PCbecause current free Gnu C Compiler are notoptimized for 64 bit processor and 3.5 slower(see table below)!

Time OS (64bit) Compiler Processor18’ 24" Windows 8.1 gcc 4.8.0 E3-1225V35’ 27" Windows 8.1 Intel C ilc E3-1225V35’ 18" OS/X Apple 64 bit Core I7

gcc 4.2.1

Thus we tried to compile with Intel C/C++compiler but it did not compile on thefollowing line of Numerical Recipes in Cbecause of an “SQR macro”:

Interestingly here is how NRC (Press et al.)explained why they used this complex macroSQR (instead of using a simple x*x) which wassupposed to run on any C compiler:

N. Brouard/Ch. Heathcote IMaCh’s index

Page 23: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Error in C-code with Intel C-compilerError in original bracketing function of NRC libraryWhat consequences of the NRC library error on IMaCh results?

In fact, as pointed out by Intel in a discussion after my own report onthis the potential bug, the macro does not respect the sequence pointbetween the evaluation of SQR and a standard C compiler is allowed toevaluate the value of the last SQR and to use its value in the first.Despite the fact that this syntax error was already reported by someoneelse in 2011 on the NR forum as a warn that another compiler than gcccould give a wrong result, nothing have been and the current version (3rdedition) is giving wrong results if compiled by Intel C/C++ compiler.

Thus the corrupted line should be split into two steps:t=2.0*(fp-2.0*(*fret)+fptt)*SQR(fp-(*fret)-del)t=t–del*SQR(fp-fptt);

Fortunately, after reporting the error of NRC, Intel sponsored the IMaChproject by providing free licenses for the 3 operating systems Windows(64 and 32 bit), OS/X and Linux which run IMaCh.

N. Brouard/Ch. Heathcote IMaCh’s index

Page 24: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Error in C-code with Intel C-compilerError in original bracketing function of NRC libraryWhat consequences of the NRC library error on IMaCh results?

Starting from two points, A and B such that (a < b, f (a) > f (b), the idea ofthe algorithm consists in finding, in the downhill direction (right directionhere) a point c, which could bracket the minimum of the real function, that issuch that f (c) > f (u) > f (b). A and B can be replaced by other points duringthe process, the output should be a bracket.We choose c at 1 plus golden distance from b, (1+0.61803)(b−a) andcompute the costly f (c). Depending on its position we have different cases:

f (c) > f (b) We found a bracket and the minimum could bebetween [a,b] or [b,c] but not outside [a,c] .

f (c) < f (b) The minimum can be between (b,c) or beyond cbut not between [a,b] because otherwise thefunction will not have a unique minimum. Thuswe can start again the process with points B andC and estimate f at D. f (d) = f (c + (1+ g)2) .

If the minimum was between [b,c], f (d) will begreater than f (c) otherwise the function will nothave a unique minimum. Thus if the minimumwas between [b,c] the bracket will be obtainedat the next step but if the minimum was beyondc, we will start again but enlarging of a factor1+ g our interval of search to the right.

Parabolic function in 3 points A,B,C and determination of its minimum at U:u = b− (b−c)q−(b−a)r

2(q−r) , involving two slopes and areas q and r as shown onthe right. When area q is bigger than area r , the minimum is on the right.The text in bold was omitted in mnbrak algorithm of NRC, causing wrongmaximization of the Likelihood function and wrong Health expectancy index.

N. Brouard/Ch. Heathcote IMaCh’s index

Page 25: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Error in C-code with Intel C-compilerError in original bracketing function of NRC libraryWhat consequences of the NRC library error on IMaCh results?

Here is the modified code of NRC.wh i l e (∗ f b > ∗ f c ) { /∗ D e c l i n i n g a , b , c w i th fa> fb > f c ∗/

r=(∗bx−∗ax )∗(∗ fb−∗f c ) ;q=(∗bx−∗cx )∗(∗ fb−∗f a ) ;u=(∗bx )−((∗bx−∗cx )∗q−(∗bx−∗ax )∗r ) /

(2.0∗SIGN(FMAX( f ab s (q−r ) ,TINY) ,q−r ) ) ;/∗ Minimum a b s c i s s a o f a p a r a b o l i c e s t i m a t e d from ( a , f a ) , ( b , fb ) and ( c , f c ) . ∗/u l im=(∗bx )+GLIMIT∗(∗cx−∗bx ) ;/∗ Maximum a b s c i s s a where f u n c t i o n s h o u l d be e v a l u a t e d ∗/i f ((∗bx−u )∗(u−∗cx ) > 0 . 0 ) { /∗ i f u_p i s between b and c ∗/

f u=(∗ f unc ) ( u ) ;#i f d e f MNBRAKORIGINAL#e l s e

dum=u ; /∗ S h i f t i n g c and u ∗/u = ∗cx ;∗cx = dum ;dum = fu ;fu = ∗ f c ;∗ f c =dum ;

#end i f} e l s e i f ((∗ cx−u )∗(u−u l im ) > 0 . 0 ) {

/∗ u i s a f t e r c but b e f o r e u l im ∗/

N. Brouard/Ch. Heathcote IMaCh’s index

Page 26: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Error in C-code with Intel C-compilerError in original bracketing function of NRC libraryWhat consequences of the NRC library error on IMaCh results?

Using the sample data that is distributed with the IMaCh program since15 years, the error in the Maximum Likelihood (more precisely 2*LogLikelihood) is equal to 5.11; and this value is comparable to the additionof a significant covariate (like sex), because the 2LL ratio behaves as aχ2 with one degree of liberty and its 95% value is 3.84!The NRC library error seems to have been fixed (in a slightly differentmanner) in a later edition but the information did not reach our researchinstitute and no errata book is published unfortunately.

#iterations -2*LL Value of estimated parameters1 2 3 4 5 6 7 8

34 46542.387 -12.2458 0.0923 -10.6725 0.0609 -2.6445 -0.0223 -4.7740 0.007862 46537.279 -12.3115 0.0930 -10.1982 0.0554 -1.6774 -0.0338 -5.6564 0.0179

5.11 =Difference in log likelihood ratio

N. Brouard/Ch. Heathcote IMaCh’s index

Page 27: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

In conclusion concerning the IMaCh program,I the most important error is the NRC error in the algorithm of the mnbrak

routine because it clearly gives wrong results.I Powell’s criteria for choosing the set of conjugate directions

I was not really described even in the specialized literature:I authors who commented the inequality did not discuss it;I authors who tried to interpret its meaning are, like Acton Acton(1970) very wrong.

I The inequality (1) presented here to change the set of directions issimpler and improves the quality of this method which is the mostefficient method from the family of “linear searches”.

I More time is needed to better understand Powell’s new algorithmswhich belong to the family of “trust regions”.

I Current test using NEWUOA with 8 paramaters does not change thespeed of convergence. But newer IMaCh will be able to incorporatemany more covariates and the move to “trust regions” algorithmswill probably be justified.

N. Brouard/Ch. Heathcote IMaCh’s index

Page 28: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

References I

Acton, F. S. (1970). Numerical Methods that Work. Harper & Row.Lièvre, A., Brouard, N., and Heathcote, C. (2003). The Estimation ofHealth Expectancies from Cross-longitudinal studies. MathematicalPopulation Studies, 10(4):221–248.

Powell, M. (2002). UOBYQA: unconstrained optimization by quadraticapproximation. Mathematical Programming, 92(3):555–582.

Powell, M. (2006). The NEWUOA software for unconstrainedoptimization without derivatives. In Di Pillo, G. and Roma, M.,editors, Large-Scale Nonlinear Optimization, volume 83 of NonconvexOptimization and Its Applications, pages 255–297. Springer US.

Powell, M. J. D. (1964). An efficient method for finding the minimum ofa function of several variables without calculating derivatives. TheComputer Journal, 7(2):155–162.

N. Brouard/Ch. Heathcote IMaCh’s index

Page 29: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

References II

Press, W. H., Teukolsky, S. A., Vetterling, W. T., and Flannery, B. P.(1992). Numerical Recipes in C (2nd Ed.): The Art of ScientificComputing. Cambridge University Press, New York, NY, USA.

Rios, L. and Sahinidis, N. (2013). Derivative-free optimization: a reviewof algorithms and comparison of software implementations. Journal ofGlobal Optimization, 56(3):1247–1293.

N. Brouard/Ch. Heathcote IMaCh’s index

Page 30: IMaCH is proposing to measure Health Expectancy with one ...euroreves.ined.fr/imach/singapore-Brouard-Heathcote-2015.pdfNicolas Brouard, Christopher Heathcote Created Date 6/26/2015

IntroductionConjugate gradientUse of determinants

Proof of the determinant theory and criteria for adopting a new directionUnexplained complex Powell’s conditions for inclusion of a new direction

Error in source code and in Intel C-compilerConclusionReferences

Thank you for your attention!

N. Brouard/Ch. Heathcote IMaCh’s index