0
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – user332577 Oct 19 at 16:59
  • $\begingroup$ Kelly's paper Understanding Persistence discusses using Matern's function for spatial correlations. researchgate.net/publication/… $\endgroup$ – user332577 Oct 19 at 16:59
0
$\begingroup$

I understand that the type of data you have is a dot pattern, but you are trying to analyze area data.

For that you would have to geocode these coordinates to get the approximate address of each one and the neighborhood information, but this part of the geocode is not very well formatted, it comes as a string so you would have to get the neighborhood information out of that string and make a table to count how many crimes happened in each neighborhood.

Another alternative would be to use point pattern analysis. There is a package called spatstat that does this type of analysis. I never dealt with dot pattern modeling, I just know that it is possible to assign characteristics to these events (which they call the marked point pattern)

https://rpubs.com/spring19cp6521/Week11_Wednesday1 here is information about spatstat. https://rspatial.org/raster/rosu/Chapter5.html here is an example with crimes and different types of crimes.

I hope it helps.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.