Dear List

I am using the RandomFields package, and I have a problem when 2d-kriging, with an anisotropy, some values from an irregular network.
It works well when :
- 2d-kriging, without any anisotropy, some data from an irregular network
- 2d-kriging, with and without anisotropy, some data from a regular network
- 3d-kriging, with and without anisotropy, some data from a regular network

Here is my script highly inspired by some examples from the package.

rm(list=ls())
library(RandomFields)
###############
# PARAMETERS
###############
Mean<-1
Variance<-4.5
Range<-1
nbRainG<-20
rPoint <- 1:nbRainG
points1 <- rPoint
xMax<-5
yMax<-10

##############################################################
#CREATION OF AN IRREGULAR RAINGAUGE NETWORK, DATA SIMULATION
##############################################################
model="exponential"
param1 <- c("mean"=Mean,"variance"=Variance,"nugget"=0,"scale"=Range)
RFparameters(PracticalRange=FALSE)
data <- GaussRF(points1, grid=FALSE, model=model,param=param1)
data[which(data<0)]<-0

xPoint <- runif(nbRainG,0,xMax)
yPoint <- runif(nbRainG,0,yMax)
MatCoord<-matrix(0,nr=nbRainG,nc=2)
MatCoord[,1]<-t(xPoint)
MatCoord[,2]<-t(yPoint)
points2<-MatCoord

dim(data)<-NULL

###########################
# PARAMETERS FOR KRIGING
###########################
stepSpace <- 0.25
xkrig <-  seq(0,xMax,stepSpace)
ykrig <-  seq(0,yMax,stepSpace)

valuesLim <- c(0,3)
colour <- rainbow(100)

###############
#2D KRIGING
###############
#NO ANISOTROPY->It works
krige.method <- "O"
values <-  Kriging(krige.method=krige.method,
           x=xkrig,y=ykrig,grid=TRUE,
           model=list(
                list(m="exp", v=Variance,s=Range)
                ),
           given=points2,data=data)


#ANISOTROPY ->doesnt work
anisoMatrix<-matrix(0,2,2)
AnisoS<-1 #whatever this value, it doesn't work
anisoMatrix[1,1]<-1
anisoMatrix[2,2]<-AnisoS

krige.method <- "O"
values <-  Kriging(krige.method=krige.method,
              x=xkrig,y=ykrig,grid=TRUE,
              model=list(
                list(m="exp", v=Variance,s=Range,a=anisoMatrix)
                ),
              given=points2,data=data)
######
#END#
######

As an error message, R writes : Error: (in PrepareModel) do not mix isotropic definitions with anisotropic ones
I don't know why.
- The problem comes from adding the anisotropy parameter (a=anisoMatrix, in the function Kriging). When putting the anisotropy coefficient to one (ie isotropy), it doesn't work as well.
- I have tested the script for several theoritical model of structure (sph,...), but it doesn't work as well
- Even if the dimension of the data set is a vector in the case of irregular network (instead of a matrix in the case of a regular network), the anisotropy matrix has to stay with the dimension 2x2 (for a spatial network), and not a scalar.

Does someone has any idea about this error?

Some information about my system :
> sessionInfo()
R version 2.11.1 (2010-05-31)
i386-pc-mingw32

locale:
[1] LC_COLLATE=Norwegian (Bokmål)_Norway.1252  LC_CTYPE=Norwegian (Bokmål)_Norway.1252
[3] LC_MONETARY=Norwegian (Bokmål)_Norway.1252 LC_NUMERIC=C
[5] LC_TIME=Norwegian (Bokmål)_Norway.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] RandomFields_1.3.41

Thanks a lot

Jean-Marie

	[[alternative HTML version deleted]]

