Transportation mode preferences
Based on the answers to the question Usually, how do you go there? (Check all that apply.).
# code en
# 1 By car and you drive
# 2 By car and someone else drives
# 3 By taxi/Uber
# 4 On foot
# 5 By bike
# 6 By bus
# 7 By subway
# 8 By train
# 99 Other
loc_labels = data.frame(location_category=c(2:26), description=c(" 2 [Other residence]",
" 3 [Work]",
" 4 [School/College/University]",
" 5 [Supermarket]",
" 6 [Public/farmer’s market]",
" 7 [Bakery]",
" 8 [Specialty food store]",
" 9 [Convenience store/Dépanneur]",
"10 [Liquor store/SAQ]",
"11 [Bank]",
"12 [Hair salon/barbershop]",
"13 [Post office]",
"14 [Drugstore]",
"15 [Doctor/healthcare provider]",
"16 [Public transit stop]",
"17 [Leisure-time physical activity]",
"18 [Park]",
"19 [Cultural activity]",
"20 [Volunteering place]",
"21 [Religious/spiritual activity]",
"22 [Restaurant, café, bar, etc.]",
"23 [Take-out]",
"24 [Walk]",
"25 [Other place]",
"26 [Social contact residence]"))
# extract and summary stats
.tm <- locations %>%
st_set_geometry(NULL) %>%
filter(location_category != 1) %>%
left_join(loc_labels)
.tm_grouped <- .tm %>%
group_by(description) %>%
dplyr::summarise(N=n(), "By car (driver)"=sum(location_tmode_1),
"By car (passenger)"=sum(location_tmode_2),
"By taxi/Uber"=sum(location_tmode_3),
"On foot"=sum(location_tmode_4),
"By bike"=sum(location_tmode_5),
"By bus"=sum(location_tmode_6),
"Other"=sum(location_tmode_99))
kable(.tm_grouped, caption = "Transportation mode preferences") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
Transportation mode preferences
|
description
|
N
|
By car (driver)
|
By car (passenger)
|
By taxi/Uber
|
On foot
|
By bike
|
By bus
|
Other
|
|
2 [Other residence]
|
43
|
30
|
18
|
0
|
3
|
1
|
12
|
0
|
|
3 [Work]
|
191
|
67
|
39
|
5
|
42
|
28
|
122
|
4
|
|
4 [School/College/University]
|
141
|
28
|
21
|
1
|
44
|
17
|
117
|
1
|
|
5 [Supermarket]
|
558
|
296
|
180
|
7
|
114
|
19
|
124
|
1
|
|
6 [Public/farmer’s market]
|
59
|
26
|
12
|
0
|
22
|
13
|
13
|
0
|
|
7 [Bakery]
|
48
|
24
|
10
|
0
|
24
|
5
|
7
|
0
|
|
8 [Specialty food store]
|
82
|
32
|
20
|
0
|
34
|
9
|
19
|
0
|
|
9 [Convenience store/Dépanneur]
|
153
|
50
|
14
|
0
|
82
|
8
|
33
|
0
|
|
10 [Liquor store/SAQ]
|
137
|
76
|
34
|
5
|
40
|
6
|
21
|
0
|
|
11 [Bank]
|
124
|
55
|
24
|
1
|
49
|
5
|
38
|
0
|
|
12 [Hair salon/barbershop]
|
96
|
42
|
11
|
1
|
29
|
8
|
34
|
0
|
|
13 [Post office]
|
91
|
35
|
13
|
0
|
50
|
11
|
29
|
0
|
|
14 [Drugstore]
|
148
|
61
|
28
|
0
|
66
|
9
|
44
|
0
|
|
15 [Doctor/healthcare provider]
|
195
|
82
|
37
|
6
|
30
|
9
|
97
|
0
|
|
16 [Public transit stop]
|
439
|
6
|
3
|
0
|
418
|
3
|
0
|
19
|
|
17 [Leisure-time physical activity]
|
194
|
94
|
39
|
0
|
63
|
19
|
48
|
1
|
|
18 [Park]
|
166
|
11
|
19
|
0
|
131
|
31
|
9
|
2
|
|
19 [Cultural activity]
|
99
|
40
|
41
|
7
|
39
|
12
|
28
|
0
|
|
20 [Volunteering place]
|
102
|
35
|
27
|
0
|
44
|
13
|
35
|
3
|
|
21 [Religious/spiritual activity]
|
60
|
26
|
24
|
2
|
21
|
5
|
15
|
1
|
|
22 [Restaurant, café, bar, etc.]
|
401
|
150
|
145
|
14
|
162
|
40
|
78
|
1
|
|
23 [Take-out]
|
200
|
71
|
60
|
1
|
37
|
5
|
23
|
46
|
|
24 [Walk]
|
173
|
12
|
13
|
0
|
154
|
16
|
19
|
0
|
|
25 [Other place]
|
147
|
70
|
40
|
3
|
40
|
11
|
46
|
0
|
#graph
.tm1 <- .tm %>%
filter(location_tmode_1 == 1) %>%
mutate(tm = "[1] By car (driver)")
.tm2 <- .tm %>%
filter(location_tmode_2 == 1) %>%
mutate(tm = "[2] By car (passenger)")
.tm3 <- .tm %>%
filter(location_tmode_3 == 1) %>%
mutate(tm = "[3] By taxi/Uber")
.tm4 <- .tm %>%
filter(location_tmode_4 == 1) %>%
mutate(tm = "[4] On foot")
.tm5 <- .tm %>%
filter(location_tmode_5 == 1) %>%
mutate(tm = "[5] By bike")
.tm6 <- .tm %>%
filter(location_tmode_6 == 1) %>%
mutate(tm = "[6] By bus")
.tm99 <- .tm %>%
filter(location_tmode_99 == 1) %>%
mutate(tm = "[99] Other")
.tm <- bind_rows(.tm1, .tm2) %>%
bind_rows(.tm3) %>%
bind_rows(.tm4) %>%
bind_rows(.tm5) %>%
bind_rows(.tm6) %>%
bind_rows(.tm99)
# histogram of answers
ggplot(data=.tm) +
geom_bar(aes(x=fct_rev(description), fill=tm), position="fill") +
scale_fill_brewer(palette = "Set3", name = "Transport modes") +
scale_y_continuous(labels = percent) +
labs(y = "Proportion of transportation mode by location category", x=element_blank()) +
coord_flip() +
theme(legend.position = "bottom", legend.justification=c(0,0), legend.text = element_text(size=8)) +
guides(fill=guide_legend(nrow = 3))

