Street Safety dataset includes a sample of 100 streets, and on each street, a random sample of 10 persons is asked how often they feel unsafe while walking that street.
Table 1 presents the descriptive information of variables include in the analysis. In this analysis, persons, who represent micro-units (level 1), are nested in street or macro-units (level 2).
Variables include in level 1 are:
Variables for level 2 are:
Table 1 Descriptive statistics Street Safety
| Variable | Stats / Values | Freqs (% of Valid) | Graph | Missing | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| sex [factor] |
|
|
0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||
| age [numeric] |
|
53 distinct values | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||
| economic [numeric] |
|
90 distinct values | 0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||
| crowded [numeric] |
|
|
0 (0.0%) | |||||||||||||||||||||||||||||||||||||||||||||||
| unsafe [numeric] |
|
|
0 (0.0%) |
Generated by summarytools 1.0.0 (R version 4.1.2)
2021-11-16
First, we estimate the empty or null model that did not contain any explanatory variable and where the independent variable (unsafe) is the sum of a general mean (\(\gamma_{00}\)), a random effect at the group level (street) (\(U_{0j}\)), and a random effect at the individual level, (\(R_{ij}\)):
Level 1 \[ \begin{aligned} Y_{ij} = \beta_{0} + R_{ij} \end{aligned} \] Level 2 \[ \begin{aligned} \beta_{0} = \gamma_{00} + U_{0j} \end{aligned} \]
Full Model \[ \begin{aligned} Y_{ij} = \gamma_{00} + U_{0j} + R_{ij} \end{aligned} \] Random effect \(U_{0j}\) and \(R_{ij}\) are assumed to be independent, and to have mean 0 and variances var(\(R_{ij}\)) = \(\sigma^2\) and var(\(U_{ij}\)) = \(\tau_{0}^2\). Then, the total variance of \(Y\) can be decomposed as the sum of group and individual variances:
\[ \begin{aligned} var(Y_{ij}) = var(U_{0j}) + var(R_{ij}) = \sigma^2 + \tau_{0}^2 \end{aligned} \] Table 2 presents the results of the null model. According to results,17.98% of population variance in the individual’ feeling of safety is explained by the street characteristics (level 2 or macro-level). Furthermore, the standard deviation of random effect falls into the 95% confidence interval of (0.265 - 0.399), which does not include the value \(0\) so that the random intercept between street is statistically significant (Table 3).
| Null Model | |||
|---|---|---|---|
| Predictors | Estimates | std.Error | p-value |
| Intercept | 1.68 *** | 0.04 | <0.001 |
| Random Effects | |||
| σ2 | 0.49 | ||
| τ00 street | 0.11 | ||
| ICC | 0.18 | ||
| N street | 100 | ||
| Observations | 1000 | ||
| Marginal R2 / Conditional R2 | 0.000 / 0.180 | ||
|
|||
| 2.5 % | 97.5 % | |
|---|---|---|
| .sig01 | 0.2650816 | 0.3992783 |
| .sigma | 0.6670436 | 0.7316272 |
| (Intercept) | 1.6059524 | 1.7620476 |
A second random intercept model (model 4.1) for estimating the perception of unsafety was ran, where respondent are nested in streets, whereas age and sex were included as explanatory variables. This model can be also expressed in two separates level as:
Level 1 \[ \begin{aligned} Y_{ij} = \beta_{0} + \beta_{1}age+\beta_{2}sex + R_{ij} \end{aligned} \]
\[ \begin{aligned} \beta_{1} = \gamma_{10} \end{aligned} \]
\[ \begin{aligned} \beta_{2} = \gamma_{20} \end{aligned} \]
Level 2 \[ \begin{aligned} \beta_{0} = \gamma_{00} + U_{0j} \end{aligned} \]
Full Model \[ \begin{aligned} Y_{ij} = \gamma_{00} + \gamma_{10}age_{i} + \gamma_{20}sex_{i} + U_{0j} + R_{ij} \end{aligned} \]
Table 4 presents the estimation of the random intercept model (model 4.1). Additionally, Table 5 shows the estimation of confidence intervals. Results indicate that both random and fixed effects are statistically significant.
| Null Mode (4.0) | Random Effect (4.1) | |||||
|---|---|---|---|---|---|---|
| Predictors | Estimates | std.Error | p-value | Estimates | std.Error | p-value |
| Intercept | 1.68 *** | 0.04 | <0.001 | 0.91 *** | 0.08 | <0.001 |
| Age | 0.01 *** | 0.00 | <0.001 | |||
| Gender (1=Female) | 0.34 *** | 0.04 | <0.001 | |||
| Random Effects | ||||||
| σ2 | 0.49 | 0.42 | ||||
| τ00 | 0.11 street | 0.11 street | ||||
| ICC | 0.18 | 0.21 | ||||
| N | 100 street | 100 street | ||||
| Observations | 1000 | 1000 | ||||
| Marginal R2 / Conditional R2 | 0.000 / 0.180 | 0.107 / 0.293 | ||||
|
||||||
| 2.5 % | 97.5 % | |
|---|---|---|
| .sig01 | 0.2740477 | 0.4037073 |
| .sigma | 0.6203027 | 0.6803727 |
| (Intercept) | 0.7488611 | 1.0664661 |
| age | 0.0099690 | 0.0155714 |
| sex1 | 0.2520633 | 0.4194927 |
The variance of the random intercept (\(\tau_{00}^{2}\) = \(0.11\)) represent the variability in the perception of unsafety between streets. This random effect is statistically significant, suggesting that intercepts by streets are different.
The variance of the residual (\(\sigma^{2}\) = \(0.49\)) or variability within streets showed decreased respect null model (\(1.492\) to \(0.42\)), which means that gender and age of respondents explain the variability of safety perception within streets.
According to results, sex is a statistically significant predictor of perception of unsafety \((p-value < 0.001)\). Thus, being a female increases the perception of unsafety in street by \(0.34\) points.
Model 4.2 that added fixed effect to level 2 (economic and crowded) following the form:
Level 1 \[ \begin{aligned} Y_{ij} = \beta_{0} + \beta_{1}age+\beta_{2}sex + R_{ij} \end{aligned} \] \[ \begin{aligned} \beta_{1} = \gamma_{10} \end{aligned} \]
\[ \begin{aligned} \beta_{2} = \gamma_{20} \end{aligned} \]
Level 2 \[ \begin{aligned} \beta_{0} = \gamma_{00} + \gamma_{02}economics + \gamma_{03}crowded + U_{0j} \end{aligned} \]
Full Model \[ \begin{aligned} Y_{ij} = \gamma_{00} + \gamma_{10}age_{i} + \gamma_{20}sex_{i} + \gamma_{02}economics + \gamma_{03}crowded + U_{0j} + R_{ij} \end{aligned} \]
Table 6 presents the estimation of random intercept model (model 4.2) that includes explanatory variables for both level 1 (individual) and level 2 (street). Furthermore, Tabled 7 shows the estimation of confidence intervals for all effects. Results indicates that confidence intervals does not include the \(0\), so that both random and fixed effects for level 1 and 2 are statistically significant.
| Null Model 4.0 | Model 4.1 | Model 4.2 | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Predictors | Estimates | std.Error | p-value | Estimates | std.Error | p-value | Estimates | std.Error | p-value |
| Intercept | 1.68 *** | 0.04 | <0.001 | 0.91 *** | 0.08 | <0.001 | 1.43 *** | 0.09 | <0.001 |
| Gender (1=Female) | 0.01 *** | 0.00 | <0.001 | 0.01 *** | 0.00 | <0.001 | |||
| Age | 0.34 *** | 0.04 | <0.001 | 0.35 *** | 0.04 | <0.001 | |||
| Economic Index | -0.21 *** | 0.03 | <0.001 | ||||||
| Street crowdedness | -0.13 *** | 0.01 | <0.001 | ||||||
| Random Effects | |||||||||
| σ2 | 0.49 | 0.42 | 0.42 | ||||||
| τ00 | 0.11 street | 0.11 street | 0.02 street | ||||||
| ICC | 0.18 | 0.21 | 0.05 | ||||||
| N | 100 street | 100 street | 100 street | ||||||
| Observations | 1000 | 1000 | 1000 | ||||||
| Marginal R2 / Conditional R2 | 0.000 / 0.180 | 0.107 / 0.293 | 0.254 / 0.290 | ||||||
|
|||||||||
| 2.5 % | 97.5 % | |
|---|---|---|
| .sig01 | 0.0777458 | 0.2079173 |
| .sigma | 0.6202659 | 0.6803243 |
| (Intercept) | 1.2462801 | 1.6150789 |
| age | 0.0100627 | 0.0155722 |
| sex1 | 0.2696290 | 0.4340010 |
| economic | -0.2648199 | -0.1641746 |
| crowded | -0.1633972 | -0.1059705 |
The variance of the random intercept (\(\tau_{00}^{2}\) = \(0.02\)) represents the variability between streets, which showed a decreased respect to both Null Model and Model 3.1 (\(0.11\)) after included economic index and indicator of street crowdedness as an explanatory variables for level 2 (macro-level or group).
The variance between (\(\tau_{00}^{2}\)) groups decreased by \(81.82\%\) after including explanatory variables for level 2. Also, adding these variables ICC drops by \(72.22\%\) in comparison to Null Model.
Effect of crowdedness on the perception of unsafety is negative and statistically significant \((p-value <0.001)\). Thus, an increase in one unit in the streets crowdedness indicator reduce the perception of unsafety by \(0.13\) points so that crowdedness make that individual feel more safe in streets
Model 4.3 added a cross-level interaction term between sex and crowdedness to model 4.2, this model following the form:
Level 1 \[ \begin{aligned} Y_{ij} = \beta_{0} + \beta_{1}age+\beta_{2}sex +R_{ij} \end{aligned} \] \[ \begin{aligned} \beta_{1} = \gamma_{10} \end{aligned} \]
\[ \begin{aligned} \beta_{2} = \gamma_{20} + \gamma_{21}crowded \end{aligned} \]
Level 2 \[ \begin{aligned} \beta_{0} = \gamma_{00} + \gamma_{02}economics + \gamma_{03}crowded + U_{0j} \end{aligned} \]
Full Model \[ \begin{aligned} Y_{ij} = \gamma_{00} + \gamma_{10}age_{i} + (\gamma_{20} + \gamma_{21}crowded)sex_{i} + \gamma_{02}economics_{j} + \gamma_{03}crowded_{j} + U_{0j} + R_{ij} \end{aligned} \]
\[ \begin{aligned} Y_{ij} = \gamma_{00} + \gamma_{10}age_{i} + \gamma_{20}sex_{i} + \gamma_{21}crowded*sex_{i} + \gamma_{02}economics_{j} + \gamma_{03}crowded_{j} + U_{0j} + R_{ij} \end{aligned} \]
Table 8 displays the estimation of random intercept model that includes explanatory variables for both level 1 (individual) and level 2 (street) and a cross effect of . Furthermore, Tabled 9 shows the estimation of confidence intervals for all effects. Results indicates that both random and fixed effects are statistically significant.
| Model 4.1 | Model 4.2 | Model 4.3 | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Predictors | Estimates | std.Error | p-value | Estimates | std.Error | p-value | Estimates | std.Error | p-value |
| Intercept | 0.91 *** | 0.08 | <0.001 | 1.43 *** | 0.09 | <0.001 | 1.27 *** | 0.10 | <0.001 |
| Gender (1=Female) | 0.01 *** | 0.00 | <0.001 | 0.01 *** | 0.00 | <0.001 | 0.01 *** | 0.00 | <0.001 |
| Age | 0.34 *** | 0.04 | <0.001 | 0.35 *** | 0.04 | <0.001 | 0.69 *** | 0.10 | <0.001 |
| Economic Index | -0.21 *** | 0.03 | <0.001 | -0.21 *** | 0.03 | <0.001 | |||
| Street crowdedness | -0.13 *** | 0.01 | <0.001 | -0.09 *** | 0.02 | <0.001 | |||
| Gender * Crowded | -0.09 *** | 0.02 | <0.001 | ||||||
| Random Effects | |||||||||
| σ2 | 0.42 | 0.42 | 0.41 | ||||||
| τ00 | 0.11 street | 0.02 street | 0.02 street | ||||||
| N | 100 street | 100 street | 100 street | ||||||
| Observations | 1000 | 1000 | 1000 | ||||||
| Marginal R2 / Conditional R2 | 0.107 / 0.293 | 0.254 / 0.290 | 0.263 / 0.302 | ||||||
|
|||||||||
| 2.5 % | 97.5 % | |
|---|---|---|
| .sig01 | 0.0859440 | 0.2122739 |
| .sigma | 0.6153584 | 0.6749474 |
| (Intercept) | 1.0617785 | 1.4710422 |
| age | 0.0100419 | 0.0155122 |
| sex1 | 0.4889399 | 0.8912065 |
| economic | -0.2645804 | -0.1632508 |
| crowded | -0.1284071 | -0.0539425 |
| sex1:crowded | -0.1320826 | -0.0390682 |
The crossed-level interaction between gender and crowdedness street indicator is negative and statistically significant \((p-value < 0.001)\). Furthermore, cross-level interaction effect falls into the 95% confidence interval (-0.132 - -0.039), which not includes the \(0\) so that the this coefficient is statistically significant.
Crossed-level is negative and statistically significant (\(\gamma_{21} = -0.09\)) so that an increased in one unit of street crowdedness indicator increased the perception of unsafety for female respondents in \(0.09\) points. Thus, even thought the effect of being females increase the perception of unsafety, more crowded street help to reduce the perception of unsafety for female participants.
Model 4.4 added a slope intercept (\(U_{2j}*sex\)). This model can be defined using the following form:
Level 1 \[ \begin{aligned} Y_{ij} = \beta_{0} + \beta_{1}age+\beta_{2}sex +R_{ij} \end{aligned} \]
\[ \begin{aligned} \beta_{1} = \gamma_{10} \end{aligned} \]
\[ \begin{aligned} \beta_{2} = \gamma_{20} + \gamma_{21}crowded + U_{2j} \end{aligned} \]
Level 2 \[ \begin{aligned} \beta_{0} = \gamma_{00} + \gamma_{02}economics + \gamma_{03}crowded + U_{0j} \end{aligned} \]
Full Model \[ \begin{aligned} Y_{ij} = \gamma_{00} + \gamma_{10}age_{i} + (\gamma_{20} + \gamma_{21}crowded + U_{2j})sex_{i} + \gamma_{02}economics_{j} + \gamma_{03}crowded_{j} + U_{0j} + R_{ij} \end{aligned} \]
\[ \begin{aligned} Y_{ij} = \gamma_{00} + \gamma_{10}age_{i} + \gamma_{20}sex_{i} + \gamma_{21}crowded*sex_{i} + \gamma_{02}economics_{j} + \gamma_{03}crowded_{j} + U_{2j}*sex + U_{0j} + R_{ij} \end{aligned} \]
Table 10 presents the results for random intercept and random slope model that includes explanatory variables for both level 1 (individual) and level 2 (street) and a cross effect of gender and crowdedness indicator.
| Model 4.1 | Model 4.2 | Model 4.3 | Model 4.4 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Predictors | Estimates | std.Error | p-value | Estimates | std.Error | p-value | Estimates | std.Error | p-value | Estimates | std.Error | p-value |
| Intercept | 0.91 *** | 0.08 | <0.001 | 1.43 *** | 0.09 | <0.001 | 1.27 *** | 0.10 | <0.001 | 1.27 *** | 0.10 | <0.001 |
| Gender (1=Female) | 0.01 *** | 0.00 | <0.001 | 0.01 *** | 0.00 | <0.001 | 0.01 *** | 0.00 | <0.001 | 0.01 *** | 0.00 | <0.001 |
| Age | 0.34 *** | 0.04 | <0.001 | 0.35 *** | 0.04 | <0.001 | 0.69 *** | 0.10 | <0.001 | 0.69 *** | 0.10 | <0.001 |
| Economic Index | -0.21 *** | 0.03 | <0.001 | -0.21 *** | 0.03 | <0.001 | -0.22 *** | 0.03 | <0.001 | |||
| Street crowdedness | -0.13 *** | 0.01 | <0.001 | -0.09 *** | 0.02 | <0.001 | -0.09 *** | 0.02 | <0.001 | |||
| Gender * Crowded | -0.09 *** | 0.02 | <0.001 | -0.09 *** | 0.02 | <0.001 | ||||||
| Random Effects | ||||||||||||
| σ2 | 0.4214 | 0.4214 | 0.4147 | 0.4126 | ||||||||
| τ00 | 0.1111 street | 0.0215 street | 0.0230 street | 0.0140 street | ||||||||
| τ11 | 0.0089 street.sex1 | |||||||||||
| ρ01 | 0.5684 street | |||||||||||
| N | 100 street | 100 street | 100 street | 100 street | ||||||||
| Observations | 1000 | 1000 | 1000 | 1000 | ||||||||
| Marginal R2 / Conditional R2 | 0.107 / 0.293 | 0.254 / 0.290 | 0.263 / 0.302 | 0.264 / 0.306 | ||||||||
|
||||||||||||
The variance for the random slope (\(\tau_{11}\)) is equal to \(0.0089\).
Tabled 11 shows the estimation of confidence intervals for all effects including the standard deviation for the random slope effect (\(.sig03\)). Random slope effect falls into the 95% confidence interval of (0 - 0.267), which does include the \(0\) value so that we conclude that random slope for gender is not a statistically significant effect.
Table 11. Confidence Interval for Model 4.4| 2.5 % | 97.5 % | |
|---|---|---|
| .sig01 | 0.0223010 | 0.2186641 |
| .sig02 | -1.0000000 | 1.0000000 |
| .sig03 | 0.0000000 | 0.2665655 |
| .sigma | 0.6123085 | 0.6737680 |
| (Intercept) | 1.0709085 | 1.4696205 |
| age | 0.0099865 | 0.0154601 |
| sex1 | 0.4831451 | 0.8984740 |
| economic | -0.2655155 | -0.1642719 |
| crowded | -0.1274123 | -0.0559065 |
| sex1:crowded | -0.1335742 | -0.0375878 |