scpm-package: 'An R Package for Spatial Smoothing'

Description Author(s) Examples

Description

Group of functions for spatial smoothing using cubic splines and variogram maximum likelihood estimation. Also allow the inclusion of linear parametric terms and change-points for segmented smoothing splines models.

Author(s)

Mario A. Martinez Araya [aut,cre,cph]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
data(landim1, package = "scpm")
if(FALSE){
library(scpm)
##create tthe dataset
d <- as.sss(landim1, coords = NULL, coords.col = 1:2, data.col = 3:4)
##fitting spatial linear model with response A and covariate B
##Gneiting covariance function in the errors
m0 <- scp(A ~ linear(~ B), data = d, model = "RMgneiting")
##adding a bivariate cubic spline based on the coordinates
m1 <- scp(A ~ linear(~ B) + s2D(penalty = "cs"), data = d, model = "RMgneiting")
##plotting observed and estimated field from each model
par(mfrow=c(2,2))
plot(m0, what = "obs", type = "persp", main = "Model null - y")
plot(m0, what = "fit", type = "persp", main = "Model null - fit")
plot(m1, what = "obs", type = "persp", main = "Model alternative - y")
plot(m1, what = "fit", type = "persp", main = "Model alternative - fit")
##plotting the estimated semivariogram from each model
par(mfrow=c(1,2))
Variogram(m0,main="Semivariogram - model null", ylim = c(0,0.7))
Variogram(m1,main="Semivariogram - model alternative", ylim = c(0,0.7))
##summary of the estimated coefficients
summary(m0)
summary(m1)
##some information criteria
AIC(m0)
AIC(m1)
AICm(m0)
AICm(m1)
AICc(m0)
AICc(m1)
BIC(m0)
BIC(m1)
}

Example output

Loading required package: Matrix
Loading required package: RandomFields
Loading required package: sp
Loading required package: RandomFieldsUtils

Attaching package: 'RandomFields'

The following object is masked from 'package:RandomFieldsUtils':

    RFoptions

Loading required package: interp

Attaching package: 'scpm'

The following object is masked from 'package:RandomFields':

    Variogram

Warning messages:
1: no DISPLAY variable so Tk is not available 
2: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
3: 'rgl_init' failed, running with rgl.useNULL = TRUE 
4: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
Warning message:
In data(landim1, package = "scpm") : data set 'landim1' not found

scpm documentation built on Feb. 17, 2020, 5:08 p.m.