Visiting places alone
Based on the answers to the question Do you usually go to this place alone or with other people?.
loc_labels = data.frame(location_category=c(2:26), description=c(" 2 [Other residence]",
" 3 [Work]",
" 4 [School/College/University]",
" 5 [Supermarket]",
" 6 [Public/farmer’s market]",
" 7 [Bakery]",
" 8 [Specialty food store]",
" 9 [Convenience store/Dépanneur]",
"10 [Liquor store/SAQ]",
"11 [Bank]",
"12 [Hair salon/barbershop]",
"13 [Post office]",
"14 [Drugstore]",
"15 [Doctor/healthcare provider]",
"16 [Public transit stop]",
"17 [Leisure-time physical activity]",
"18 [Park]",
"19 [Cultural activity]",
"20 [Volunteering place]",
"21 [Religious/spiritual activity]",
"22 [Restaurant, café, bar, etc.]",
"23 [Take-out]",
"24 [Walk]",
"25 [Other place]",
"26 [Social contact residence]"))
# extract and summary stats
.alone <- locations %>%
st_set_geometry(NULL) %>%
filter(location_category != 1) %>%
left_join(loc_labels) %>%
mutate(location_alone_recode=case_when(location_alone == 1 ~ 1,
location_alone == 2 ~ 0))
.alone_grouped <- .alone %>%
group_by(description) %>%
dplyr::summarise(N=n(), "Visited alone"=sum(location_alone_recode),
"Visited alone (%)"=round(sum(location_alone_recode)*100.0/n(), digits=1))
kable(.alone_grouped, caption = "Visiting places alone") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
Visiting places alone
|
description
|
N
|
Visited alone
|
Visited alone (%)
|
|
2 [Other residence]
|
43
|
NA
|
NA
|
|
3 [Work]
|
191
|
61
|
31.9
|
|
4 [School/College/University]
|
141
|
110
|
78.0
|
|
5 [Supermarket]
|
558
|
316
|
56.6
|
|
6 [Public/farmer’s market]
|
59
|
28
|
47.5
|
|
7 [Bakery]
|
48
|
28
|
58.3
|
|
8 [Specialty food store]
|
82
|
52
|
63.4
|
|
9 [Convenience store/Dépanneur]
|
153
|
126
|
82.4
|
|
10 [Liquor store/SAQ]
|
137
|
83
|
60.6
|
|
11 [Bank]
|
124
|
101
|
81.5
|
|
12 [Hair salon/barbershop]
|
96
|
88
|
91.7
|
|
13 [Post office]
|
91
|
77
|
84.6
|
|
14 [Drugstore]
|
148
|
119
|
80.4
|
|
15 [Doctor/healthcare provider]
|
195
|
161
|
82.6
|
|
16 [Public transit stop]
|
439
|
401
|
91.3
|
|
17 [Leisure-time physical activity]
|
194
|
101
|
52.1
|
|
18 [Park]
|
166
|
80
|
48.2
|
|
19 [Cultural activity]
|
99
|
26
|
26.3
|
|
20 [Volunteering place]
|
102
|
54
|
52.9
|
|
21 [Religious/spiritual activity]
|
60
|
16
|
26.7
|
|
22 [Restaurant, café, bar, etc.]
|
401
|
98
|
24.4
|
|
23 [Take-out]
|
200
|
91
|
45.5
|
|
24 [Walk]
|
173
|
101
|
58.4
|
|
25 [Other place]
|
147
|
71
|
48.3
|
# histogram of answers
ggplot(data=.alone) +
geom_bar(aes(x=fct_rev(description), fill=factor(location_alone)), position="fill") +
scale_fill_brewer(palette = "Set3", name = "Visiting places", labels = c("N/A", 'Alone', "With someone")) +
scale_y_continuous(labels = percent) +
labs(y = "Proportion of places visited alone", x=element_blank()) +
coord_flip()

