Skip to content

geostatsp

Geostatistical Modelling with Likelihood and Bayes

v2.0.11 · Feb 26, 2026 · GPL

Description

Geostatistical modelling facilities using 'SpatRaster' and 'SpatVector' objects are provided. Non-Gaussian models are fit using 'INLA', and Gaussian geostatistical models use Maximum Likelihood Estimation. For details see Brown (2015) <doi:10.18637/jss.v063.i12>. The 'RandomFields' package is available at <https://www.wim.uni-mannheim.de/schlather/publications/software>.

Downloads

386

Last 30 days

9821st

1.4K

Last 90 days

5.8K

Last year

Trend: -40.8% (30d vs prior 30d)

CRAN Check Status

3 ERROR
3 NOTE
8 OK
Show all 14 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang ERROR
r-devel-linux-x86_64-fedora-gcc ERROR
r-devel-macos-arm64 OK
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 NOTE
r-oldrel-macos-x86_64 NOTE
r-oldrel-windows-x86_64 NOTE
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 ERROR
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK
Check details (8 non-OK)
ERROR r-devel-linux-x86_64-fedora-clang

examples

Running examples in ‘geostatsp-Ex.R’ failed
The error most likely occurred in:

> ### Name: RFsimulate
> ### Title: Simulation of Random Fields
> ### Aliases: RFsimulate modelRandomFields RFsimulate RFsimulate-methods
> ###   RFsimulate,ANY,SpatRaster-method RFsimulate,numeric,SpatRaster-method
> ###   RFsimulate,numeric,SpatVector-method
> ###   RFsimulate,RMmodel,SpatVector-method
> ###   RFsimulate,RMmodel,SpatRaster-method
> ###   RFsimulate,matrix,SpatRaster-method
> ###   RFsimulate,matrix,SpatVector-method RFsimulate,data.frame,ANY-method
> ### Keywords: spatial
> 
> ### ** Examples
> 
> library('geostatsp')
> 
> # exclude this line to use the RandomFields package
> options(useRandomFields = FALSE)
> 
> model1 <- c(var=5, range=1,shape=0.5)
> 
> 
> myraster = rast(nrows=20,ncols=30,extent = ext(0,6,0,4), 
+ 	crs="+proj=utm +zone=17 +datum=NAD27 +units=m +no_defs")
> 
> set.seed(0) 
> 
> simu <- RFsimulate(model1, x=myraster, n=3)
install the RandomFields package for faster simulations
OMP: Warning #96: Cannot form a team with 24 threads, using 2 instead.
OMP: Hint Consider unsetting KMP_DEVICE_THREAD_LIMIT (KMP_ALL_THREADS), KMP_TEAMS_THREAD_LIMIT, and OMP_THREAD_LIMIT (if any are set).
ERROR r-devel-linux-x86_64-fedora-clang

tests

Running ‘RFsimulate.R’ [89m/57m]
  Running ‘krige.R’ [23s/28s]
  Running ‘lgcp.R’ [20s/26s]
  Running ‘lgm.R’ [73s/84s]
  Running ‘lgmRaster.R’ [0m/31m]
  Running ‘likfitLgm.R’
Running the tests in ‘tests/RFsimulate.R’ failed.
Complete output:
  > library("geostatsp")
  Loading required package: Matrix
  Loading required package: terra
  terra 1.9.11
  > 
  > Sys.setenv(
  +   OMP_NUM_THREADS = "2",
  +   OPENBLAS_NUM_THREADS = "2",
  +   MKL_NUM_THREADS = "2",
  +   BLIS_NUM_THREADS = "2",
  +   VECLIB_MAXIMUM_THREADS = "2",   # macOS Accelerate
  +   NUMEXPR_NUM_THREADS = "2"
  + )
  > options(mc.cores = 2)
  > 
  > model <- c(var=5, range=20,shape=0.5)
  > 
  > # any old crs
  > theCrs = "+proj=utm +zone=17 +datum=NAD27 +units=m +no_defs"
  > 
  > # don't test using the randomFields package, it's currently broken on some R builds
  > options(useRandomFields = FALSE)
  > 
  >   myraster = rast(nrows=20,ncols=20,extent = ext(100,110,100,110), 
  +     crs=theCrs)
  > 
  > set.seed(0)

