[Rd] eigen of a real pd symmetric matrix gives NaNs in $vector (PR#7987)
cajo.terbraak@wur.nl
cajo.terbraak at wur.nl
Mon Jul 4 11:34:56 CEST 2005
Full_Name: cajo ter Braak
Version: 2.1.1
OS: Windows
Submission from: (NULL) (137.224.10.105)
# I would like to attach the matrix C in the Rdata file; it is 50x50 and comes
from a geostatistical problem (spherical covariogram)
> rm(list=ls(all=TRUE))
> load(file= "test.eigen.Rdata")
> ls()
[1] "C" "eW"
>
> sym.check = max(abs(C - t(C))) # should be 0 for symmetry
> sym.check
[1] 0
> eW <-eigen(C, symmetric = TRUE)
> l_eW <- eW$values
> print(eW$values)
[1] 4.5730646 4.5730646 3.3066738 3.3066738 3.3066738 3.3066738 2.3935268
[8] 2.3935268 1.9367508 1.9367508 1.9347787 1.9347787 1.4276845 1.4276845
[15] 1.4276845 1.4276845 0.9858318 0.9858318 0.9858318 0.9858318 0.9123115
[22] 0.9123115 0.7945283 0.7945283 0.7880493 0.7880493 0.6047920 0.6047920
[29] 0.6047920 0.6047920 0.5689609 0.5689609 0.5681210 0.5681210 0.5440676
[36] 0.5440676 0.5440676 0.5440676 0.5224040 0.5224040 0.5139844 0.5139844
[43] 0.5077485 0.5077485 0.5008249 0.5008249 0.5008249 0.5008249 0.4960220
[50] 0.4960220
> #print(eW$vector)
>
>
> #library(MASS)
> #n = nrow(C)
> #y = runif(n)
>
> #lm1 = lm.gls(y~1, W = C)
> #summary(lm1)
>
> eW <-eigen(C, symmetric = TRUE)
> l_eW <- eW$values
> # the thirdteens eigenvector contrains NaN
> print(eW$values)
[1] 4.5730646 4.5730646 3.3066738 3.3066738 3.3066738 3.3066738 2.3935268
[8] 2.3935268 1.9367508 1.9367508 1.9347787 1.9347787 1.4276845 1.4276845
[15] 1.4276845 1.4276845 0.9858318 0.9858318 0.9858318 0.9858318 0.9123115
[22] 0.9123115 0.7945283 0.7945283 0.7880493 0.7880493 0.6047920 0.6047920
[29] 0.6047920 0.6047920 0.5689609 0.5689609 0.5681210 0.5681210 0.5440676
[36] 0.5440676 0.5440676 0.5440676 0.5224040 0.5224040 0.5139844 0.5139844
[43] 0.5077485 0.5077485 0.5008249 0.5008249 0.5008249 0.5008249 0.4960220
[50] 0.4960220
> print(eW$vector[,13])
[1] 0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN
[20] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
NaN
[39] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
>
More information about the R-devel
mailing list