Skip to content
Back to formatted view

Raw Message

Message-ID: <CABgUnxBHqbqbuKW35P_M=OKrQGNFFmE8Gn-Vt5RS+PYNF4akBg@mail.gmail.com>
Date: 2020-02-25T14:34:03Z
From: Chiedza Machingaidze
Subject: Error using predict.sarlm

I am running the following code:
Error in predict.sarlm(m1s, newdata = " geodata ", listw = shpw )

and getting the following error:
Error in predict.sarlm(m1s, newdata = "geodata", listw = shpw,  :
  newdata should have region.id as row.names

I did a search and found a post about the same problem:
http://r-sig-geo.2731867.n2.nabble.com/Error-while-using-predict-sarlm-td7592817.html


So, per the post, I have ensured that region.id matches row names:
> str(attr( geodatanb , "region.id"))
 chr [1:74] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14"
"15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29"
"30" "31" "32" "33" ...
> str(row.names(generalrateforpred))
 chr [1:74] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14"
"15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29"
"30" "31" "32" "33" ...
all(row.names(geodata at data) %in% attr( geodatanb, "region.id"))
[1] TRUE

Unfortunately, I'm still getting the error.

Could anyone offer any further assistance?

Thank you,
Chi

	[[alternative HTML version deleted]]