[SOLVED] Positive Definiteness Coregionalization Matrices

If you have problems using RGeostats package or if you simply need some help on an unlisted subject.

[SOLVED] Positive Definiteness Coregionalization Matrices

Postby Costu » Sat Mar 19, 2016 2:20 pm

Hi,

I applied the Linear Model of Coregionalization on jura dataset example. I wondered to see that some coregionalization matrices are not positive definite (some eigenvalues are negative). There is some explanation about this?

Please find below the R program and outputs.

Kind regards,

Francky

Code: Select all
#####################################################################
#                                                                   #
#         Linear Model of Coregionalization: Jura Data Set          #
#                                                                   #
#####################################################################

## Loading Necessary Packages ##
library(compositions)
library("RGeostats")
acknowledge("RGeostats")


## Data Loading and Processing ##
data(juraset)
Data=as.matrix(cbind(juraset[,c(1,2)],juraset[,c(5:11)]))


## Stationary Multivariate Spatial Dependence Structure Modelling##
xmin=min(Data[,1])
xmax=max(Data[,1])
ymin=min(Data[,2])
ymax=max(Data[,2])
D=sqrt((xmax-xmin)^2 + (ymax-ymin)^2)

ndir=4; ang0=0
dirvect=((seq(1,ndir)-1) * 180 / ndir + ang0)
nlag=10

Data_=db.create(x1=Data[,1],x2=Data[,2],z1=Data[,3],z2=Data[,4],z3=Data[,5],z4=Data[,6],z5=Data[,7],
                z6=Data[,8],z7=Data[,9], flag.grid=FALSE)

VarioE<- vario.calc(Data_,dirvect=dirvect,lag=D/(2*nlag),nlag=nlag)
VarioM<- model.auto(VarioE,struct = melem.name(c(1,2,2)),draw=FALSE,auth.aniso=TRUE,auth.rotation=TRUE,auth.locksame = TRUE,flag.noreduce=FALSE,verbose=-1)

vario.plot(VarioE,main="",reset=TRUE,flag.norm = FALSE,cex.axis=0.6,cex.lab=0.6,lty=2,lwd=1,npairdw = FALSE,varline=FALSE)
model.plot(VarioM,vario=VarioE,add=T,cex.axis=0.6,lwd=c(1,1,1,1),lty=c(1,1,1,1))

eigen(VarioM[1]$sill)
eigen(VarioM[2]$sill)
eigen(VarioM[3]$sill)


> eigen(VarioM[1]$sill)
$values
[1] 8.499865e+02 1.977862e+02 9.433202e+01 3.209110e+01 8.036964e-01 1.601101e-01 1.540494e-15

$vectors
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] -0.01005381 0.03746822 0.004669369 -0.004640683 -0.064125908 0.994872894 0.0675833427
[2,] -0.46188087 -0.43165544 0.754920117 -0.173149849 -0.010439121 0.005356452 0.0177966757
[3,] -0.73813728 -0.28725926 -0.609196541 0.027701613 0.026124802 0.008061020 -0.0004334123
[4,] 0.01052760 0.01289493 0.018133628 -0.074614217 0.908299624 0.085040358 -0.4019784954
[5,] -0.10053151 0.33581179 -0.071929646 -0.851450515 0.094891935 -0.036293426 0.3696759573
[6,] -0.02806708 0.08487796 -0.038998528 -0.367379901 -0.401317750 0.025705137 -0.8329480198
[7,] -0.48032610 0.78077636 0.227881109 0.322066702 -0.005269226 -0.030404354 -0.0553728678

> eigen(VarioM[2]$sill)
$values
[1] 1.479096e+03 1.926425e+02 9.580130e+00 3.393013e+00 1.513021e-13 1.127791e-14 -2.896052e-16

$vectors
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] -0.004446902 0.01187673 0.002660325 0.14577412 0.01673238 0.00000000 0.989091515
[2,] -0.415199055 -0.12086132 -0.582053145 -0.04531893 0.68600115 -0.03938001 -0.003775756
[3,] -0.632116016 -0.65383095 0.263856403 0.13707313 -0.27092989 -0.10485251 -0.011319416
[4,] -0.044714142 0.08711415 -0.236087996 -0.49383275 -0.28874994 -0.77555754 0.077054658
[5,] -0.090478517 0.25586163 -0.404345992 0.77363379 -0.31541839 -0.22916604 -0.111075204
[6,] -0.106825281 0.27937992 0.603495725 0.25455548 0.48480179 -0.49383989 -0.051176404
[7,] -0.637512317 0.63769066 0.090258217 -0.22522997 -0.19447719 0.29928374 0.025718565

> eigen(VarioM[3]$sill)
$values
[1] 6.921042e+01 1.636423e+01 1.499705e+00 6.383285e-16 6.179398e-16 -4.324521e-17 -7.318398e-16

$vectors
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 0.01887289 -0.05354253 -0.03810188 0.00000000 0.00000000 0.997659891 0.00000000
[2,] -0.17827815 0.37247806 -0.21212276 0.44171545 0.07566480 0.015261481 0.76381301
[3,] -0.05610654 -0.32215552 0.07563972 -0.73584073 0.06376333 -0.013339330 0.58450085
[4,] 0.26504864 -0.25372507 -0.92654384 -0.04074033 0.00612611 -0.054016783 -0.04768858
[5,] 0.65220397 0.65130162 0.01712488 -0.31741278 -0.21661255 0.023270310 0.04392654
[6,] 0.64357208 -0.50907674 0.29346233 0.40108305 -0.10791097 -0.028288054 0.25927419
[7,] 0.23432231 0.08294441 0.05416568 -0.01215027 0.96519727 0.002087414 -0.05934306
Costu
 
Posts: 10
Joined: Sun Oct 14, 2012 8:37 pm

Re: Positive Definiteness Coregionalization Matrices

Postby Didier Renard » Wed Dec 14, 2016 10:14 am

As we discussed (in Valencia), the apparent non positive definiteness is due to roundoff errors when producing
the results in a printable format.
In the new version, these values are saved into elements that can be retrieved using the get.keypair mechanism
(check the on-line Help of the model.auto() function for details on this option and the relevant keyword to be used).
Didier Renard
 
Posts: 337
Joined: Thu Sep 20, 2012 4:22 pm


Return to Other Troubleshooting

Who is online

Users browsing this forum: No registered users and 8 guests

cron