Description Author(s) Examples
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.
Mario A. Martinez Araya [aut,cre,cph]
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)
}
|
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.