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

From: Yingfu Xie <Yingfu.Xie_at_sekon.slu.se>
Date: Fri 11 Aug 2006 - 00:08:15 EST

Hello, Berwin,

Thanks a lot for answering! I prefer the first method, which seems easier to carry out. So, what I need now is some method to solve the non-linear equation
c'(M_11-lam*I)^(-1) (M_11-lam*I)^(-1)c=1 for lam, where c is a vector, M_11 is a symmetric matrix and I is the identity matrix.
I searched the R archive somehow, but didn't find anything valuable. Is there any function in R available for this problem? I am grateful of any hints.

When c=0, my problem reduces to the typical minimization of b'M_11b w.r.t b'b=1. The solution is the normalized eigenvector associated with the minimum eigenvalue of M_11, right?

Thanks,
Yingfu

PS: There is a type error in the first condition for b: the '+' should write to '-'.

-----Original Message-----
From: Berwin A Turlach [mailto:berwin@bossiaea.maths.uwa.edu.au] On Behalf Of Berwin A Turlach
Sent: den 10 augusti 2006 03:57
To: Yingfu Xie
Cc: Rolf Turner; r-help@stat.math.ethz.ch Subject: Re: [R] minimization a quadratic form with some coef fixed and someconstrained

```    YX> Thanks for reply! But I think that solution is right without
YX> the constrain b'b=1. With this constrain, the solution is not
YX> so simple. :(
```

But simple enough. :)

Write down the Lagrange function for the problem. Say, 'lam' is the Lagrange parameter for enforcing the constraint b'b=1. Then, using Rolf's notation:

RT> [...] Write M as

RT> | M_11 c |
RT> | c' m |

Then the system of equations that b and the Lagrange parameter have to fulfill is:

b = (M_11 + lam*I)^{-1} c (with I being the identity matrix) and lam = b' M_11 b - b'c

You can either use the first equation and do a (grid) search for the value of 'lam' that gives you b'b=1 (could be negative!), or start with lam=0 and then alternate between the two equations until convergence.

At least I think that this will solve your problem. :) Thinking a bit about the geometry of the problem, I actually believe that if c=0, you might have an identifiability problem, i.e. there are at least two solutions, or, depending on M_11, infinitely many.

Hope this helps.

Cheers,

Berwin

• Full address ============================ Berwin A Turlach Tel.: +61 (8) 6488 3338 (secr) School of Mathematics and Statistics +61 (8) 6488 3383 (self)

The University of Western Australia FAX : +61 (8) 6488 1028

```35 Stirling Highway
Crawley WA 6009                e-mail: berwin@maths.uwa.edu.au
Australia                        http://www.maths.uwa.edu.au/~berwin

###########################################

```

This message has been scanned by F-Secure Anti-Virus for Mic...{{dropped}}

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri Aug 11 00:12:11 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 11 Aug 2006 - 02:21:11 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.