Re: R version 3.3.2, Windows 10 -- gstat.predict() function often return NaN values (GSTAT Package)
I am adding my message in the mail body as I found it missing from the mail that finally got posted on the list.
I am trying to simulate a combination of two different random fields (yy1 and yy2 different mean and correlation length) with an irregular boundary. I have attached the picture of my expected outcome. The code is not giving such output consistently and I am frequently getting atleast one of the yy1 and yy2 as as NaN, which results in the Undesired output as shown in image.
The key steps I used are:
1) Created two gsat objects with different means and psill (rf1 and rf2)
2) Created two computational grids (one for each random field) in the form of data frame with two variables "x" and "y" coordinates.
3) Predicted two random fields using unconditional simulation.
The code is fairly small hence I am pasting in here itself. Any help in this regard would be highly appreciated.
xy <- expand.grid(1:150, 1:200) # grid is created in the form of a dataframe with x and y vectors
names(xy)<-c('x','y') # giving names to the variables
# Creating gsat objects
rf1<-gstat(formula=z~1,locations=~x+y,dummy = T,beta=c(1,0,0), model=vgm(psill=0.025, range=5, model='Exp'), nmax=20) # dummy=T treats this as a unditional simulation
rf2<-gstat(formula=z~1,locations=~x+y,dummy = T,beta=c(4,0,0), model=vgm(psill=0.025, range=10, model='Exp'), nmax=20) # dummy=T treats this as a unditional simulation
From: R-help [mailto:[hidden email]] On Behalf Of Rathore, Saubhagya Singh
Sent: Wednesday, February 15, 2017 12:37 PM
To: [hidden email] Subject: [R] R version 3.3.2, Windows 10 -- gstat.predict() function often return NaN values (GSTAT Package)