...[truncated]...
g the tests in ‘tests/lgmRaster.R’ failed.
Complete output:
  > #+ setup
  > library('geostatsp')
  Loading required package: Matrix
  Loading required package: terra
  terra 1.9.11
  > #'
  > 
  > #' # simulated data
  > 
  > # exclude this line to use the RandomFields package
  > options(useRandomFields = FALSE)
  > 
  > Ncell =  40
  > 
  > myRaster = squareRaster(ext(0,6000,0,6000), Ncell)
  > 
  > myParam=c(oneminusar=0.1, conditionalVariance=2.5^2,shape=2)
  > myQ = maternGmrfPrec(myRaster, param=myParam)
  > attributes(myQ)$info$optimalShape
       shape   variance      range   cellSize 
    4.092496 110.524266 900.000000 150.000000 
  > set.seed(0)
  > mySim = RFsimulate(attributes(myQ)$info$optimalShape, myRaster)
  install the RandomFields package for faster simulations
  OMP: Warning #96: Cannot form a team with 24 threads, using 2 instead.
  OMP: Hint Consider unsetting KMP_DEVICE_THREAD_LIMIT (KMP_ALL_THREADS), KMP_TEAMS_THREAD_LIMIT, and OMP_THREAD_LIMIT (if any are set).
ERROR r-devel-linux-x86_64-fedora-gcc

examples

Running examples in ‘geostatsp-Ex.R’ failed
The error most likely occurred in:

> ### Name: RFsimulate
> ### Title: Simulation of Random Fields
> ### Aliases: RFsimulate modelRandomFields RFsimulate RFsimulate-methods
> ###   RFsimulate,ANY,SpatRaster-method RFsimulate,numeric,SpatRaster-method
> ###   RFsimulate,numeric,SpatVector-method
> ###   RFsimulate,RMmodel,SpatVector-method
> ###   RFsimulate,RMmodel,SpatRaster-method
> ###   RFsimulate,matrix,SpatRaster-method
> ###   RFsimulate,matrix,SpatVector-method RFsimulate,data.frame,ANY-method
> ### Keywords: spatial
> 
> ### ** Examples
> 
> library('geostatsp')
> 
> # exclude this line to use the RandomFields package
> options(useRandomFields = FALSE)
> 
> model1 <- c(var=5, range=1,shape=0.5)
> 
> 
> myraster = rast(nrows=20,ncols=30,extent = ext(0,6,0,4), 
+ 	crs="+proj=utm +zone=17 +datum=NAD27 +units=m +no_defs")
> 
> set.seed(0) 
> 
> simu <- RFsimulate(model1, x=myraster, n=3)
install the RandomFields package for faster simulations
ERROR r-devel-linux-x86_64-fedora-gcc

tests

Running ‘RFsimulate.R’ [90m/58m]
  Running ‘krige.R’ [22s/29s]
  Running ‘lgcp.R’ [71s/80s]
  Running ‘lgm.R’ [65s/73s]
  Running ‘lgmRaster.R’ [0m/29m]
  Running ‘likfitLgm.R’
Running the tests in ‘tests/RFsimulate.R’ failed.
Complete output:
  > library("geostatsp")
  Loading required package: Matrix
  Loading required package: terra
  terra 1.9.1
  > 
  > Sys.setenv(
  +   OMP_NUM_THREADS = "2",
  +   OPENBLAS_NUM_THREADS = "2",
  +   MKL_NUM_THREADS = "2",
  +   BLIS_NUM_THREADS = "2",
  +   VECLIB_MAXIMUM_THREADS = "2",   # macOS Accelerate
  +   NUMEXPR_NUM_THREADS = "2"
  + )
  > options(mc.cores = 2)
  > 
  > model <- c(var=5, range=20,shape=0.5)
  > 
  > # any old crs
  > theCrs = "+proj=utm +zone=17 +datum=NAD27 +units=m +no_defs"
  > 
  > # don't test using the randomFields package, it's currently broken on some R builds
  > options(useRandomFields = FALSE)
  > 
  >   myraster = rast(nrows=20,ncols=20,extent = ext(100,110,100,110), 
  +     crs=theCrs)
  > 
  > set.seed(0)
  > simu = RFsimulate(model = rbind(a=model, b=model+0.1), 
  +   x=myraster, n=4
  + )
