1 Street Safety DataSet
1.1 Descriptive information
a. Summary
summary(safe)
## street person sex age agediv10
## 1 : 10 1 :100 Min. :0.000 Min. :20.00 Min. :2.000
## 2 : 10 2 :100 1st Qu.:0.000 1st Qu.:35.00 1st Qu.:3.500
## 3 : 10 3 :100 Median :1.000 Median :48.00 Median :4.800
## 4 : 10 4 :100 Mean :0.519 Mean :47.15 Mean :4.715
## 5 : 10 5 :100 3rd Qu.:1.000 3rd Qu.:60.00 3rd Qu.:6.000
## 6 : 10 6 :100 Max. :1.000 Max. :72.00 Max. :7.200
## (Other):940 (Other):400
## economic crowded unsafe
## Min. :-2.4743 Min. :1.00 Min. :1.000
## 1st Qu.:-0.7567 1st Qu.:2.00 1st Qu.:1.000
## Median : 0.0923 Median :4.00 Median :1.000
## Mean : 0.0000 Mean :3.96 Mean :1.684
## 3rd Qu.: 0.7191 3rd Qu.:6.00 3rd Qu.:2.000
## Max. : 2.2048 Max. :7.00 Max. :3.000
##
1.2 Null Model
a. Model Estimation
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: unsafe ~ 1 + (1 | street)
## Data: safe
##
## AIC BIC logLik deviance df.resid
## 2241.1 2255.8 -1117.6 2235.1 997
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.7825 -0.7988 -0.3070 0.6337 2.3612
##
## Random effects:
## Groups Name Variance Std.Dev.
## street (Intercept) 0.1068 0.3268
## Residual 0.4873 0.6981
## Number of obs: 1000, groups: street, 100
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.68400 0.03944 100.00000 42.7 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
b. Intraclass Correlation Coefficient
## [1] 17.97724
1.3 Hypothesis Testing
a. Comparison Null model vs Linear Model
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: unsafe ~ 1 + (1 | street)
## Data: safe
##
## AIC BIC logLik deviance df.resid
## 2241.1 2255.8 -1117.6 2235.1 997
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.7825 -0.7988 -0.3070 0.6337 2.3612
##
## Random effects:
## Groups Name Variance Std.Dev.
## street (Intercept) 0.1068 0.3268
## Residual 0.4873 0.6981
## Number of obs: 1000, groups: street, 100
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 1.68400 0.03944 100.00000 42.7 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
b. Confidence Interval
## Computing profile confidence intervals ...
## 2.5 % 97.5 %
## .sig01 0.2650816 0.3992783
## .sigma 0.6670436 0.7316272
## (Intercept) 1.6059524 1.7620476
2. Popularity DataSet
2.1 Descriptive information
a. Summary
summary(popul)
## student class gender extrav
## 2 : 100 17 : 26 Min. :0.0000 Min. : 1.000
## 4 : 100 63 : 25 1st Qu.:0.0000 1st Qu.: 4.000
## 5 : 100 10 : 24 Median :1.0000 Median : 5.000
## 6 : 100 15 : 24 Mean :0.5055 Mean : 5.215
## 7 : 100 4 : 23 3rd Qu.:1.0000 3rd Qu.: 6.000
## 8 : 100 21 : 23 Max. :1.0000 Max. :10.000
## (Other):1400 (Other):1855
## texp popular
## Min. : 2.00 Min. :0.000
## 1st Qu.: 8.00 1st Qu.:4.100
## Median :15.00 Median :5.100
## Mean :14.26 Mean :5.076
## 3rd Qu.:20.00 3rd Qu.:6.000
## Max. :25.00 Max. :9.500
##
2.2 Null Model
a. Model Estimation
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: popular ~ 1 + (1 | class)
## Data: popul
##
## AIC BIC logLik deviance df.resid
## 6333.5 6350.3 -3163.7 6327.5 1997
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5662 -0.6983 0.0021 0.6758 3.3173
##
## Random effects:
## Groups Name Variance Std.Dev.
## class (Intercept) 0.6945 0.8333
## Residual 1.2218 1.1053
## Number of obs: 2000, groups: class, 100
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 5.07786 0.08696 99.90774 58.4 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
b. Intraclass Correlation Coefficient
## [1] 36.24051
2.3 Hypothesis Testing
a. Comparison Null model vs Linear Model
## Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's
## method [lmerModLmerTest]
## Formula: popular ~ 1 + (1 | class)
## Data: popul
##
## AIC BIC logLik deviance df.resid
## 6333.5 6350.3 -3163.7 6327.5 1997
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.5662 -0.6983 0.0021 0.6758 3.3173
##
## Random effects:
## Groups Name Variance Std.Dev.
## class (Intercept) 0.6945 0.8333
## Residual 1.2218 1.1053
## Number of obs: 2000, groups: class, 100
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 5.07786 0.08696 99.90774 58.4 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
b. Confidence Interval
## Computing profile confidence intervals ...
## 2.5 % 97.5 %
## .sig01 0.719963 0.9744636
## .sigma 1.071113 1.1414463
## (Intercept) 4.905780 5.2499439