Learn R Programming

geostatsp (version 0.4.4)

GaussRF: Simulate Gaussian Random Fields

Description

This function is a wrapper for the GaussRF function in the RandomFields package, where the arguments and output are Raster or SpatialPoints objects.

Usage

GaussRF(x,  ...)
	## S3 method for class 'Raster':
GaussRF(x,...)
	## S3 method for class 'SpatialPoints':
GaussRF(x,...)
	## S3 method for class 'SpatialPointsDataFrame':
GaussRF(x,...)

Arguments

x
An object of class raster, SpatialPoints, or SpatialPointsDataFrame, or an object of a class acceptable to the GaussRF .
...
additional arguments, see GaussRF in the RandomFields package.

Value

  • If x is of class raster, a random field is simulated on a grid and returned as a raster. If x is of class Spatial Points or SpatialPointsDataFrame, a random field is simulated at the points specified and a vector is returned.

Examples

Run this code
mymodel = c(mean=0, variance=1, nugget=0, 
				scale=2, alpha=2)

myraster = raster(nrows=11,ncols=11,xmn=0,xmx=10,ymn=0,ymx=10)

myGRF=GaussRF(myraster, model="whittle", 
		param=mymodel)

plot(myGRF)

mypoints = SpatialPointsDataFrame(cbind(runif(10), runif(10)),data=data.frame(id=1:10))

mypoints$rf= GaussRF(mypoints, model="whittle", 
		param=mymodel) 

spplot(mypoints, "rf")


x = cbind(1:4, 1:4)
temp=GaussRF(x, model="whittle", 
		param=c(mean=0, variance=1, nugget=0, 
				scale=2, alpha=2))

Run the code above in your browser using DataLab