Running the tests in ‘tests/lgmRaster.R’ failed.
Complete output:
  > #+ setup
  > library('geostatsp')
  Loading required package: Matrix
  Loading required package: terra
  terra 1.9.1
  > #'
  > 
  > #' # simulated data
  > 
  > # exclude this line to use the RandomFields package
  > options(useRandomFields = FALSE)
  > 
  > Ncell =  40
  > 
  > myRaster = squareRaster(ext(0,6000,0,6000), Ncell)
  > 
  > myParam=c(oneminusar=0.1, conditionalVariance=2.5^2,shape=2)
  > myQ = maternGmrfPrec(myRaster, param=myParam)
  > attributes(myQ)$info$optimalShape
       shape   variance      range   cellSize 
    4.092496 110.524266 900.000000 150.000000 
  > set.seed(0)
  > mySim = RFsimulate(attributes(myQ)$info$optimalShape, myRaster)
  install the RandomFields package for faster simulations
NOTE r-oldrel-macos-arm64

package dependencies

Package suggested but not available for checking: ‘RandomFields’

Package which this enhances but not available for checking: ‘INLA’
NOTE r-oldrel-macos-x86_64

package dependencies

Package suggested but not available for checking: ‘RandomFields’

Package which this enhances but not available for checking: ‘INLA’
NOTE r-oldrel-windows-x86_64

package dependencies

Package suggested but not available for checking: 'RandomFields'
ERROR r-release-macos-arm64

tests

Running ‘RFsimulate.R’ [3s/3s]
  Running ‘krige.R’ [3s/3s]
  Running ‘lgcp.R’ [2s/2s]
  Running ‘lgm.R’ [7s/7s]
  Running ‘lgmRaster.R’ [49s/22s]
  Running ‘likfitLgm.R’ [2s/2s]
  Running ‘matern.R’ [2s/2s]
  Running ‘maternGmrfPrec.R’ [3s/3s]
  Running ‘profLlgm.R’ [2s/2s]
