[R] Solve non-linear equatuion, grid search... [Was] RE: minimization of a quadratic form with some coef fixed and someconstrained

Berwin A Turlach berwin at maths.uwa.edu.au
Thu Aug 10 17:17:46 CEST 2006


G'day Yingfu,

>>>>> "YX" == Yingfu Xie <Yingfu.Xie at sekon.slu.se> writes:

    YX> Thanks a lot for answering! I prefer the first method, which
    YX> seems easier to carry out. So, what I need now is some method
    YX> to solve the non-linear equation [...]  I searched the R
    YX> archive somehow, but didn't find anything valuable. Is there
    YX> any function in R available for this problem? I am grateful of
    YX> any hints.
You have to code the function
        f(lam) = c'(M_11-lam*I)^(-2)c-1
in R.  Note that lam is univariate.

If you could easily find lam1 and lam2 with f(lam1)<0 and f(lam2)>0,
then you could use uniroot().  But optim() could be easier to use for
finding lam s.t. f(lam)=0, just try to minimise f(lam)^2.

    YX> When c=0, my problem reduces to the typical minimization of
    YX> b'M_11b w.r.t b'b=1. The solution is the normalized
    YX> eigenvector associated with the minimum eigenvalue of M_11,
    YX> right?
Depends on your M_11, if M_11 is the identity matrix, then you have
infinitely many solutions.  Intuitively, I would have thought that the
solution is the normalised eigenvector (and its negation, so there are
at least two solutions) of the maximum eigenvalue of M_11, but I might
be drawing the wrong picture in my mind.  It should be either the
maximum or minimum.  Note, if that eigenvalue has geometric
multiplicity > 1, then there will be infinitely many solutions.

    YX> PS: There is a type error in the first condition for b: the
    YX> '+' should write to '-'.
I believe both versions are correct.

We are enforcing an equality constraint, not an inequality
constraint.  So it doesn't matter whether we write the Lagrangian as
        objective function + lam *(b'b-1)
or
        objective function - lam *(b'b-1)
In the KKT conditions, we will only have the complimentary condition
that lam*(b'b-1)=0, no condition that lam>=0.

When you enforce inequality constraints, then you have to take care
with your signs and how you write the Lagrangian.

Cheers,

        Berwin



More information about the R-help mailing list