Public access to Automated External Defibrillators (AEDs) is an important public health strategy for improving survival rates from out-of-hospital cardiac arrest (OHCA). Early defibrillation will significantly increases the probability of survival, particularly when AEDs are accessible within the first few minutes after cardiac arrest. As a result, many large metropolitan cities have increasingly invested in public access defibrillation programs and expanded AED infrastructure in public spaces.
Warsaw which is the capital city of Poland has experienced substantial growth in AED deployment over the last decade. In 2009, only 117 AED devices distributed across 83 locations had been reported within the city (Cacko et al., 2010). Since then, the number of registered AEDs has increased considerably alongside the development of city and public health infrastructure.
However, the effectiveness of AED programs depends not only on the total number of devices, but also on their spatial accessibility. The spatial distribution of AEDs within urban environments is therefore critically important. In many cities, AEDs tend to cluster in commercial districts, office areas, transportation hubs, or densely populated neighbourhoods, which may create unequal access to emergency medical equipment across the city. Identifying these spatial patterns can help reveal areas of insufficient coverage and support future public health planning and resource allocation.
Based on publicly available AED location data for Warsaw, this project investigates the spatial distribution of AEDs using spatial point pattern analysis. The study focuses on whether AED locations are spatially clustered across the city, whether different accessibility categories show different spatial patterns, and whether AED intensity is associated with underlying population distribution. Therefore, the main objectives of this study are as follows:
The AED dataset was obtained from the open data portal of the City of Warsaw through the municipal API. The dataset is updated regularly and contains the geographic locations and attributes of registered AEDs in Warsaw. The original data can be accessed here: https://dane.um.warszawa.pl/en/catalogue/7bc32ffc-c2ac-4d32-83c9-b6f7a0b38de8
Firstly we can check all the variables included in the AED dataset.
These variables provide information about AED accessibility, location
characteristics, device specifications, and geographic coordinates. The
longitude (lon) and latitude (lat) variables
were later used to convert the dataset into a spatial object for spatial
point pattern analysis.
We can also check the accessibility-related variables in the dataset,
including device_public_access and
device_availability. The results show that AEDs were
recorded as either public (Publiczny) or private
(Prywatny), while availability information included full
access (Tak), limited access (Ograniczona), no
public access (Nie), or time-restricted access during
specific opening hours.
## [1] "defibrillator_id" "device_access_description"
## [3] "device_availability" "device_location"
## [5] "device_manufacturer" "device_public_access"
## [7] "device_specifications" "location_building"
## [9] "location_city" "location_description"
## [11] "location_object_name" "location_postcode"
## [13] "location_street" "lon"
## [15] "lat"
## [1] "Publiczny" "Prywatny"
## [1] "Ograniczona"
## [2] "Tak"
## [3] "Nie"
## [4] "Nie (dostęp: pon. - piątek 8:00 - 16:00)"
## [5] "dostęp w godz. 8:00 - 17:00"
Based on this, we can group the availability information into three
broader accessibility categories, “High”, “Limited”, and “Low”, to
simplify the analysis: AEDs labelled Tak (full public
access) were grouped as High accessibility. Devices with restricted
opening hours or partial access, such as Ograniczona,
dostęp w godz. 8:00 - 17:00, and
Nie (dostęp: pon. - piątek 8:00 - 16:00), were grouped as
Limited accessibility. AEDs labelled simply as Nie were
classified as Low accessibility. This reclassification made it easier to
compare spatial patterns between fully accessible, partially accessible,
and poorly accessible AEDs across Warsaw.
# Reclassify AED accessibility
aed$availability_mark <- case_when(
aed$device_availability == "Tak"
~ "High",
grepl("Ograniczona", aed$device_availability)
~ "Limited",
grepl("dostęp", aed$device_availability)
~ "Limited",
grepl("Nie", aed$device_availability)
~ "Low",
TRUE
~ "Unknown"
)
# Count accessibility categories
table(aed$availability_mark)##
## High Limited Low
## 96 97 421
Then we need to download the Warsaw administrative boundary from
GISCO and convert the AED locations into a planar point pattern (ppp)
object for use in the spatstat package. As we can see, one
AED point was excluded because it fell outside the Warsaw study boundary
after projection. The dataset also contained duplicated coordinates, so
a small random jitter (rjitter) was applied to overlapping points to
avoid computational issues. Finally, the coordinates were rescaled from
metres to kilometres to make the spatial results easier to
interpret.
# Download Warsaw boundary
pl <- gisco_get_nuts(country = "Poland", nuts_level = 3, resolution = "3")
warsaw <- pl[pl$NUTS_NAME == "Miasto Warszawa",]
# Transform to metric CRS
warsaw <- st_transform(warsaw, 3857)
aed_sf_proj <- st_transform(aed_sf, 3857)
# Create observation window
W <- as.owin(warsaw)
# Convert AED locations to point pattern
coords <- st_coordinates(aed_sf_proj)
aed_ppp <- ppp(
x = coords[,1],
y = coords[,2],
window = W)## Warning: 1 point was rejected as lying outside the specified window
## Warning: data contain duplicated points
# Handle duplicated points
aed_ppp <- rjitter(aed_ppp, amount = 5)
# Rescale from metres to kilometres
aed_ppp <- spatstat.geom::rescale(aed_ppp, 1000, "km")After data processing, the final point pattern contained 613 AED locations within the Warsaw study area, with an average intensity of 0.4456 AEDs per square kilometre. The spatial pattern already suggests that AEDs are not evenly distributed across the city: some areas appear to contain much higher concentrations of devices, while others have relatively limited coverage. This provides a good basis for further first-order and second-order spatial analysis to investigate clustering patterns and spatial accessibility in more detail.
## Planar point pattern: 613 points
## Average intensity 0.4463 points per square km
##
## Coordinates are given to 12 decimal places
##
## Window: polygonal boundary
## single connected closed polygon with 33 vertices
## enclosing rectangle: [2321.8, 2367.1] x [6818, 6867] km
## (45.35 x 48.31 km)
## Window area = 1373.45 square km
## Unit of length: 1 km
## Fraction of frame area: 0.627
First-order spatial analysis was conducted to examine the overall distribution and intensity of AED locations in Warsaw. From the quadrat count and CSR test we can see the AED locations are spatially clustered rather than randomly distributed across the city.
Kernel density estimation further shows that AEDs are concentrated mainly in central and more densely developed parts of Warsaw, while peripheral areas have lower AED intensity. The 3D density surface also highlights several strong hotspots of AED availability, which indicates unequal spatial accessibility to emergency medical equipment within the whole city.
To further check whether the AED locations follow a clustered or random spatial pattern, second-order spatial statistics were applied in this project. The nearest neighbour analysis shows that many AEDs are located close to each other, with a mean nearest neighbour distance of about 0.43 km. The distance map also suggests that AED coverage is much denser in the city centre, while outer areas have larger gaps between devices.
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00772 0.12990 0.30591 0.43440 0.61098 2.69839
We can further check from the K-function and L-function results that both curves lie clearly above the theoretical CSR (Complete Spatial Randomness) expectation across most distances. This suggests that AED locations in Warsaw are clearly clustered rather than randomly distributed. The pair correlation function also remains above 1 at shorter distances, which means many AEDs are located close to one another. Overall, the results show strong clustering at local scales, while the clustering effect becomes weaker as distance increases.
We can also confirm that the clustering pattern was statistically significant rather than caused by visual interpretation alone from the envelope tests and Clark–Evans test. Generally both tests provide strong evidence that AED locations in Warsaw are not randomly distributed. In the K-function and L-function envelope plots, we could see that the observed curves remain well above the simulation envelopes across most distances, which indicates significant spatial clustering.
# Envelope tests
K_env <- envelope(aed_ppp, Kest, nsim = 99, global = TRUE, verbose = FALSE)
L_env <- envelope(aed_ppp, Lest, nsim = 99, global = TRUE, verbose = FALSE)The Clark–Evans test shows a similarly strong result, with R = 0.56 and a very small p-value (< 0.001). Since values below 1 indicate clustering, the test further confirms that AEDs tend to concentrate in particular parts of the city rather than being evenly distributed across Warsaw.
##
## Clark-Evans test
## CDF correction
## Z-test
##
## data: aed_ppp
## R = 0.57, p-value <0.0000000000000002
## alternative hypothesis: clustered (R < 1)
To further investigate how AEDs with different accessibility levels are spatially distributed across Warsaw, the point pattern was converted into a marked point pattern using the three accessibility categories: High, Limited, and Low. Among the 613 AED locations, Low accessibility devices account for the majority of observations (approximately 69%), while High and Limited accessibility categories each represent around 16% of the dataset.
The marked point pattern shows clear differences between accessibility categories: Low accessibility AEDs dominate the overall spatial pattern, especially in central Warsaw, while High accessibility AEDs are less common and more unevenly distributed.
# Keep points inside study window
inside <- inside.owin(coords[,1], coords[,2], W)
aed_inside <- aed[inside, ]
# Create marked point pattern
aed_ppp_marked <- aed_ppp
marks(aed_ppp_marked) <- as.factor(aed_inside$availability_mark)
summary(aed_ppp_marked)## Marked planar point pattern: 613 points
## Average intensity 0.4463 points per square km
##
## Coordinates are given to 12 decimal places
##
## Multitype:
## frequency proportion intensity
## High 96 0.1566 0.06990
## Limited 97 0.1582 0.07062
## Low 420 0.6852 0.30580
##
## Window: polygonal boundary
## single connected closed polygon with 33 vertices
## enclosing rectangle: [2321.8, 2367.1] x [6818, 6867] km
## (45.35 x 48.31 km)
## Window area = 1373.45 square km
## Unit of length: 1 km
## Fraction of frame area: 0.627
From the split pattern plots and relative risk surfaces we can clearly see Low accessibility AEDs dominate most central and south-central parts of the city and form the main spatial structure of the overall pattern. High accessibility AEDs appear more concentrated in several eastern, north-western, and peripheral areas, while Limited accessibility devices show a more scattered pattern, particularly around western and northern Warsaw. These results suggest that areas with a high concentration of AEDs do not always provide the highest level of public accessibility, since many devices in central Warsaw belong to the Low accessibility category.
Except for checking the marked point pattern visually, we can also use second-order marked point pattern functions to test if different accessibility categories show systematic spatial interactions across the Warsaw city. In this project, the Kcross and Kdot functions were used to examine whether different accessibility categories tend to appear close to each other more often than would be expected if the AED locations were randomly distributed. The mark correlation and mark interaction functions further tested whether nearby AEDs tend to share similar accessibility characteristics.
Overall, the results suggest that different accessibility categories also show clear spatial structure and local clustering, particularly at shorter distances. One possible explanation is that AED accessibility is influenced by urban factors such as land use, building function, and infrastructure distribution across the city. For example, highly accessible AEDs are often located in transport hubs, shopping centres, or other places with continuous public access, while low accessibility AEDs are more likely to be placed inside offices, schools, or private buildings with restricted opening hours. Differences in population density and commercial development across Warsaw may also contribute to these spatial patterns.
# Second-order marked pattern analysis
par(mfrow = c(2,2), mar = c(2,2,3,1))
plot(alltypes(aed_ppp_marked, Kcross), main = "Kcross")After converting the AED locations into a marked planar point pattern, we can further conduct point process modelling analysis to examine how AED accessibility categories and spatial location influence the overall distribution pattern across Warsaw.
Before fitting the models, the coordinates were centred around the mean location of the study area. This helps reduce numerical instability in the spatial trend model and makes the parameter estimates easier to interpret.
In this analysis, two Poisson point process models were fitted: a stationary multitype Poisson process and a spatial trend model. The main difference between the two models is that the first model assumes a spatially constant distribution, while the second model additionally accounts for large-scale spatial variation across the city.
# Centre coordinates before spatial trend modelling
aed_ppp_marked <- spatstat.geom::shift(aed_ppp_marked,
origin = c(mean(aed_ppp_marked$x), mean(aed_ppp_marked$y)))
summary(aed_ppp_marked)## Marked planar point pattern: 613 points
## Average intensity 0.4463 points per square km
##
## Coordinates are given to 16 decimal places
##
## Multitype:
## frequency proportion intensity
## High 96 0.1566 0.06990
## Limited 97 0.1582 0.07062
## Low 420 0.6852 0.30580
##
## Window: polygonal boundary
## single connected closed polygon with 33 vertices
## enclosing rectangle: [-17.649, 27.704] x [-23.701, 24.608] km
## (45.35 x 48.31 km)
## Window area = 1373.45 square km
## Unit of length: 1 km
## Fraction of frame area: 0.627
The first model assumes that the AED locations are spatially stationary and only depend on the accessibility category (marks). The results show that the coefficient for Low accessibility AEDs is large and highly significant, meaning that Low accessibility devices appear much more frequently than the reference category (High accessibility AEDs). On the other hand, the coefficient for Limited accessibility AEDs is very small and not statistically significant, which suggests that their overall intensity is quite similar to the High accessibility group.
## Estimate S.E. CI95.lo CI95.hi Ztest Zval
## (Intercept) -2.65874 0.1021 -2.8588 -2.4587 *** -26.05024
## marksLimited 0.01036 0.1440 -0.2718 0.2925 0.07198
## marksLow 1.47591 0.1131 1.2542 1.6976 *** 13.04651
The second model extends the stationary model by adding spatial trend terms (x and y) to represent large-scale spatial variation across Warsaw. Compared with the stationary model, the spatial trend model shows a significant negative effect for the x coordinate, which suggests that AED intensity changes systematically across the east–west direction of the city. The y coordinate appears weaker and is not statistically significant.
The accessibility category effects remain similar to the first model, with Low accessibility AEDs still strongly dominating the pattern. This indicates that both accessibility type and broader urban spatial structure will influence the distribution of AEDs in Warsaw.
## Estimate S.E. CI95.lo CI95.hi Ztest Zval
## (Intercept) -2.598222 0.102062 -2.79826 -2.3981839 *** -25.45727
## marksLimited 0.010363 0.143965 -0.27180 0.2925292 0.07198
## marksLow 1.475907 0.113127 1.25418 1.6976305 *** 13.04651
## x -0.034953 0.004160 -0.04311 -0.0267989 *** -8.40123
## y -0.006875 0.003679 -0.01409 0.0003358 -1.86868
Now we can compare the two models. The likelihood ratio test shows that Model 2 fits the data significantly better than Model 1 (p < 0.001). This means that adding spatial trend terms (x and y) improves the model fit and suggests that AED accessibility patterns are influenced by spatial location within Warsaw, rather than depending only on accessibility categories.
## Analysis of Deviance Table
##
## Model 1: ~marks Poisson
## Model 2: ~marks + x + y Poisson
## Npar Df Deviance Pr(>Chi)
## 1 3
## 2 5 2 74.2 <0.0000000000000002 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
To further evaluate the model fit for the second model, the Kinhom envelope and goodness-of-fit tests were applied. From the results we can see the observed Kinhom curve still deviates from the simulation envelope at several spatial scales, which suggests that some clustering remains unexplained by the model. The MAD and DCLF tests both produce borderline significant results (p = 0.05). It means that the spatial trend model improves the fit but does not fully capture all spatial dependence in the AED pattern.
##
## Maximum absolute deviation test of fitted Poisson model
## Monte Carlo test based on 19 simulations
## Summary function: L[inhom](r)
## Reference function: sample mean
## Alternative: two.sided
## Interval of distance values: [0, 11.3383632451308] km
## Test statistic: Maximum absolute deviation
## Deviation = leave-one-out
##
## data: m2
## mad = 0.8, rank = 1, p-value = 0.05
##
## Diggle-Cressie-Loosmore-Ford test of fitted Poisson model
## Monte Carlo test based on 19 simulations
## Summary function: K[inhom](r)
## Reference function: sample mean
## Alternative: two.sided
## Interval of distance values: [0, 11.3383632451308] km
## Test statistic: Integral of squared absolute deviation
## Deviation = leave-one-out
##
## data: m2
## u = 4690, rank = 1, p-value = 0.05
Previous studies suggest several methods for identifying effective placement of public-access defibrillators. Many studies focus on building type, population characteristics, and areas with high pedestrian activity, since public buildings and high foot-traffic spaces are often selected for AED placement (Bonnet et al., 2015). Therefore, population density may help explain the spatial distribution of AEDs in Warsaw.
The population distribution map shows that population is highly concentrated in central and south-central parts of the city, while outer areas generally have much lower population density. This population surface was later used as a continuous spatial covariate in the point process model to test whether areas with larger populations also tend to contain higher AED intensity and accessibility.
## Reading layer `tlas24532' from data source
## `/Users/hulei/Desktop/PLPA in R/project/pop_grid/tlas24532.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 315857 features and 12 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 1571000 ymin: 6274000 xmax: 2689000 ymax: 7331000
## Projected CRS: WGS 84 / Pseudo-Mercator
## Reading layer `A02_Granice_powiatow' from data source
## `/Users/hulei/Desktop/PLPA in R/project/poviat/A02_Granice_powiatow.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 380 features and 34 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 14.12 ymin: 49 xmax: 24.15 ymax: 54.84
## Geodetic CRS: ETRS89
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0 262 1164 3222 4707 18012
The population grid was converted into a continuous raster surface so it could be used as a spatial covariate in the point process model. After overlaying the AED locations onto the population surface, we can see that many AEDs are concentrated in densely populated central districts such as Śródmieście, Wola, and Mokotów. In contrast, outer districts generally contain both lower population density and fewer AED locations. This suggests that population density may help explain where AEDs are located across Warsaw and shows why it is useful to include population in the point process model.
A third point process model was then fitted by adding population density as a continuous spatial covariate. The results show that the population variable is highly significant (p < 0.001), which suggests that AED locations are strongly associated with population concentration across Warsaw. In other words, areas with higher population density also tend to contain more AED devices.
The spatial trend term for the x-coordinate also remains significant, which means that some east–west spatial variation still exists even after accounting for population density. In general, these results shows that population density plays an important role in shaping the spatial distribution of AED locations and helps improve our understanding of AED accessibility patterns across the city.
# Population covariate model
m3 <- ppm(unmark(aed_ppp_raw_marked) ~ pop + x + y, covariates = list(pop = pop_im))
coef(summary(m3))## Estimate S.E. CI95.lo CI95.hi Ztest Zval
## (Intercept) 39.5125064 34.508788088 -28.1234754 107.148488 1.1450
## pop 0.0001707 0.000007287 0.0001564 0.000185 *** 23.4282
## x -0.0106960 0.004921525 -0.0203420 -0.001050 * -2.1733
## y -0.0023823 0.004329878 -0.0108687 0.006104 -0.5502
To evaluate whether population density improves the model, Model 3 was compared with a simpler spatial trend model without the population covariate. Since the population surface is a continuous covariate rather than a marked variable, the marked point pattern first had to be converted into an unmarked point pattern (m2b) to ensure that both models were directly comparable.
# Spatial trend model without population covariate
m2b <- ppm(unmark(aed_ppp_raw_marked) ~ x + y)
# Compare AIC values
aic_table <- data.frame(
Model = c("m1", "m2", "m2b", "m3"),
AIC = c(AIC(m1), AIC(m2), AIC(m2b), AIC(m3)))
knitr::kable(aic_table, digits = 2)| Model | AIC |
|---|---|
| m1 | 3250 |
| m2 | 3180 |
| m2b | 2144 |
| m3 | 1620 |
The AIC comparison shows a clear improvement in model fit after adding the population covariate. Model 3 produced the lowest AIC value (1615), substantially lower than the spatial trend model without population (m2b, AIC = 2145). This suggests that population density explains an important part of the spatial variation in AED locations.
The likelihood ratio test further confirms this result. The test is highly significant (p < 0.001), meaning that adding the population covariate significantly improves the model performance. Overall, the results suggest that AED locations in Warsaw are strongly associated with population density, with more AEDs tending to appear in more densely populated parts of the city.
## Analysis of Deviance Table
##
## Model 1: ~x + y Poisson
## Model 2: ~pop + x + y Poisson
## Npar Df Deviance Pr(>Chi)
## 1 3
## 2 4 1 526 <0.0000000000000002 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Similar to Model 1 and Model 2, we can also examine the predicted intensity surface and the Kinhom envelope plot for Model 3. The predicted intensity surface shows that higher AED intensity is mainly concentrated in central and west-central Warsaw, which broadly overlaps with areas of higher population density identified earlier. Peripheral parts of the city show much lower predicted intensity values. This suggests that AED placement tends to follow the spatial distribution of population.
The Kinhom envelope plot also suggests that the population covariate model fits the observed spatial pattern better than the previous spatial trend model. The observed curve stays much closer to the simulation envelope, which indicates that part of the clustering pattern can be explained by population distribution rather than by unexplained spatial clustering alone.
The MAD and DCLF tests further indicate that the population covariate model fits the observed AED pattern reasonably well. Compared with the previous model, the remaining unexplained clustering is smaller, so we can conclude that population density helps explain the AED distribution in Warsaw.
##
## Maximum absolute deviation test of fitted Poisson model
## Monte Carlo test based on 19 simulations
## Summary function: L[inhom](r)
## Reference function: sample mean
## Alternative: two.sided
## Interval of distance values: [0, 11.3383632451308] km
## Test statistic: Maximum absolute deviation
## Deviation = leave-one-out
##
## data: m3
## mad = 0.45, rank = 1, p-value = 0.05
##
## Diggle-Cressie-Loosmore-Ford test of fitted Poisson model
## Monte Carlo test based on 19 simulations
## Summary function: K[inhom](r)
## Reference function: sample mean
## Alternative: two.sided
## Interval of distance values: [0, 11.3383632451308] km
## Test statistic: Integral of squared absolute deviation
## Deviation = leave-one-out
##
## data: m3
## u = 1316, rank = 1, p-value = 0.05
This project applied spatial point pattern analysis to investigate the distribution and accessibility of Automated External Defibrillators (AEDs) in Warsaw. Both first-order and second-order spatial analyses showed that AED locations are strongly clustered rather than randomly distributed across the city. High concentrations of AEDs were mainly found in central and more urbanised areas, while peripheral districts generally showed lower AED intensity and larger gaps in accessibility.
The marked point pattern analysis also revealed clear differences between accessibility categories. Low accessibility AEDs dominated the overall spatial structure, while fully accessible public AEDs appeared less evenly distributed across Warsaw. This suggests that the presence of AEDs does not necessarily mean equal public access to emergency medical equipment.
Point process modelling also showed that AED locations do not follow a random pattern across Warsaw. After adding spatial trend terms, the model fit improved, which means AED distribution changes across different parts of the city. When population density was included as a continuous spatial covariate, the model performance improved even more. Areas with larger populations, especially central and west-central Warsaw such as Śródmieście, Wola, and parts of Mokotów, generally showed higher predicted AED intensity, while more peripheral districts such as Wilanów and outer residential areas showed lower predicted intensity and wider gaps between AED locations. However, an interesting pattern appears in the northern and south-eastern parts of Warsaw. Although these areas generally show lower population density, several High accessibility AEDs are still present there. One possible explanation is that AED placement may also depend on the presence of public institutions or other important public infrastructure rather than only residential population concentration.
Overall, the analysis suggests that AED distribution in Warsaw is closely connected to population concentration and urban development. Although the city now contains a relatively large number of AEDs, accessibility remains uneven across different districts. This project also demonstrates how spatial statistical methods and point process models can support public health planning and help decision makers identify locations where future AED placement may improve accessibility most effectively.
Bonnet, B., Dessavre, D. G., Kraus, K., & Ramirez-Marquez, J. E. (2015). Optimal placement of public-access AEDs in urban environments. Computers & Industrial Engineering, 90, 269-280.
Cacko, A., Wyzgał, A., Galas, A., Grabowski, M., Filipiak, K. J., & Opolski, G. (2010). Original article Availability of automated external defibrillators in the city of Warsaw–status for May 2009. Polish Heart Journal (Kardiologia Polska), 68(1), 41-46.