Learn R Programming

compositions (version 1.40-2)

compOKriging: Compositional Ordinary Kriging

Description

Geostatistical prediction for compositional data with missing values.

Usage

compOKriging(comp,X,Xnew,vg,err=FALSE)

Arguments

comp

an acomp compositional dataset

X

A dataset of locations

Xnew

The locations, where a geostatistical prediction should be computed.

vg

A compositional variogram function.

err

boolean: If true kriging errors are computed additionally.

Value

A list of class "logratioVariogram"

X

The new locations as given by Xnew

Z

The predicted values as acomp compositions.

err

An ncol(Z)xDxD array with the clr kriging errors.

Details

The function performes multivariate ordinary kriging of compositions based on transformes addapted to the missings in every case. The variogram is assumed to be a clr variogram.

References

Pawlowsky-Glahn, Vera and Olea, Ricardo A. (2004) Geostatistical Analysis of Compositional Data, Oxford University Press, Studies in Mathematical Geology

Tolosana (2008) ...

Tolosana, van den Boogaart, Pawlowsky-Glahn (2009) Estimating and modeling variograms of compositional data with occasional missing variables in R, StatGis09

See Also

vgram2lrvgram, CompLinModCoReg, vgmFit

Examples

Run this code
# NOT RUN {
# Load data
data(juraset)
X <- with(juraset,cbind(X,Y))
comp <- acomp(juraset,c("Cd","Cu","Pb","Co","Cr"))
lrv <- logratioVariogram(comp,X,maxdist=1,nbins=10)
plot(lrv)

# Fit a variogram model
vgModel <- CompLinModCoReg(~nugget()+sph(0.5)+R1*exp(0.7),comp)
fit <- vgmFit2lrv(lrv,vgModel)
fit
plot(lrv,lrvg=vgram2lrvgram(fit$vg))

# Define A grid
x <- (0:30/30)*6
y <- (0:30/30)*6
Xnew <- cbind(rep(x,length(y)),rep(y,each=length(x)))

# Kriging
erg <- compOKriging(comp,X,Xnew,fit$vg,err=FALSE)
par(mar=c(0,0,1,0))
pairwisePlot(erg$Z,panel=function(a,b,xlab,ylab) {image(x,y,
                     structure(log(a/b),dim=c(length(x),length(y))),
                     main=paste("log(",xlab,"/",ylab,")",sep=""));points(X,pch=".")})


# Check interpolation properties 
ergR <- compOKriging(comp,X,X,fit$vg,err=FALSE)
pairwisePlot(ilr(comp),ilr(ergR$Z))
ergR <- compOKriging(comp,X,X+1E-7,fit$vg,err=FALSE)
pairwisePlot(ilr(comp),ilr(ergR$Z))
ergR <- compOKriging(comp,X,X[rev(1:31),],fit$vg,err=FALSE)
pairwisePlot(ilr(comp)[rev(1:31),],ilr(ergR$Z))
# }

Run the code above in your browser using DataLab