Visit frequency
Based on the answers to the question How often do you go there?.
loc_labels = data.frame(location_category=c(2:26), description=c(" 2 [Other residence]",
" 3 [Work]",
" 4 [School/College/University]",
" 5 [Supermarket]",
" 6 [Public/farmer’s market]",
" 7 [Bakery]",
" 8 [Specialty food store]",
" 9 [Convenience store/Dépanneur]",
"10 [Liquor store/SAQ]",
"11 [Bank]",
"12 [Hair salon/barbershop]",
"13 [Post office]",
"14 [Drugstore]",
"15 [Doctor/healthcare provider]",
"16 [Public transit stop]",
"17 [Leisure-time physical activity]",
"18 [Park]",
"19 [Cultural activity]",
"20 [Volunteering place]",
"21 [Religious/spiritual activity]",
"22 [Restaurant, café, bar, etc.]",
"23 [Take-out]",
"24 [Walk]",
"25 [Other place]",
"26 [Social contact residence]"))
# extract and summary stats
.freq <- locations %>%
st_set_geometry(NULL) %>%
filter(location_category != 1) %>%
left_join(loc_labels)
.freq_grouped <- .freq %>%
group_by(description) %>%
dplyr::summarise(N=n(), min=min(location_freq_visit),
max=max(location_freq_visit),
mean=mean(location_freq_visit),
median=median(location_freq_visit),
sd=sd(location_freq_visit))
kable(.freq_grouped, caption = "Visit frequency (expressed in times/year)") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
Visit frequency (expressed in times/year)
|
description
|
N
|
min
|
max
|
mean
|
median
|
sd
|
|
2 [Other residence]
|
43
|
6
|
364
|
108.976744
|
104
|
89.169044
|
|
3 [Work]
|
191
|
2
|
416
|
190.963351
|
240
|
93.326556
|
|
4 [School/College/University]
|
141
|
1
|
1040
|
245.014184
|
260
|
132.401877
|
|
5 [Supermarket]
|
558
|
0
|
312
|
42.603943
|
24
|
45.243516
|
|
6 [Public/farmer’s market]
|
59
|
3
|
156
|
26.525424
|
24
|
24.614515
|
|
7 [Bakery]
|
48
|
1
|
104
|
30.104167
|
24
|
24.121360
|
|
8 [Specialty food store]
|
82
|
2
|
104
|
21.073171
|
12
|
17.760951
|
|
9 [Convenience store/Dépanneur]
|
153
|
2
|
520
|
53.196078
|
36
|
70.149564
|
|
10 [Liquor store/SAQ]
|
137
|
2
|
156
|
19.481752
|
12
|
19.082677
|
|
11 [Bank]
|
124
|
1
|
104
|
16.774193
|
12
|
18.283156
|
|
12 [Hair salon/barbershop]
|
96
|
1
|
36
|
7.281250
|
6
|
5.495842
|
|
13 [Post office]
|
91
|
1
|
208
|
18.560440
|
8
|
33.004784
|
|
14 [Drugstore]
|
148
|
4
|
260
|
28.445946
|
12
|
37.854948
|
|
15 [Doctor/healthcare provider]
|
195
|
1
|
96
|
6.917949
|
4
|
9.287140
|
|
16 [Public transit stop]
|
439
|
0
|
1040
|
195.560364
|
156
|
173.685790
|
|
17 [Leisure-time physical activity]
|
194
|
1
|
364
|
94.360825
|
52
|
83.703113
|
|
18 [Park]
|
166
|
2
|
728
|
77.873494
|
52
|
95.502827
|
|
19 [Cultural activity]
|
99
|
1
|
260
|
30.646465
|
12
|
48.635737
|
|
20 [Volunteering place]
|
102
|
1
|
364
|
81.401961
|
51
|
104.069309
|
|
21 [Religious/spiritual activity]
|
60
|
12
|
364
|
73.400000
|
52
|
84.666685
|
|
22 [Restaurant, café, bar, etc.]
|
401
|
1
|
260
|
30.932668
|
12
|
43.392948
|
|
23 [Take-out]
|
200
|
0
|
260
|
23.345000
|
12
|
36.191645
|
|
24 [Walk]
|
173
|
2
|
728
|
109.705202
|
52
|
109.373904
|
|
25 [Other place]
|
147
|
1
|
520
|
50.795918
|
24
|
75.428542
|
#graph
ggplot(data=.freq) +
geom_boxplot(aes(x=fct_rev(description), y=location_freq_visit)) +
scale_y_continuous(limits = c(0, 365)) +
labs(y = "Visits/year (Frequency over 1 visit/day not shown)", x=element_blank()) +
coord_flip()

