Running examples in 'GeoModels-Ex.R' failed
The error most likely occurred in:

> ### Name: GeoFit
> ### Title: Max-Likelihood-Based Fitting of Gaussian and non Gaussian RFs.
> ### Aliases: GeoFit print.GeoFit
> ### Keywords: Composite
> 
> ### ** Examples
> 
> library(GeoModels)
> 
> ###############################################################
> ############ Examples of spatial Gaussian RFs ################
> ###############################################################
> 
> 
> # Define the spatial-coordinates of the points:
> set.seed(3)
> N=300  # number of location sites
> x <- runif(N, 0, 1)
> set.seed(6)
> y <- runif(N, 0, 1)
> coords <- cbind(x,y)
> 
> # Define spatial matrix covariates and regression parameters
> X=cbind(rep(1,N),runif(N))
> mean <- 0.2
> mean1 <- -0.5
> 
> # Set the covariance model's parameters:
> corrmodel <- "Matern"
> sill <- 1
> nugget <- 0
> scale <- 0.2/3
> smooth=0.5
> 
> 
> param<-list(mean=mean,mean1=mean1,sill=sill,nugget=nugget,scale=scale,smooth=smooth)
> 
> # Simulation of the spatial Gaussian RF:
> data <- GeoSim(coordx=coords,corrmodel=corrmodel, param=param,X=X)$data
> 
> 
> # setting fixed and parameters to be estimated
> fixed<-list(nugget=nugget,smooth=smooth)
> start<-list(mean=mean,mean1=mean1,scale=scale,sill=sill)
> 
> 
> ################################################################
> ###
> ### Example 0. Maximum independence composite likelihood fitting of
> ### a Gaussian RF
> ### 
> ###############################################################
> fit1 <- GeoFit(data=data,coordx=coords,corrmodel=corrmodel, 
+                     neighb=3,likelihood="Marginal",
+                     type="Independence", start=start,fixed=fixed,X=X)
> print(fit1)

##################################################################
Maximum  Composite-Likelihood Fitting of Gaussian Random Fields

Setting: Marginal Composite-Likelihood 

Model: Gaussian 

Type of the likelihood objects: Independence 

Covariance model: Matern 

Optimizer: Nelder-Mead 

Number of spatial coordinates: 300 
Number of dependent temporal realisations: 1 
Type of the random field: univariate 
Number of estimated parameters: 3 

Type of convergence: Successful 
Maximum log-Composite-Likelihood value: -393.74

Estimated parameters:
    mean     mean1      sill  
 0.04444  -0.44121   0.80821  

##################################################################
> 
> 
> ################################################################
> ###
> ### Example 1. Maximum conditional pairwise likelihood fitting of
> ### a Gaussian RF using BFGS
> ### 
> ###############################################################
> fit1 <- GeoFit(data=data,coordx=coords,corrmodel=corrmodel, 
+                     neighb=3,likelihood="Conditional",optimizer="BFGS",
+                     type="Pairwise", start=start,fixed=fixed,X=X)
> print(fit1)

##################################################################
Maximum  Composite-Likelihood Fitting of Gaussian Random Fields

Setting: Conditional Composite-Likelihood 

Model: Gaussian 

Type of the likelihood objects: Pairwise 

Covariance model: Matern 

Optimizer: BFGS 

Number of spatial coordinates: 300 
Number of dependent temporal realisations: 1 
Type of the random field: univariate 
Number of estimated parameters: 4 

Type of convergence: Successful 
Maximum log-Composite-Likelihood value: -1017.24

Estimated parameters:
     mean      mean1      scale       sill  
 0.001235  -0.391624   0.051202   0.777630  

##################################################################
> 
> ################################################################
> ###
> ### Example 2. Standard Maximum likelihood fitting of
> ### a Gaussian RF using nlminb
> ###
> ###############################################################
> # Define the spatial-coordinates of the points:
> set.seed(3)
> N=100  # number of location sites
> x <- runif(N, 0, 1)
> set.seed(6)
> y <- runif(N, 0, 1)
> coords <- cbind(x,y)
> 
> param<-list(mean=mean,sill=sill,nugget=nugget,scale=scale,smooth=smooth)
> 
> data <- GeoSim(coordx=coords,corrmodel=corrmodel, param=param)$data
> 
> # setting fixed and parameters to be estimated
> fixed<-list(nugget=nugget,smooth=smooth)
> start<-list(mean=mean,scale=scale,sill=sill)
> 
> I=Inf
> lower<-list(mean=-I,scale=0,sill=0)
> upper<-list(mean=I,scale=I,sill=I)
> fit2 <- GeoFit(data=data,coordx=coords,corrmodel=corrmodel,
+                     optimizer="nlminb",upper=upper,lower=lower,
+                     likelihood="Full",type="Standard", 
+                     start=start,fixed=fixed)
> print(fit2)

