# NOT RUN {
## See examples in help("HLCor"), help("Loaloa"), help("make_scaled_dist"), etc.
## Matern correlations in 4-dimensional space:
set.seed(123)
randpts <- matrix(rnorm(20),nrow=5)
distMatrix <- as.matrix(proxy::dist(randpts))
MaternCorr(distMatrix,nu=2)
## Group-specific random effects
if (spaMM.getOption("example_maxtime")>1.6) {
data("blackcap")
# grouped effect using the '%in%' syntax:
fm <- cbind(blackcap,sex=c(rep(TRUE,7),rep(FALSE,7)))
fitme(migStatus ~ 1 + Matern(1|latitude+longitude %in% sex),data=fm)
# Superficially similar aim for distinct random effects for each sex,
# but here with distinct covariance parameters for each of them:
fm$female <- fm$sex; fm$male <- ! fm$female
fitme(migStatus ~ 1 + Matern(female|latitude+longitude)+
Matern(male|latitude+longitude),data=fm)
}
# }
Run the code above in your browser using DataLab