# [R-sig-Geo] Conditional Simulation question

Paulo Justiniano Ribeiro Jr paulojus at est.ufpr.br
Tue Feb 1 21:36:44 CET 2005

```Matthew

1. the "grid" argument can also taka a matrix with coordinates values.
Terefore if you want N locations in coordinates which are not in the
1x1 square just generate a Nx2 matrix witht the coordinates and pass it to
"grid"

2. grf produces "uncoditional" simulations.
To obtain conditional simulations you will need to use either
krige.conv (for "tradidional" kriging algorithms)  or
krige.bayes(for "Bayesian" kriging.)

See for instance help(krige.conv)

hope this helps

P.J.

On Tue, 1 Feb 2005, Matthew Sokol wrote:

> Hello,
>
> My name is Matthew Sokol and I am writing this list serve to ask some
> help. Currently I am a master's student at the University of Nevada
> and have come across a problem using R that I can not solve.
>
> Here is my problem:
> I am using the R package geoR, specifically the function grf to simulate data.
>
> Basically I have a data set that contains an Easting and Northing
> coordinate system and a Z value. From this system I wish to perform
> Ordinary Kriging. So I run the following command lines in R:
> > geodat<-as.geodata(dat)
> > plot(geodat)
> > vario<-variog(geodat)
> > lines.variomodel(cov.model="gaussian",nugget=1800,cov.pars=c(1400,60),max.dist=150)
>
> Now since I know the Nugget, Sill, and Range for the variogram model,
> I wish to simulate more data that follows the same variogram model. So
> I run the following command line:
>
> > simdat<-grf(625,grid="reg",nugget=1800,cov.pars=c(1400,60))
>
> Now, the problem with this command is that it produces data on grid
> that is 1 x 1 (all the Northing and easting coordinates are now a
> number 0-1). But my easting and northing coordinates have the
> following properties:
>
> Easting: Min 254.4	Max: 492
> Northing: Min 118	Max 315
>
> Which is not a 1 x 1 grid.
>
> I know my problem is in this statement: grid="reg"
> I tried the following commands:
> Loci<-expand.grid(seq(250,500,l=250),seq(115,320,l=205))
> So now I run:
> > simdat<-grf(625,grid=loci,nugget=1800,cov.pars=c(1400,60))
>
> Which produces so much data that I can not R console will not display it.
>
> So I run the following R commands:
> geosim<-as.geodata(simdat)
> > variosim<-variog(geosim)
> variog: computing omnidirectional variogram
> Error in vector("double", length) : cannot allocate vector of length 1444504375
>
> So now I get an error. I think i may be producing to much data with my
> simulation?
>
> I am lost. I've looked through the manuals but have not found much on
> conditional simulation. I was wondering if anyone knew of a problem
> like this or where I can look to find more information.
>
> I am sorry if the question is trivial as I have been reading the posts
> on this list serve and everyone here has a command of the language far
> surpass mine. Thank you for your time.
>
>
> -Matthew Sokol
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>

Paulo Justiniano Ribeiro Jr
LEG (Laboratório de Estatística e Geoinformação)
Departamento de Estatística