#### example with an adjacency matrix (autoregressive model)
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.
data(blackcap)
fullfit <- corrHLfit(migStatus ~ means+ Matern(1|latitude+longitude),data=blackcap,
HLmethod="ML") ## takes ~ 6s
summary(fullfit)
nullfit <- corrHLfit(migStatus ~ 1 + Matern(1|latitude+longitude),data=blackcap,
HLmethod="ML") ## takes ~ 3s
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