## Not run:
# data(Katrina)
# attach(Katrina)
# table(y1) # 300 of the 673 firms reopened during 0-3 months horizon, p.1016
# table(y2) # 425 of the 673 firms reopened during 0-6 months horizon, p.1016
# table(y3) # 478 of the 673 firms reopened during 0-12 months horizon, p.1016
# detach(Katrina)
#
#
# # replicate LeSage et al. (2011), Table 3, p.1017
# require(spdep)
#
# # (a) 0-3 months time horizon
# # LeSage et al. (2011) use k=11 nearest neighbors in this case
# nb <- knn2nb(knearneigh(cbind(Katrina$lat, Katrina$long), k=11))
# listw <- nb2listw(nb, style="W")
# W1 <- as(as_dgRMatrix_listw(listw), "CsparseMatrix")
#
# fit1_cond <- SpatialProbitFit(y1 ~ flood_depth + log_medinc + small_size +
# large_size +low_status_customers + high_status_customers +
# owntype_sole_proprietor + owntype_national_chain,
# W=W1, data=Katrina, DGP='SAR', method="conditional", varcov="varcov")
# summary(fit1_cond)
#
# fit1_FL <- SpatialProbitFit(y1 ~ flood_depth + log_medinc + small_size +
# large_size +low_status_customers + high_status_customers +
# owntype_sole_proprietor + owntype_national_chain,
# W=W1, data=Katrina, DGP='SAR', method="full-lik", varcov="varcov")
# summary(fit1_FL)
#
# fit1_cond_10nn <- SpatialProbitFit(y1 ~ flood_depth+ log_medinc+ small_size+
# large_size +low_status_customers + high_status_customers +
# owntype_sole_proprietor + owntype_national_chain,
# W=W1, data=Katrina, DGP='SAR', method="conditional", varcov="varcov",
# control=list(iW_CL=10))
# summary(fit1_cond_10nn)
#
# # (b) 0-6 months time horizon
# # LeSage et al. (2011) use k=15 nearest neighbors
# nb <- knn2nb(knearneigh(cbind(Katrina$lat, Katrina$long), k=15))
# listw <- nb2listw(nb, style="W")
# W2 <- as(as_dgRMatrix_listw(listw), "CsparseMatrix")
#
# fit2_cond <- SpatialProbitFit(y2 ~ flood_depth + log_medinc + small_size +
# large_size + low_status_customers + high_status_customers +
# owntype_sole_proprietor + owntype_national_chain,
# W=W2, data=Katrina, DGP='SAR', method="full-lik", varcov="varcov")
# summary(fit2_cond)
#
# fit2_FL <- SpatialProbitFit(y2 ~ flood_depth + log_medinc + small_size +
# large_size + low_status_customers + high_status_customers +
# owntype_sole_proprietor + owntype_national_chain,
# W=W2, data=Katrina, DGP='SAR', method="full-lik", varcov="varcov")
# summary(fit2_FL)
#
# # (c) 0-12 months time horizon
# # LeSage et al. (2011) use k=15 nearest neighbors as in 0-6 months
# W3 <- W2
# fit3_cond <- SpatialProbitFit(y3 ~ flood_depth + log_medinc + small_size +
# large_size + low_status_customers + high_status_customers +
# owntype_sole_proprietor + owntype_national_chain,
# W=W3, data=Katrina, DGP='SAR', method="conditional", varcov="varcov")
# summary(fit3_cond)
#
# fit3_FL <- SpatialProbitFit(y3 ~ flood_depth + log_medinc + small_size +
# large_size + low_status_customers + high_status_customers +
# owntype_sole_proprietor + owntype_national_chain,
# W=W3, data=Katrina, DGP='SAR', method="full-lik", varcov="varcov")
# summary(fit3_FL)
#
# # replicate LeSage et al. (2011), Table 4, p.1018
# # SAR probit model effects estimates for the 0-3-month time horizon
# effects(fit1_cond)
#
# # replicate LeSage et al. (2011), Table 5, p.1019
# # SAR probit model effects estimates for the 0-6-month time horizon
# effects(fit2_cond)
#
# # replicate LeSage et al. (2011), Table 6, p.1020
# # SAR probit model effects estimates for the 0-12-month time horizon
# effects(fit3_cond)
# ## End(Not run)
Run the code above in your browser using DataLab