## 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(Leuca)
subLeuca <- Leuca[c(1:10,79:88),] # subset of 10 females and 10 males, for faster examples.
# Independent Matern random effect with different covariance parameters for each sex:
fitme(fec_div ~ sex + Matern(female|x + y) + Matern(male|x + y), data = subLeuca)
# Independent Matern random effect with the same covariance parameters for each sex:
fitme(fec_div ~ sex + Matern(1|x+y %in% sex),data=subLeuca)
# Matern models with random-effects distinct but correlated across sexes
# can also be fitted: see Matern examples in help("composite-ranef").
}
Run the code above in your browser using DataLab