#### example with an adjacency matrix (autoregressive model)
if (spaMM.getOption("example_maxtime")>4) {
data(scotlip)
corrHLfit(cases~I(prop.ag/10) +adjacency(1|gridcode)+offset(log(scotlip$expec)),
data=scotlip,family=poisson(),
adjMatrix=Nmatrix)
}
#### Examples with Matérn correlations
## A likelihood ratio test based on the ML fits of a full and of a null model.
if (spaMM.getOption("example_maxtime")>18) {
data(blackcap)
fullfit <- corrHLfit(migStatus ~ means+ Matern(1|latitude+longitude),data=blackcap,
HLmethod="ML")
summary(fullfit)
nullfit <- corrHLfit(migStatus ~ 1 + Matern(1|latitude+longitude),data=blackcap,
HLmethod="ML")
summary(nullfit)
## p-value:
1-pchisq(2*(logLik(fullfit)-logLik(nullfit)),df=1)
}
## see data set Loaloa for additional examples
Run the code above in your browser using DataLab