Running the tests in ‘tests/profLlgm.R’ failed.
Complete output:
  > 
  > library('geostatsp')
  Loading required package: Matrix
  Loading required package: terra
  terra 1.9.11
  > data('swissRain')
  > swissRain = unwrap(swissRain)
  > swissAltitude = unwrap(swissAltitude)
  > 
  > Ncores = c(1,2)[1+(.Platform$OS.type=='unix')]
  > 
  > 
  > 
  > sr2 = swissRain
  > sr2$elev = extract(swissAltitude, sr2)
  Warning message:
  [`[[<-`] only using the first column 
  > swissFit = likfitLgm(
  +     data=sr2, 
  +     formula=rain~ elev,
  +     param=c(range=10000,shape=1,nugget=0,boxcox=0.5,anisoRatio=2,anisoAngleDegrees=45),
  +     paramToEstimate = c("range",'anisoAngleDegrees','anisoRatio'),
  +     reml=FALSE,
...[truncated]...
  11: FUN(X[[i]], ...)
  12: lapply(seq_len(cores), inner.do)
  13: mclapply(seq_len(n), do_one, mc.preschedule = mc.preschedule,     mc.set.seed = mc.set.seed, mc.silent = mc.silent, mc.cores = mc.cores,     mc.cleanup = mc.cleanup, affinity.list = affinity.list)
  14: parallel::mcmapply(likfitLgm, param = parList, MoreArgs = list(data = as.data.frame(fit$data),     formula = fit$model$formula, paramToEstimate = reEstimate,     reml = fit$model$reml, coordinates = terra::crds(fit$data)),     mc.cores = mc.cores, SIMPLIFY = FALSE)
  15: profLlgm(swissFit, mc.cores = Ncores, range = seq(15000, 55000,     len = 12))
  An irrecoverable exception occurred. R is aborting now ...
  Error in resL[grep("^m2logL", rownames(resL)), ] : 
    incorrect number of dimensions
  Calls: profLlgm
  In addition: Warning message:
  In mclapply(seq_len(n), do_one, mc.preschedule = mc.preschedule,  :
    scheduled cores 1, 2 did not deliver results, all values of the jobs will be affected
  Execution halted

Check History

ERROR 7 OK · 3 NOTE · 0 WARNING · 4 ERROR · 0 FAILURE Mar 10, 2026
ERROR r-devel-linux-x86_64-fedora-clang

examples

Running examples in ‘geostatsp-Ex.R’ failed
The error most likely occurred in:

> ### Name: RFsimulate
> ### Title: Simulation of Random Fields
> ### Aliases: RFsimulate modelRandomFields RFsimulate RFsimulate-methods
> ###   RFsimulate,ANY,SpatRaste
...[truncated]...
 RandomFields package for faster simulations
OMP: Warning #96: Cannot form a team with 24 threads, using 2 instead.
OMP: Hint Consider unsetting KMP_DEVICE_THREAD_LIMIT (KMP_ALL_THREADS), KMP_TEAMS_THREAD_LIMIT, and OMP_THREAD_LIMIT (if any are set).
ERROR r-devel-linux-x86_64-fedora-gcc

examples

Running examples in ‘geostatsp-Ex.R’ failed
The error most likely occurred in:

> ### Name: RFsimulate
> ### Title: Simulation of Random Fields
> ### Aliases: RFsimulate modelRandomFields RFsimulate RFsimulate-methods
> ###   RFsimulate,ANY,SpatRaste
...[truncated]...
)
> 
> 
> myraster = rast(nrows=20,ncols=30,extent = ext(0,6,0,4), 
+ 	crs="+proj=utm +zone=17 +datum=NAD27 +units=m +no_defs")
> 
> set.seed(0) 
> 
> simu <- RFsimulate(model1, x=myraster, n=3)
install the RandomFields package for faster simulations
ERROR r-devel-macos-arm64

tests

Running ‘RFsimulate.R’ [3s/3s]
  Running ‘krige.R’ [3s/3s]
  Running ‘lgcp.R’ [12s/12s]
  Running ‘lgm.R’ [7s/7s]
  Running ‘lgmRaster.R’ [41s/21s]
  Running ‘likfitLgm.R’ [2s/2s]
  Running ‘matern.R’ [2s/2s]
  Running ‘maternGmrfPrec.R’ [3s/3s]
  Ru
...[truncated]...
 number of dimensions
  Calls: profLlgm
  In addition: Warning message:
  In mclapply(seq_len(n), do_one, mc.preschedule = mc.preschedule,  :
    scheduled cores 1, 2 did not deliver results, all values of the jobs will be affected
  Execution halted
ERROR r-release-macos-arm64

tests

Running ‘RFsimulate.R’ [3s/3s]
  Running ‘krige.R’ [3s/3s]
  Running ‘lgcp.R’ [2s/2s]
  Running ‘lgm.R’ [7s/7s]
  Running ‘lgmRaster.R’ [47s/21s]
  Running ‘likfitLgm.R’ [2s/2s]
  Running ‘matern.R’ [2s/2s]
  Running ‘maternGmrfPrec.R’ [3s/3s]
  Runn
...[truncated]...
 number of dimensions
  Calls: profLlgm
  In addition: Warning message:
  In mclapply(seq_len(n), do_one, mc.preschedule = mc.preschedule,  :
    scheduled cores 1, 2 did not deliver results, all values of the jobs will be affected
  Execution halted
NOTE r-oldrel-macos-arm64

package dependencies

Package suggested but not available for checking: ‘RandomFields’

Package which this enhances but not available for checking: ‘INLA’
NOTE r-oldrel-macos-x86_64

package dependencies

Package suggested but not available for checking: ‘RandomFields’

Package which this enhances but not available for checking: ‘INLA’
NOTE r-oldrel-windows-x86_64

package dependencies

Package suggested but not available for checking: 'RandomFields'

Dependency Network

Dependencies Reverse dependencies Matrix terra abind numDeriv geostatsp

Version History

new 2.0.11 Mar 10, 2026
updated 2.0.10 ← 2.0.8 diff Feb 25, 2026
updated 2.0.11 ← 2.0.10 diff Feb 25, 2026
updated 2.0.8 ← 2.0.6 diff Feb 6, 2025
updated 2.0.6 ← 2.0.3 diff Feb 19, 2024
updated 2.0.3 ← 2.0.1 diff Dec 4, 2023
updated 2.0.0 ← 1.8.6 diff Sep 21, 2023
updated 2.0.1 ← 2.0.0 diff Sep 21, 2023
updated 1.8.6 ← 1.8.5 diff Oct 4, 2021
updated 1.8.5 ← 1.8.4 diff Mar 18, 2021
updated 1.8.4 ← 1.8.2 diff Mar 10, 2021
updated 1.8.2 ← 1.8.1 diff Jun 23, 2020
updated 1.8.1 ← 1.8.0 diff May 4, 2020
updated 1.8.0 ← 1.7.8 diff Jan 28, 2020
updated 1.7.8 ← 1.7.7 diff Apr 15, 2019
updated 1.7.7 ← 1.7.2 diff Mar 5, 2019
updated 1.7.2 ← 1.7.1 diff Jul 12, 2018
updated 1.7.1 ← 1.6.0 diff Apr 18, 2018
updated 1.6.0 ← 1.5.4 diff Jan 3, 2018
updated 1.5.4 ← 1.4.4 diff Jul 18, 2017