Spatial indicators: Camille Perchoux’s toolbox
Below is a list of indicators proposed by Camille Perchoux in her paper Assessing patterns of spatial behavior in health studies: Their socio-demographic determinants and associations with transportation modes (the RECORD Cohort Study).
py_config()
## python: C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/python.exe
## libpython: C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/python36.dll
## pythonhome: C:\PROGRA~1\ArcGIS\Pro\bin\Python\envs\ARCGIS~1
## version: 3.6.8 |Anaconda, Inc.| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)]
## Architecture: 64bit
## numpy: C:\PROGRA~1\ArcGIS\Pro\bin\Python\envs\ARCGIS~1\lib\site-packages\numpy
## numpy_version: 1.16.2
##
## NOTE: Python version was forced by use_python function
import arcpy
import pandas
from time import perf_counter
arcpy.env.workspace = r"E:\Benoit\PROJETS\2017_INTERACT\_repos\VERITAS_preanalysis\temp\veritas_1skt_2851c89.gdb"
src_loc = "veritas_1skt_location" #'test_location' #
src_poly = "veritas_1skt_poly_geom" #'test_poly_geom' #
src_loc_proj = src_loc + "_proj"
src_poly_proj = src_poly + "_proj"
src_prn = src_loc.replace('location', 'prn')
dst_ll = src_loc.replace('location', 'Indicator_Lifestyle') #"camille_LifestyleIndicator" #
dst_as = src_loc.replace('location', 'Indicator_ActivitySpace') #"camille_ActivitySpaceIndicator" #
dst_rn = src_loc.replace('location', 'Indicator_ResidentialNghd') #"camille_ResidentialNeighborhoodIndicator" #
#check that we already have the results
done = False
done = arcpy.Exists(dst_ll) and arcpy.Exists(dst_as) and arcpy.Exists(dst_rn)
if not done:
c0 = perf_counter()
# --- Project data set
arcpy.Project_management(in_dataset=src_loc, out_dataset=src_loc_proj, out_coor_system="PROJCS['NAD_1983_CSRS_Statistics_Canada_Lambert',GEOGCS['GCS_North_American_1983_CSRS',DATUM['D_North_American_1983_CSRS',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Lambert_Conformal_Conic'],PARAMETER['False_Easting',6200000.0],PARAMETER['False_Northing',3000000.0],PARAMETER['Central_Meridian',-91.86666666666666],PARAMETER['Standard_Parallel_1',49.0],PARAMETER['Standard_Parallel_2',77.0],PARAMETER['Latitude_Of_Origin',63.390675],UNIT['Meter',1.0]]", transform_method="NAD_1983_CSRS_To_WGS_1984_2", in_coor_system="GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]", preserve_shape="NO_PRESERVE_SHAPE", max_deviation="", vertical="NO_VERTICAL")
arcpy.Project_management(in_dataset=src_poly, out_dataset=src_poly_proj, out_coor_system="PROJCS['NAD_1983_CSRS_Statistics_Canada_Lambert',GEOGCS['GCS_North_American_1983_CSRS',DATUM['D_North_American_1983_CSRS',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Lambert_Conformal_Conic'],PARAMETER['False_Easting',6200000.0],PARAMETER['False_Northing',3000000.0],PARAMETER['Central_Meridian',-91.86666666666666],PARAMETER['Standard_Parallel_1',49.0],PARAMETER['Standard_Parallel_2',77.0],PARAMETER['Latitude_Of_Origin',63.390675],UNIT['Meter',1.0]]", transform_method="NAD_1983_CSRS_To_WGS_1984_2", in_coor_system="GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]", preserve_shape="NO_PRESERVE_SHAPE", max_deviation="", vertical="NO_VERTICAL")
# --- Reselect PRN only from poly_geom
arcpy.FeatureClassToFeatureClass_conversion(in_features=src_poly_proj, out_path=arcpy.env.workspace, out_name=src_prn, where_clause="area_type = 'neighborhood'")
# --- Add required fields for Camille's tbx computation
arcpy.management.AddFields(src_loc_proj, [["freq_week", "DOUBLE"],["recode_categ", "LONG"]])
arcpy.management.CalculateField(src_loc_proj, "freq_week", "get_freq_week(!location_freq_visit!)", "PYTHON3", "def get_freq_week(annual_freq):\n if annual_freq >= 0:\n return annual_fr" +
"eq / 52")
arcpy.management.CalculateField(src_loc_proj, "recode_categ", "recode_categ(!location_category!)", "PYTHON3", """def recode_categ(categ):
if categ == 1:
return 1
if categ in [3, 4]:
return 2 #Occupation
if categ in [5, 6, 7, 8, 9, 10]:
return 3 #Shopping activities
if categ in [11, 12, 13, 14, 15]:
return 4 #Services
if categ == 16:
return 5 #Transportation
if categ in [17, 18, 19, 20, 21, 22, 23, 24]:
return 6 #Leisure activities
""")
# Call Camille Tbx
arcpy.ImportToolbox(r"E:\Benoit\PROJETS\_DIVERS\2016_CamilleTbx\script\CamilleTbx.pyt", "CamilleTbx")
arcpy.CamilleTbx.LifestyleIndicatorTool(src_loc_proj, dst_ll, "interact_id", "freq_week", "recode_categ", 1, 4, 6, 3) #1st=social [Services] / 2nd=recreaction [Leisure activities] / 3rd=food [Shopping activities]
arcpy.CamilleTbx.ActivitySpaceIndicatorTool(src_loc_proj, dst_as, "interact_id", "recode_categ", 1, r"E:\Megaphone\DMTI_BaseLayers_2017\CanMapContentSuite\CanMapContentSuite.gdb\Transportation\NetworkDataSet", "Meters")
arcpy.CamilleTbx.ResidentialNeighborhoodIndicatorTool(src_loc_proj, dst_rn, "interact_id", "freq_week", "recode_categ", 1, src_prn, r"E:\Megaphone\DMTI_BaseLayers_2017\CanMapContentSuite\CanMapContentSuite.gdb\Transportation\NetworkDataSet", "Meters")
print(f"Done in {time.perf_counter() - c0:.1f}s")
else:
print('Loading precomputed indictors:')
print('\tLL -> {}'.format(arcpy.Describe(dst_ll).catalogPath))
print('\tAS -> {}'.format(arcpy.Describe(dst_as).catalogPath))
print('\tRN -> {}'.format(arcpy.Describe(dst_rn).catalogPath))
# load results into R
## Loading precomputed indictors:
## LL -> E:\Benoit\PROJETS\2017_INTERACT\_repos\VERITAS_preanalysis\temp\veritas_1skt_2851c89.gdb\veritas_1skt_Indicator_Lifestyle
## AS -> E:\Benoit\PROJETS\2017_INTERACT\_repos\VERITAS_preanalysis\temp\veritas_1skt_2851c89.gdb\veritas_1skt_Indicator_ActivitySpace
## RN -> E:\Benoit\PROJETS\2017_INTERACT\_repos\VERITAS_preanalysis\temp\veritas_1skt_2851c89.gdb\veritas_1skt_Indicator_ResidentialNghd
LifestyleIndicator = pandas.DataFrame(arcpy.da.TableToNumPyArray(dst_ll, ('interact_id', 'N_acti_places', 'N_weekly_vst', 'N_acti_types', 'Food_store_Q', 'Recreational_Q', 'Social_Q')))
ActivitySpaceIndicator = pandas.DataFrame(arcpy.da.TableToNumPyArray(dst_as, ('interact_id', 'cvx_Perimeter', 'cvx_Surface', 'axis_ratio', 'cvx_gravelius', 'eccentricity', 'dsty_ellipse', 'Min_Length', 'Max_Length', 'Mean_Length')))
ResidentialNeighborhoodIndicator = pandas.DataFrame(arcpy.da.TableToNumPyArray(dst_rn, ('interact_id', 'pct_visits_neighb', 'N_acti_PRN', 'pct_visits_PRN', 'PRN_area_km2', 'ratio_PRN_area', 'ratio_PRN_AS', 'PRN_gravelius', 'PRN_eccentricity')))
Social indicators: Alexandre Naud’s toolbox
See Alex’s document for a more comprehensive presentation of the social indicators.
site <- "skt" # Can be mtl (Montreal), skt (Saskatoon), van (Vancouver) or vic (Victoria)
source('Alex/main.R')
## Reading layer `veritas_1skt_location' from data source `I:\Chercheurs\Kestens_Yan\Spherelab\Prj2017_INTERACT\DATA\_Treksoft_2019_10_10_2851c89\veritas_1skt_2851c89.gdb' using driver `OpenFileGDB'
## Simple feature collection with 4286 features and 21 fields
## geometry type: MULTIPOINT
## dimension: XY
## bbox: xmin: -108.2975 ymin: 50.44521 xmax: -104.5465 ymax: 53.49784
## epsg (SRID): 4326
## proj4string: +proj=longlat +datum=WGS84 +no_defs
## Reading layer `veritas_1skt_poly_geom' from data source `I:\Chercheurs\Kestens_Yan\Spherelab\Prj2017_INTERACT\DATA\_Treksoft_2019_10_10_2851c89\veritas_1skt_2851c89.gdb' using driver `OpenFileGDB'
## Simple feature collection with 376 features and 7 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: -106.7731 ymin: 52.07082 xmax: -106.479 ymax: 52.20431
## epsg (SRID): 4326
## proj4string: +proj=longlat +datum=WGS84 +no_defs
Number of people in the network (degree)
ggplot(sn_stat1) +
geom_histogram(aes(x=degree))

