# Running a spatial model without having a panel dataset

I am trying to run a linear probability model with spatial lagged Xs in R.

The idea is to have the crime_type_1, a binary variable, as the dependent variable, and the faction as the independent variable that is also a binary variable. I have one observation for each crime committed with information on the date, the neighborhood that occurred, and the faction that committed the crime. This means that I don't have a panel because each date and neighborhood is linked to more than one observation. I tried to run a Morans'I test with the command lm.morantest, but I couldn't because the data has more observations than the spatial weighted matrix, which is the number of neighborhoods.

Below we have a small sample of the data that I am using to run the model.

structure(list(neighborhood = c("CORDOVIL", "COSTA BARROS", "INHOAIBA",
"BONSUCESSO", "BANGU", "SANTA TERESA"), Date = structure(c(12784,
12784, 12784, 12784, 12784, 12784), class = "Date"), faction = c("TRAFICO",
"TRAFICO", "TRAFICO", "TRAFICO", "TRAFICO", "TRAFICO"), crime_type_1 = c(FALSE,
FALSE, TRUE, FALSE, FALSE, FALSE)), row.names = c(NA, -6L), class = c("tbl_df",
"tbl", "data.frame"))


I would like to know if it is possible to run this model without having a panel dataset. Thank you.

• I don't have a panel because each date and neighborhood is linked to more than one observation Where did you come up with this rule? I've never heard of it. Regardless, it is possible to restructure your data to reflect the simultaneity of the crimes. Let your common unit of analysis be the date and have a set of faction and neighborhood dummy variables where ones are entered in the rows (dates) when the crime is committed and zero otherwise. – user332577 Oct 19 at 16:59
• Kelly's paper Understanding Persistence discusses using Matern's function for spatial correlations. researchgate.net/publication/… – user332577 Oct 19 at 16:59