Extract specific Matern parameters from a parameter sequence
create.param.sequence.Rd
This function is used to obtain specific Matern parameters (e.g., range or smoothness) from the covparams slot of a PrestoGPModel object.
Value
A matrix with five rows and two columns as described below:
- Row 1:
Starting and ending indices for the sigma parameter(s)
- Row 2:
Starting and ending indices for the scale parameter(s)
- Row 3:
Starting and ending indices for the smoothness parameter(s)
- Row 4:
Starting and ending indices for the nugget(s)
- Row 5:
Starting and ending indices for the correlation parameter(s)
References
Apanasovich, T.V., Genton, M.G. and Sun, Y. "A valid Matérn class of cross-covariance functions for multivariate random fields with any number of components", Journal of the American Statistical Association (2012) 107(497):180-193.
Genton, M.G. "Classes of kernels for machine learning: a statistics perspective", The Journal of Machine Learning Research (2001) 2:299-312.
Examples
# Space/elevation model
data(soil250, package="geoR")
y2 <- soil250[,7] # predict pH level
X2 <- as.matrix(soil250[,c(4:6,8:22)])
# columns 1+2 are location coordinates; column 3 is elevation
locs2 <- as.matrix(soil250[,1:3])
soil.vm2 <- new("VecchiaModel", n_neighbors = 10)
# fit separate scale parameters for location and elevation
soil.vm2 <- prestogp_fit(soil.vm2, y2, X2, locs2, scaling = c(1, 1, 2))
#>
#> Beginning iteration 1
#> Estimating theta...
#> Estimation of theta complete
#> Estimating beta...
#> Estimation of beta complete
#> Iteration 1 complete
#> Current penalized likelihood: -257.1641
#> Current MSE: 0.009145274
#> Beginning iteration 2
#> Estimating theta...
#> Estimation of theta complete
#> Estimating beta...
#> Estimation of beta complete
#> Iteration 2 complete
#> Current penalized likelihood: -257.1641
#> Current MSE: 0.01052998
pseq <- create.param.sequence(1, 2)
soil2.params <- soil.vm2@covparams
# sigma
soil2.params[pseq[1,1]:pseq[1,2]]
#> [1] 0.005163835
# scale parameters
soil2.params[pseq[2,1]:pseq[2,2]]
#> [1] 5.73973612 0.05871139
# smoothness parameter
soil2.params[pseq[3,1]:pseq[3,2]]
#> [1] 1.21412
# nugget
soil2.params[pseq[4,1]:pseq[4,2]]
#> [1] 0.003865101
# Multivariate model
data(soil)
soil <- soil[!is.na(soil[,5]),] # remove rows with NA's
ym <- list()
ym[[1]] <- soil[,5] # predict two nitrogen concentration levels
ym[[2]] <- soil[,7]
Xm <- list()
Xm[[1]] <- Xm[[2]] <- as.matrix(soil[,c(4,6,8,9)])
locsm <- list()
locsm[[1]] <- locsm[[2]] <- as.matrix(soil[,1:2])
soil.mvm <- new("MultivariateVecchiaModel", n_neighbors = 10)
soil.mvm <- prestogp_fit(soil.mvm, ym, Xm, locsm)
#>
#> Beginning iteration 1
#> Estimating theta...
#> Estimation of theta complete
#> Estimating beta...
#> Estimation of beta complete
#> Iteration 1 complete
#> Current penalized likelihood: 1389.146
#> Current MSE: 55.26193
#> Beginning iteration 2
#> Estimating theta...
#> Estimation of theta complete
#> Estimating beta...
#> Estimation of beta complete
#> Iteration 2 complete
#> Current penalized likelihood: 1372.886
#> Current MSE: 121.7096
#> Beginning iteration 3
#> Estimating theta...
#> Estimation of theta complete
#> Estimating beta...
#> Estimation of beta complete
#> Iteration 3 complete
#> Current penalized likelihood: 1372.886
#> Current MSE: 180.2538
pseq <- create.param.sequence(2, 1)
soil.params <- soil.mvm@covparams
# sigmas
soil.params[pseq[1,1]:pseq[1,2]]
#> [1] 122.69734 35.99809
# scale parameters
soil.params[pseq[2,1]:pseq[2,2]]
#> [1] 1176.6249 544.9311
# smoothness parameters
soil.params[pseq[3,1]:pseq[3,2]]
#> [1] 0.15438886 0.05249064
# nuggets
soil.params[pseq[4,1]:pseq[4,2]]
#> [1] 16.51122 15.61946
# correlation
soil.corr <- diag(2) / 2
soil.corr[upper.tri(soil.corr)] <- soil.params[pseq[5,1]:pseq[5,2]]
soil.corr <- soil.corr + t(soil.corr)