kable(t(as.matrix(summary(sn_stat1$degree))), caption = "degree") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
degree
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
|
0
|
1
|
2
|
3.179167
|
4
|
24
|
Number of edges divides by the maximum possible number of edges in the network (density)
ggplot(sn_stat1) +
geom_histogram(aes(x=density))

kable(t(as.matrix(summary(sn_stat1$density))), caption = "density") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
density
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
NA’s
|
|
0
|
0.2375
|
0.335
|
0.4564535
|
0.67
|
1
|
68
|
Simmelian Brokerage (simmelian)
ggplot(sn_stat1) +
geom_histogram(aes(x=simmelian))

kable(t(as.matrix(summary(sn_stat1$simmelian))), caption = "simmelian") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
simmelian
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
NA’s
|
|
1
|
1
|
1.085
|
2.212676
|
2.575
|
21
|
98
|
Standard deviation for network member ages (age_sd)
ggplot(sn_stat1) +
geom_histogram(aes(x=age_sd))

kable(t(as.matrix(summary(sn_stat1$age_sd))), caption = "age_sd") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
age_sd
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
NA’s
|
|
0
|
3.015
|
9.82
|
10.57345
|
16.6725
|
45.25
|
98
|
Does the participant have a spouse (spouse)
ggplot(sn_stat1) +
geom_histogram(aes(x=spouse), stat="count") +
labs(x="has spouse")

