#### 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,lower=list(rho=0),upper=list(rho=0.1745))
#### 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,
objective="p_v",HLmethod="ML") ## takes ~ 6s
summary(fullfit)
nullfit <- corrHLfit(migStatus ~ 1 + Matern(1|latitude+longitude),data=blackcap,
objective="p_v",HLmethod="ML") ## takes ~ 3s
summary(nullfit)
## p-value:
1-pchisq(2*(fullfit$hlfit$APHLs$p_v-nullfit$hlfit$APHLs$p_v),df=1)
## see data set Loaloa for additional examples
Run the code above in your browser using DataLab