# [R] Changing a matrix based on eigen value

Bert Gunter gunter.berton at gene.com
Thu Jul 21 01:22:52 CEST 2011

```A homework problem?
-- Bert

On Wed, Jul 20, 2011 at 10:06 AM, B. Jonathan B. Jonathan
<bkheijonathan at gmail.com> wrote:
> Dear all, my question is not directly related to R, however I believe that
> experts here would not mind anything to have a look on my problem.
>
> Please consider a symmetric matrix and it's eigen values:
>
>> set.seed(1)
>> mat <- matrix(rnorm(36), 6)
>> mat <- mat %*% t(mat) # symmetric matrix
>> mat
>          [,1]       [,2]        [,3]       [,4]       [,5]        [,6]
> [1,]  3.920570  1.9339770  1.29012167 -1.4627174 -1.5655953 -1.82083435
> [2,]  1.933977  5.8501784 -1.70504980  0.7195951  1.4252209 -3.11543738
> [3,]  1.290122 -1.7050498  3.31434984 -0.6324029  0.1860666 -0.08234236
> [4,] -1.462717  0.7195951 -0.63240294  5.4179467  0.9003576 -3.61864495
> [5,] -1.565595  1.4252209  0.18606662  0.9003576  4.5248002  0.52702347
> [6,] -1.820834 -3.1154374 -0.08234236 -3.6186449  0.5270235  6.02038872
>> eigen(mat)\$values
> [1] 11.4213448  7.3302845  5.7033748  3.9863332  0.4827576  0.1241385
>
> Here my goal is to find the "nearest matrix" of "mat" for which the minimum
> eigen value is 0.20 (I would rather want to fix some arbitrary value). While
> finding that nearest matrix, I would like to keep all other properties
> (whatever are those) of my original matrix "mat" as unaltered as possible.
>
> Is there any algorithm to achieve that?
>
> Thanks for your help.
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
>

--
"Men by nature long to get on to the ultimate truths, and will often
be impatient with elementary studies or fight shy of them. If it were
possible to reach the ultimate truths without the elementary studies
usually prefixed to them, these would not be preparatory studies but
superfluous diversions."

-- Maimonides (1135-1204)

Bert Gunter
Genentech Nonclinical Biostatistics

```