Our analysis is based on samples from three countries in West Africa. The data are in the period of 1990 to 2018 on seven variables ( One dependent variable and six independent variables). The code used is as follows.
data <- read.csv(paste(my.dir,'testdata.csv',sep=""))
Wafrica <- raster::getData("GADM", country = "Benin", level = 1)
Wafrica2 <- raster::getData("GADM", country = "Nigeria", level = 1)
Wafrica3 <- raster::getData("GADM", country = "Togo", level = 1)
weafrica <- merge(Wafrica, Wafrica2, Wafrica3)
map_crd <- coordinates(weafrica)
Points <- SpatialPoints(map_crd)
knn_k <- knearneigh(Points, k=3)
k_nb <- knn2nb(knn_k)
wknn_k <- nb2listw(k_nb, style="W")
fm <- REC ~ ACT + ATE + EIL + TEO + CO2 + TFE
slmtest(fm, data = data, listw = wknn_k, test="lml", model="within")
The follow was the error received at the end of the code.
Error in bigW %*% hatY : not conformable for multiplication
Kindly assist me in looking at the code to get desire result instead of the error message am seeing.