##################################################################
Maximum  Likelihood Fitting of Gaussian Random Fields

Setting: Full Likelihood 

Model: Gaussian 

Type of the likelihood objects: Standard 

Covariance model: Matern 

Optimizer: nlminb 

Number of spatial coordinates: 100 
Number of dependent temporal realisations: 1 
Type of the random field: univariate 
Number of estimated parameters: 3 

Type of convergence: Successful 
Maximum log-Likelihood value: -122.29
AIC : 250.6 
BIC : 258.4 

Estimated parameters:
    mean     scale      sill  
-0.01060   0.07271   0.93470  

##################################################################
> 
> 
> ###############################################################
> ############ Examples of spatial non-Gaussian RFs #############
> ###############################################################
> 
> 
> ################################################################
> ###
> ### Example 3. Maximum pairwise likelihood fitting of a Weibull  RF 
> ### with Generalized Wendland correlation with Nelder-Mead
> ### 
> ###############################################################
> set.seed(524)
> # Define the spatial-coordinates of the points:
> N=300
> x <- runif(N, 0, 1)
> y <- runif(N, 0, 1)
> coords <- cbind(x,y)
> X=cbind(rep(1,N),runif(N))
> mean=1; mean1=2 # regression parameters
> nugget=0
> shape=2
> scale=0.2
> smooth=0
> 
> model="Weibull"
> corrmodel="GenWend"
> param=list(mean=mean,mean1=mean1,sill=1,scale=scale,
+                      shape=shape,nugget=nugget,power2=4,smooth=smooth)
> # Simulation of a  non stationary weibull RF:
> data <- GeoSim(coordx=coords, corrmodel=corrmodel,model=model,X=X,
+            param=param)$data
> 
> fixed<-list(nugget=nugget,power2=4,sill=1,smooth=smooth)
> start<-list(mean=mean,mean1=mean1,scale=scale,shape=shape)
> 
> # Maximum conditional composite-likelihood fitting of the RF:
> fit <- GeoFit(data=data,coordx=coords,corrmodel=corrmodel, model=model,
+                     neighb=3,likelihood="Conditional",type="Pairwise",X=X,
+                     optimizer="Nelder-Mead",
+                     start=start,fixed=fixed)
> print(fit$param)
$mean
[1] 0.9991446

$mean1
[1] 1.958527

$scale
[1] 0.1591767

$shape
[1] 2.082499

> 
> 
> 
> ################################################################
> ###
> ### Example 4. Maximum pairwise likelihood fitting of
> ### a SinhAsinh-Gaussian spatial  RF with Wendland correlation
> ###
> ###############################################################
> set.seed(261)
> model="SinhAsinh"
> # Define the spatial-coordinates of the points:
> x <- runif(500, 0, 1)
> y <- runif(500, 0, 1)
> coords <- cbind(x,y)
> 
> corrmodel="Wend0"
> mean=0;nugget=0
> sill=1
> skew=-0.5
> tail=1.5
> power2=4
> c_supp=0.2
> 
> # model parameters
> param=list(power2=power2,skew=skew,tail=tail,
+              mean=mean,sill=sill,scale=c_supp,nugget=nugget)
> data <- GeoSim(coordx=coords, corrmodel=corrmodel,model=model, param=param)$data
> 
> plot(density(data))
> fixed=list(power2=power2,nugget=nugget)
> start=list(scale=c_supp,skew=skew,tail=tail,mean=mean,sill=sill)
> # Maximum marginal pairwise likelihood:
> fit1 <- GeoFit(data=data,coordx=coords,corrmodel=corrmodel, model=model,
+                     neighb=3,likelihood="Marginal",type="Pairwise",
+                     start=start,fixed=fixed)
> print(fit1$param)
$mean
[1] 0.09558448

$scale
[1] 0.1878042

$sill
[1] 1.369462

$skew
[1] -0.6800365

$tail
[1] 1.774269

> 
> 
> ################################################################
> ###
> ### Example 5. Maximum pairwise likelihood fitting of 
> ### a Binomial RF with exponential correlation 
> ###
> ###############################################################
> 
> set.seed(422)
> N=250
> x <- runif(N, 0, 1)
> y <- runif(N, 0, 1)
> coords <- cbind(x,y)
> mean=0.1; mean1=0.8; mean2=-0.5 # regression parameters
> X=cbind(rep(1,N),runif(N),runif(N)) # marix covariates
> corrmodel <- "Wend0"
> param=list(mean=mean,mean1=mean1,mean2=mean2,sill=1,nugget=0,scale=0.2,power2=4)
> # Simulation of the spatial Binomial-Gaussian RF:
> data <- GeoSim(coordx=coords, corrmodel=corrmodel, model="Binomial", n=10,X=X,
+              param=param)$data
> 
> 
> ## estimating the marginal parameters using independence cl
> fixed <- list(nugget=nugget,power2=4,sill=1)
> start <- list(mean=mean,mean1=mean1,mean2=mean2,scale=0.2)
> 
> # Maximum conditional pairwise likelihood:
> fit1 <- GeoFit(data=data, coordx=coords, corrmodel=corrmodel,n=10, X=X, 
+                     likelihood="Conditional",type="Pairwise",  neighb=3
+          ,model="Binomial", start=start, fixed=fixed, optimizer="BFGS")
>                   
> print(fit1)