Proportion of kin in the network (prop_kin)
ggplot(sn_stat1) +
geom_histogram(aes(x=prop_kin))

kable(t(as.matrix(summary(sn_stat1$prop_kin))), caption = "prop_kin") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
prop_kin
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
NA’s
|
|
0
|
0
|
0.165
|
0.3037356
|
0.5
|
1
|
66
|
Diversity of relation types (diversity)
ggplot(sn_stat1) +
geom_histogram(aes(x=diversity))

kable(t(as.matrix(summary(sn_stat1$diversity))), caption = "diversity") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
diversity
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
|
0
|
0
|
0
|
0.4622917
|
1
|
2.25
|
Number of individuals that are not connected with the spouse (independant_ties)
ggplot(sn_stat1) +
geom_histogram(aes(x=independant_ties))

kable(t(as.matrix(summary(sn_stat1$independant_ties))), caption = "independant_ties") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
independant_ties
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
NA’s
|
|
0
|
0
|
0
|
0.9391304
|
1
|
20
|
125
|
Weekly face-to-face interactions (meet_by_week)
ggplot(filter(sn_stat1, meet_by_week < 100)) +
geom_histogram(aes(x=meet_by_week)) +
annotate(geom="text", x=55, y=40, label="X-axis: values over 100 not displayed", alpha=.5)

