[R] Cokriging

Gnai Nishani Musafer g.musafer at qut.edu.au
Wed Mar 20 02:05:20 CET 2013


Hi John,

Thank you for all the information and advices. Highly appreciated your help. Aftter using the nmax it worked finely. 

Thanks 
Best Regrds,
Nishani Musafer
________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of Jon Olav Skoien [jon.skoien at jrc.ec.europa.eu]
Sent: Tuesday, March 19, 2013 11:40 PM
To: r-help at r-project.org
Subject: Re: [R] Cokriging

Nishani,
we do not have access to your data, but I guess the problem is the size
of the observation data set. I think the default of predict.gstat is to
create one covariance matrix between all observation locations, which
would be a 50,000*50,000 matrix in your case. The alternative is to do
kriging in a local neighbourhood, with the argument nmax, eg. equal to
20 (or maybe larger if the size of blocks is large compared to the
distance between observations.

Just as a note, you define the projection of your data to be epsg:28992.
This is a Dutch projection used for the meuse data in the examples of
gstat and automap, but is most likely not the projection if you are
using data from Australia (your email address). Try to find the correct
projection of your data or leave it empty if you are sure that both
observation data and the grid is in the same projection (and not lat-long).

Best wishes,
Jon

BTW, you are more likely to get quicker response to questions like this
on the mailinglist r-sig-geo.


On 19-Mar-13 2:03, Gnai Nishani Musafer wrote:
> Dear All,
>
> I run following code to estimate the blocks using cokriging ( my data set has more than 50,000 data points).  All the things run finely but  Once I run the predict.gstat function it gave the error message - "memory.c", line 58: can't allocate memory in function m_get(). I run this code on LINUX sever but result is same. Would any one please be able to give a solution for this? Any advice regarding this highly appreciated.
>
> Note: same error message gave when I was using krige function  . Then I changed the code and add a loop to estimate the one by one. It worked. But this technique not work for cokiriging it gives the same error message.
>
> require(gstat)
> require(automap)
> data_c <- read.csv("cu_s_data.csv", header=T)
> grid<- read.csv("grid.csv", header=T)
>
>
> coordinates(data_c) <- ~X+Y+Z
> coordinates(grid) <- ~x+y+z
> proj4string(grid)=CRS("+init=epsg:28992")
> proj4string(data_c)=CRS("+init=epsg:28992")
> g <- gstat(id = "Cu", formula =Cu~1,data = data_c)
> g <- gstat(g, id = "S", formula = S~1,data =data_c)
> g <- gstat(g, id = c("Cu", "S"), model = vgm(cov(data_c$Cu,data_c$S) , "Sph", 200, 0))
> g<fit.lmc(variogram(g),g,model=vgm(psill=cov(data_c$Cu,data_c$S),model="Sph",range=200,nugget=0))
> k.c <- predict.gstat(g, grid,block = c(30,30,15))
>
>
> Thanks and Regards,
> Nishani Musafer
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


--
Jon Olav Skøien
Joint Research Centre - European Commission
Institute for Environment and Sustainability (IES)
Land Resource Management Unit

Via Fermi 2749, TP 440,  I-21027 Ispra (VA), ITALY

jon.skoien at jrc.ec.europa.eu
Tel:  +39 0332 789206

Disclaimer: Views expressed in this email are those of the individual and do not necessarily represent official views of the European Commission.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list