##################################################################
Maximum  Composite-Likelihood Fitting of Binomial Random Fields

Setting: Conditional Composite-Likelihood 

Model: Binomial 

Type of the likelihood objects: Pairwise 

Covariance model: Wend0 

Optimizer: BFGS 

Number of spatial coordinates: 250 
Number of dependent temporal realisations: 1 
Type of the random field: univariate 
Number of estimated parameters: 4 

Type of convergence: Successful 
Maximum log-Composite-Likelihood value: -1368.44

Estimated parameters:
    mean     mean1     mean2     scale  
 0.07026   0.80214  -0.46729   0.20140  

##################################################################
> 
> 
> ###############################################################
> ######### Examples of spatio-temporal RFs ###########
> ###############################################################
> set.seed(52)
> # Define the temporal sequence:
> time <- seq(1, 9, 1)
> 
> # Define the spatial-coordinates of the points:
> x <- runif(20, 0, 1)
> set.seed(42)
> y <- runif(20, 0, 1)
> coords=cbind(x,y)
> 
> # Set the covariance model's parameters:
> corrmodel="Exp_Exp"
> scale_s=0.2/3
> scale_t=1
> sill=1
> nugget=0
> mean=0
> 
> param<-list(mean=0,scale_s=scale_s,scale_t=scale_t,
+             sill=sill,nugget=nugget)
> 
> # Simulation of the spatial-temporal Gaussian RF:
> data <- GeoSim(coordx=coords,coordt=time,corrmodel=corrmodel,
+               param=param)$data
> 
> ################################################################
> ###
> ### Example 6. Maximum pairwise likelihood fitting of a
> ### space time Gaussian RF with double-exponential correlation
> ###
> ###############################################################
> # Fixed parameters
> fixed<-list(nugget=nugget)
> # Starting value for the estimated parameters
> start<-list(mean=mean,scale_s=scale_s,scale_t=scale_t,sill=sill)
> 
> # Maximum composite-likelihood fitting of the RF:
> fit <- GeoFit(data=data,coordx=coords,coordt=time,
+                     corrmodel="Exp_Exp",maxtime=1,neighb=3,
+                     likelihood="Marginal",type="Pairwise",
+                      start=start,fixed=fixed)
> print(fit)

##################################################################
Maximum  Composite-Likelihood Fitting of Gaussian Random Fields

Setting: Marginal Composite-Likelihood 

Model: Gaussian 

Type of the likelihood objects: Pairwise 

Covariance model: Exp_Exp 

Optimizer: Nelder-Mead 

Number of spatial coordinates: 20 
Number of dependent temporal realisations: 9 
Type of the random field: univariate 
Number of estimated parameters: 4 

Type of convergence: Successful 
Maximum log-Composite-Likelihood value: -4108.54

Estimated parameters:
    mean   scale_s   scale_t      sill  
-0.12419   0.07261   1.16794   0.94882  

##################################################################
> 
> 
> ###############################################################
> ######### Examples of  spatial bivariate RFs ###########
> ###############################################################
> 
> 
> ################################################################
> ###
> ### Example 7. Maximum pairwise  likelihood fitting of a
> ### bivariate Gaussian RF with separable Bivariate  matern 
> ### (cross) correlation model 
> ###
> ###############################################################
> 
> # Define the spatial-coordinates of the points:
> set.seed(8)
> x <- runif(200, 0, 1)
> y <- runif(200, 0, 1)
> coords=cbind(x,y)
> # parameters
> param=list(mean_1=0,mean_2=0,scale=0.1,smooth=0.5,sill_1=1,sill_2=1,
+            nugget_1=0,nugget_2=0,pcol=0.2)
> 
> # Simulation of a spatial bivariate Gaussian RF:
> data <- GeoSim(coordx=coords, corrmodel="Bi_Matern_sep", 
+               param=param)$data
> 
> # selecting fixed and estimated parameters
> fixed=list(nugget_1=0,nugget_2=0,smooth=0.5)
> start=list(mean_1=0,mean_2=0,sill_1=var(data[1,]),sill_2=var(data[2,]),
+            scale=0.1,pcol=cor(data[1,],data[2,]))
> 
> 
> # Maximum marginal pairwise likelihood
> fitcl<- GeoFit(data=data, coordx=coords, corrmodel="Bi_Matern_sep",
+                      likelihood="Marginal",type="Pairwise",
+                      optimizer="BFGS" , start=start,fixed=fixed,
+                      neighb=c(3,3,3))