kable(t(as.matrix(summary(sn_stat1$meet_by_week))), caption = "meet_by_week") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
meet_by_week
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
NA’s
|
|
0
|
4
|
9.925
|
80876.98
|
20.8775
|
19230776
|
2
|
Number of people with whom the participant like to socialize (socialize_size)
ggplot(sn_stat1) +
geom_histogram(aes(x=socialize_size))

kable(t(as.matrix(summary(sn_stat1$socialize_size))), caption = "socialize_size") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
socialize_size
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
|
0
|
1
|
1
|
2.320833
|
3
|
16
|
Weekly face-to-face interactions among people with whom the participant like to socialize (socialize_meet)
ggplot(filter(sn_stat1, socialize_meet < 100)) +
geom_histogram(aes(x=socialize_meet)) +
annotate(geom="text", x=55, y=40, label="X-axis: values over 100 not displayed", alpha=.5)

kable(t(as.matrix(summary(sn_stat1$socialize_meet))), caption = "socialize_meet") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
socialize_meet
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
NA’s
|
|
0
|
2
|
7
|
80870.79
|
19.5
|
19230776
|
2
|
Weekly ICT interactions among people with whom the participant like to socialize (socialize_chat)
ggplot(filter(sn_stat1, socialize_chat < 100)) +
geom_histogram(aes(x=socialize_chat)) +
annotate(geom="text", x=35, y=40, label="X-axis: values over 100 not displayed", alpha=.5)

