[R-sig-Geo] LMC manually fitted
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Sun Mar 20 16:52:22 CET 2011
Nikkie,
you made sure that the Cauchy-Schwartz inequality holds, and although it
is a necessary condition, it is not a sufficient condition for the
coefficient matrices to be positive definite.
function fit.lmc in package gstat contains a function that computes the
positive definite approximation (I believe in a least squares sense) to
a non-positive definite matrix by zero-ing the negative eigenvectors:
posdef = function(X) {
q = eigen(X)
d = q$values
d[d < 0] = 0
q$vectors %*% diag(d, nrow = length(d)) %*% t(q$vectors)
}
You could try to use that on the partial sill matrices. I believe it
still has the risk that things are perfectly correlated, in the end,
hence the correct.diagonal option (mess?) in fit.lmc.
Hth,
On 03/18/2011 12:20 PM, Nikki roy wrote:
> Dear friends,
>
> I am doing cokriging and i could not fit the LMC to my variograms
> automatically, therefore i ftted the LMC manually. i have a total of 15
> variograms (direct variograms and cross variograms). eg:
>
> clay.g$model$clay[1,2]
> clay.g$model$clay[1,2] = 0.22
> clay.g$model$clay[2,2] = 0.15
> clay.g$model$evi[1,2] = 0.005
> clay.g$model$evi[2,2] = 0.0105
> clay.g$model$clay.evi[1,2] = 0.185
> clay.g$model$clay.evi[2,2] = 0.025
>
> then i checked my matrices with this condition which they need to
> satisfy:nugget(clay.evi)
> =<sqrt(nugget(clay) * nugget(evi)) and i got something like this for
> example:
> clay.g$model$clay[1,2] = 0.22
> clay.g$model$clay[2,2] = 0.15
> clay.g$model$evi[1,2] = 0.005
> clay.g$model$evi[2,2] = 0.0105
> clay.g$model$clay.evi[1,2] = 0.030
> clay.g$model$clay.evi[2,2] = 0.025
>
>
> still after this correction i am getting this error:
> predict.gstat(clay.g, newdata = dem)
> non-positive definite coefficient matrix in structure 1non-positive definite
> coefficient matrix in structure 2Warning: No Intrinsic Correlation or Linear
> Model of Coregionalization found
> Reason: coefficient matrix not positive definite
> Warning: [add `set nocheck = 1;' to the command file to ignore the following
> error]
> Error in predict.gstat(clay.g, newdata = dem) :
> gstat: value not allowed for: variograms do not satisfy a legal model
> May you please help, what went wrong and how to solve this.
> Thanks for your usual co-operation,
>
> Nikkie
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics e.pebesma at wwu.de
More information about the R-sig-Geo
mailing list