data(oldcol)
col.W <- nb2listw(COL.nb, style="W")
crime <- COL.OLD$CRIME
lee.test(crime, crime, col.W, zero.policy=TRUE)
#Test with missing values
x<-crime
y<-crime
x[1:5]<-NA
y[3:7]<-NA
lee.test(x, y, col.W, zero.policy=TRUE, na.action=na.omit)
# lee.test(x, y, col.W, zero.policy=TRUE)#Stops with an error
data(boston, package="spData")
lw<-nb2listw(boston.soi)
x<-boston.c$CMEDV
y<-boston.c$CRIM
lee.test(x, y, lw, zero.policy=TRUE, alternative="less")
#Test with missing values
x[1:5]<-NA
y[3:7]<-NA
lee.test(x, y, lw, zero.policy=TRUE, alternative="less", na.action=na.omit)
Run the code above in your browser using DataLab