Datasets

Data has been aquired through a collaboration with Mapbox and Conservation Halton.

Objective

The purpose of this project was to test if anonymized mobile cell data: 1) is comparable to traditional measures (e.g., reservations, trail use) of monitoring human activity in green spaces. 2) provides new information that is useful for the management of green spaces. 3) can be related to environmental factors within the green spaces.

## OGR data source with driver: ESRI Shapefile 
## Source: "D:\RStudio\CUERecreationEcology\data\Mapbox\MapboxAdjustedActivity.shp", layer: "MapboxAdjustedActivity"
## with 21700 features
## It has 20 fields
## OGR data source with driver: ESRI Shapefile 
## Source: "D:\RStudio\CUERecreationEcology\data\CHProperties\CHLands.shp", layer: "CHLands"
## with 53 features
## It has 7 fields
## OGR data source with driver: ESRI Shapefile 
## Source: "D:\RStudio\CUERecreationEcology\data\CHProperties\Trails.shp", layer: "Trails"
## with 615 features
## It has 3 fields

Summarized mobility data by green space

## Round values
mapboxRounded <- mapbox %>% 
  mutate(across(where(is.numeric), function(x) round(x, 2))) %>% 
  dplyr::select(Name, dayOfWeek, accessibility,
         Area_Type, Managed, HumanMobilePercent, activityDensityLog, IQRLogActivity, TrailActivityPercent)
DT::datatable(mapboxRounded)

Map of greenspace activity

leaflet() %>% 
  addTiles() %>% 
  addPolygons(data = mapboxPoly, fillColor = mapboxPoly$arAdjAc, stroke = F) %>% 
  addPolygons(data = CHlands, color = "#006400") %>% 
  addPolygons(data = CHtrails, color = "#FFA500") 

Patterns of activity

ggplot(mapbox, aes(x = reorder(Name, avgLogActivity), y=avgLogActivity)) +
 geom_boxplot() + coord_flip() + xlab("") + 
 ylab("Average Mobile Activity (log-transformed)") + theme_classic() +
 theme(text = element_text(size = 16))

plot1 <- ggplot(mapbox, aes(x=accessibility, y=avgLogActivity, fill=dayOfWeek)) +
    geom_boxplot() + theme_classic() +
    scale_fill_manual(values=c("#E69F00", "#56B4E9")) + 
    xlab("") + ylab("Average Mobile Activity (log-transformed)") + 
    theme(text = element_text(size = 16), legend.position = c(0.15, 0.9))
plot1

source("scripts//reservationClean.r")

## Total in each park
totalParkRes <- parkReservationAvgs %>%
 dplyr::select(-start_h2) %>% 
 group_by(Name, dayOfWeek) %>% 
 summarize_all(sum)

mapboxParkReservations <- mapbox %>% 
                filter(accessibility == "open") %>% 
                right_join(totalParkRes)

## Test patterns in parks
m1 <- lm(avgLogActivity ~ dailyAdults * dayOfWeek, 
    data= mapboxParkReservations %>% filter(Name != "Mountsberg"))
anova(m1)
## Analysis of Variance Table
## 
## Response: avgLogActivity
##                       Df  Sum Sq Mean Sq  F value    Pr(>F)    
## dailyAdults            1 1091.40 1091.40 177.6318 1.104e-05 ***
## dayOfWeek              1  466.80  466.80  75.9737 0.0001261 ***
## dailyAdults:dayOfWeek  1   38.13   38.13   6.2061 0.0470854 *  
## Residuals              6   36.87    6.14                       
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(m1)
## 
## Call:
## lm(formula = avgLogActivity ~ dailyAdults * dayOfWeek, data = mapboxParkReservations %>% 
##     filter(Name != "Mountsberg"))
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.2691 -1.3133  0.1988  1.5175  2.9724 
## 
## Coefficients:
##                               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                  1.119e+02  3.260e+00  34.329 4.07e-08 ***
## dailyAdults                  8.333e-02  8.727e-03   9.549 7.53e-05 ***
## dayOfWeekweekend             1.392e+00  5.182e+00   0.269   0.7972    
## dailyAdults:dayOfWeekweekend 3.598e-02  1.444e-02   2.491   0.0471 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.479 on 6 degrees of freedom
## Multiple R-squared:  0.9774, Adjusted R-squared:  0.9661 
## F-statistic:  86.6 on 3 and 6 DF,  p-value: 2.494e-05
lmOut <- effects::effect("dailyAdults:dayOfWeek ", m1, 
    xlevels = list(dailyAdults = seq(150,550,50))) %>% 
    data.frame()

plot2 <- ggplot(mapboxParkReservations %>% filter(Name != "Mountsberg"),
 aes(x = dailyAdults, y =avgLogActivity, color=dayOfWeek, label = Name)) +
 scale_color_manual(values=c("#E69F00", "#56B4E9")) + theme_classic() +
 geom_line(data=  lmOut ,aes(x  = dailyAdults, y= fit, label = NA), size=1.6) +
 geom_text() + xlim(100, 550) + xlab("Total daily reservations") + 
 ylab("Average Mobile Activity (log-transformed)")  +
 theme(text = element_text(size = 16), legend.position = c(0.15, 0.9)) 
plot2