# NOT RUN {
# Example with an adjacency matrix (autoregressive model):
if (spaMM.getOption("example_maxtime")>0.7) {
corrHLfit(cases~I(prop.ag/10) +adjacency(1|gridcode)+offset(log(expec)),
adjMatrix=Nmatrix,family=poisson(),data=scotlip,method="ML")
}
#### Examples with Matern correlations
## A likelihood ratio test based on the ML fits of a full and of a null model.
if (spaMM.getOption("example_maxtime")>1.4) {
data("blackcap")
(fullfit <- corrHLfit(migStatus ~ means+ Matern(1|latitude+longitude),data=blackcap,
method="ML") )
(nullfit <- corrHLfit(migStatus ~ 1 + Matern(1|latitude+longitude),data=blackcap,
method="ML",init.corrHLfit=list(phi=1e-6)))
## p-value:
1-pchisq(2*(logLik(fullfit)-logLik(nullfit)),df=1)
}
# }
Run the code above in your browser using DataLab