kable(t(as.matrix(summary(sn_stat1$socialize_chat))), caption = "socialize_chat") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
socialize_chat
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
|
0
|
1.3225
|
7
|
8.845375
|
10.8875
|
110
|
Number of people with whom the participant discuss important matters (important_size)
ggplot(sn_stat1) +
geom_histogram(aes(x=important_size))

kable(t(as.matrix(summary(sn_stat1$important_size))), caption = "important_size") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
important_size
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
|
0
|
1
|
1
|
1.866667
|
3
|
14
|
Weekly face-to-face interactions among people with whom the participant discuss important matters (important_meet)
ggplot(filter(sn_stat1, important_meet < 100)) +
geom_histogram(aes(x=important_meet)) +
annotate(geom="text", x=55, y=40, label="X-axis: values over 100 not displayed", alpha=.5)

kable(t(as.matrix(summary(sn_stat1$important_meet))), caption = "important_meet") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
important_meet
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
NA’s
|
|
0
|
0.5175
|
7
|
80873.73
|
17
|
19230776
|
2
|
Number of ICT interactions, by week, among people with whom the participant discuss important matters (important_chat)
ggplot(filter(sn_stat1, important_chat < 100)) +
geom_histogram(aes(x=important_chat)) +
annotate(geom="text", x=30, y=40, label="X-axis: values over 100 not displayed", alpha=.5)

kable(t(as.matrix(summary(sn_stat1$important_chat))), caption = "important_chat") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
important_chat
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
|
0
|
0.29
|
7
|
8.012417
|
8.4
|
100
|
Number of groups in the network (nb_groups)
ggplot(sn_stat2) +
geom_histogram(aes(x=nb_groups))

kable(t(as.matrix(summary(sn_stat2$nb_groups))), caption = "nb_groups") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
nb_groups
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
|
0
|
0
|
0
|
0.9832636
|
1.5
|
9
|
Number of people in all groups (group_size)
ggplot(filter(sn_stat2, group_size < 100)) +
geom_histogram(aes(x=group_size)) +
annotate(geom="text", x=55, y=10, label="X-axis: values over 100 not displayed", alpha=.5)

kable(t(as.matrix(summary(sn_stat2$group_size))), caption = "group_size") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
group_size
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
NA’s
|
|
2
|
10
|
20
|
38.56637
|
37
|
350
|
126
|
Simmelian Brokerage calculated on the full network (simmelian)
ggplot(sn_stat2) +
geom_histogram(aes(x=simmelian))

kable(t(as.matrix(summary(sn_stat2$simmelian))), caption = "simmelian") %>% kable_styling(bootstrap_options = "striped", full_width = T, position = "left")
simmelian
|
Min.
|
1st Qu.
|
Median
|
Mean
|
3rd Qu.
|
Max.
|
NA’s
|
|
1
|
2
|
3.6
|
5.986914
|
7.345
|
45.17
|
64
|
Social indicators: Alexandre Naud’s toolbox
See Alex’s document for a more comprehensive presentation of the social indicators.
Number of people in the network (
degree)Number of edges divides by the maximum possible number of edges in the network (
density)Simmelian Brokerage (
simmelian)Standard deviation for network member ages (
age_sd)Does the participant have a spouse (
spouse)Proportion of kin in the network (
prop_kin)Diversity of relation types (
diversity)Number of individuals that are not connected with the spouse (
independant_ties)Weekly face-to-face interactions (
meet_by_week)Weekly interactions through information and communication technologies (
chat_by_week)Number of people with whom the participant like to socialize (
socialize_size)Weekly face-to-face interactions among people with whom the participant like to socialize (
socialize_meet)Weekly ICT interactions among people with whom the participant like to socialize (
socialize_chat)Number of people with whom the participant discuss important matters (
important_size)Weekly face-to-face interactions among people with whom the participant discuss important matters (
important_meet)Number of ICT interactions, by week, among people with whom the participant discuss important matters (
important_chat)Number of groups in the network (
nb_groups)Number of people in all groups (
group_size)Simmelian Brokerage calculated on the full network (
simmelian)