This project is aimed to use R for Multilevel analysis. Multilevel analysis is a method used to analyze data with “complex patterns of variability with a focus on nested sources of such vairiability” (Sninjders and Bosker, p.14, 2012). It uses random-effect models, hierarchical models, variance-components models, random-coefficient models, random-coefficient models, and linear or generalized linear models. It helps model data that has a complex structure and a large range nested sources. Modifiable areal unit problem (MAUP) is another method used in Spatial Analysis that helps understand how to do aggregation of data, allowing the data to portray distinctive levels of aggregation within the outline of a zoning system (Environmental and Planning, 1991). The data that was used was based off the Census data (https://census.ukdataservice.ac.uk/get-data/aggregate-data) where there is wide range of socioeconomic and demographic data. The variables used from the Census included are downloaded on an Output Area (OA) scale of Liverpool and included, age between 20-24 years old, male, female, car availability, low amount of hours (1-19 hours) of provisional unpaid care, high amount of hours (50+ hours) of provisional unpaid care, and population count. The Consumer Data Research Centre (CDRC; https://www.cdrc.ac.uk/) was also used to obtain the Income Multiple Deprivation of Liverpool in a Lower Super Output Area (LSOA) which consists of employment, education, health, crime, housing, living environment, rank, and score.
Installing and Loading in the packages needed for R
library(rgdal)
## Warning: package 'rgdal' was built under R version 3.3.2
## Loading required package: sp
## Warning: package 'sp' was built under R version 3.3.2
## rgdal: version: 1.2-5, (SVN revision 648)
## Geospatial Data Abstraction Library extensions to R successfully loaded
## Loaded GDAL runtime: GDAL 2.1.2, released 2016/10/24
## Path to GDAL shared files: /Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgdal/gdal
## Loaded PROJ.4 runtime: Rel. 4.9.1, 04 March 2015, [PJ_VERSION: 491]
## Path to PROJ.4 shared files: /Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgdal/proj
## Linking to sp version: 1.2-4
library(maptools)
## Warning: package 'maptools' was built under R version 3.3.2
## Checking rgeos availability: TRUE
library(classInt)
library(RColorBrewer)
library(lme4)
## Loading required package: Matrix
## Warning: package 'Matrix' was built under R version 3.3.2
library(merTools)
## Warning: package 'merTools' was built under R version 3.3.2
## Loading required package: arm
## Warning: package 'arm' was built under R version 3.3.2
## Loading required package: MASS
##
## arm (Version 1.9-3, built: 2016-11-21)
## Working directory is /Users/Ernie/Desktop/Spatial Analysis/Assignment 1
## Loading required package: dplyr
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:MASS':
##
## select
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
Importing OA data that comes from the Census coontaining the variables that will be used.
OA <- readOGR(dsn = "/Users/Ernie/Desktop/Spatial Analysis/Assignment 1/OA.shp", stringsAsFactors = FALSE)
## OGR data source with driver: ESRI Shapefile
## Source: "/Users/Ernie/Desktop/Spatial Analysis/Assignment 1/OA.shp", layer: "OA"
## with 1584 features
## It has 23 fields
## Integer64 fields read as strings: IMD_rank IMD_Number c_Age20-24 c_Pop c_Male c_Female c_CarAvail c_LilCare c_LotCare
Need the data slot of the spatial data OA to run models to extract the attribute data from the OA and name it OAdata as well as in the LSOA data set into LSOAdata. Some data minipulation has to be taking into consideration since the data that was obtained has to be converted into as.numeric().
OAData <- OA@data
OAData$c_Age20.24 <- as.numeric(OAData$c_Age20.24)
OAData$c_Pop <- as.numeric(OAData$c_Pop)
OAData$c_Male <- as.numeric(OAData$c_Male)
OAData$c_Female <- as.numeric(OAData$c_Female)
OAData$c_CarAvail <- as.numeric(OAData$c_CarAvail)
OAData$c_LilCare <- as.numeric(OAData$c_LilCare)
OAData$c_LotCare <- as.numeric(OAData$c_LotCare)
head(OAData)
## OA_CD LSOA_CD MSOA_CD LAD_CD IMD_rank IMD_score IMD_income
## 0 E00176737 E01033761 E02006932 E08000012 9835 26.79 0.04
## 1 E00033515 E01006614 E02001358 E08000012 1216 57.09 0.33
## 2 E00033141 E01006546 E02001365 E08000012 747 62.12 0.37
## 3 E00176757 E01006646 E02001369 E08000012 636 63.66 0.41
## 4 E00034050 E01006712 E02001375 E08000012 5366 37.24 0.23
## 5 E00034280 E01006761 E02001366 E08000012 757 62.01 0.34
## IMD_employ IMD_educat IMD_health IMD_crime IMD_housin IMD_living
## 0 0.03 6.32 1.13 2.53 18.14 70.28
## 1 0.28 35.82 1.60 1.57 9.91 67.68
## 2 0.28 47.41 1.62 1.71 8.82 66.90
## 3 0.31 47.66 2.43 1.25 19.43 32.35
## 4 0.18 23.46 1.28 0.45 5.42 64.31
## 5 0.32 41.56 1.98 1.68 12.19 53.75
## IMD_idaci IMD_idaopi IMD_Number c_Age20.24 c_Pop c_Male c_Female
## 0 0.39 0.22 1 73 185 122 63
## 1 0.43 0.30 1 23 281 128 153
## 2 0.53 0.27 1 19 208 95 113
## 3 0.60 0.56 1 45 200 120 80
## 4 0.32 0.30 1 16 321 158 163
## 5 0.37 0.34 1 15 140 123 64
## c_CarAvail c_LilCare c_LotCare
## 0 29 7 0
## 1 65 19 9
## 2 61 14 5
## 3 91 3 2
## 4 112 16 4
## 5 20 2 2
Load in LSOA Data that contains the Lower Super Output Area of Liverpool. As well as convertion of the census just as how it was done with the Output Area.
LSOA <- readOGR(dsn = "/Users/Ernie/Desktop/Spatial Analysis/Assignment 1/LSOA.shp", stringsAsFactors = FALSE)
## OGR data source with driver: ESRI Shapefile
## Source: "/Users/Ernie/Desktop/Spatial Analysis/Assignment 1/LSOA.shp", layer: "LSOA"
## with 298 features
## It has 22 fields
## Integer64 fields read as strings: IMD_rank IMD_Number c_Age20-24 c_Pop c_Male c_Female c_CarAvail c_LilCare c_LotCare
LSOAData <- LSOA@data
LSOAData$c_Age20.24 <- as.numeric(LSOAData$c_Age20.24)
LSOAData$c_Pop <- as.numeric(LSOAData$c_Pop)
LSOAData$c_Male <- as.numeric(LSOAData$c_Male)
LSOAData$c_Female <- as.numeric(LSOAData$c_Female)
LSOAData$c_CarAvail <- as.numeric(LSOAData$c_CarAvail)
LSOAData$c_LilCare <- as.numeric(LSOAData$c_LilCare)
LSOAData$c_LotCare <- as.numeric(LSOAData$c_LotCare)
head(LSOAData)
## LSOA_CD MSOA_CD LAD_CD IMD_rank IMD_score IMD_income IMD_employ
## 0 E01006540 E02001370 E08000012 48 78.55 0.48 0.41
## 1 E01006623 E02001359 E08000012 20374 13.29 0.08 0.11
## 2 E01006569 E02001375 E08000012 1522 54.64 0.31 0.28
## 3 E01006512 E02001377 E08000012 10518 25.61 0.10 0.08
## 4 E01006513 E02006932 E08000012 10339 25.91 0.04 0.03
## 5 E01006514 E02001383 E08000012 5247 37.64 0.19 0.15
## IMD_educat IMD_health IMD_crime IMD_housin IMD_living IMD_idaci
## 0 62.28 3.02 1.48 18.10 51.82 0.49
## 1 12.59 0.40 -0.92 13.16 15.63 0.08
## 2 44.35 1.69 1.40 14.78 46.42 0.34
## 3 10.06 1.19 -0.20 24.49 68.91 0.16
## 4 20.13 0.58 1.50 25.15 85.48 0.21
## 5 15.50 1.86 0.74 21.85 58.90 0.23
## IMD_idaopi IMD_Number c_Age20.24 c_Pop c_Male c_Female c_CarAvail
## 0 0.50 1 141 1485 776 733 266
## 1 0.12 1 86 1462 724 738 828
## 2 0.40 1 80 1372 672 757 415
## 3 0.31 1 615 1420 1070 810 314
## 4 0.20 1 1366 1691 1461 1480 353
## 5 0.48 1 586 1758 1177 931 466
## c_LilCare c_LotCare
## 0 50 45
## 1 137 40
## 2 68 82
## 3 66 10
## 4 74 7
## 5 134 21
In this section, we look at whether multiple regression analysis is affected by the MAUP issue. The aim is to see how minimal amount of unpaid care and high amount of unpaid care is distributed in Liverpool. The multiple regression model relates the Unpaid Provisional Care (Care_Prop) to four independent variables: the percentage of the population who are male (c_Male), the percentage of the population who are in the age group of 20-24 years old (c_Age20.24); the percentage of the population who have access to a car (c_CarAvail) and the income deprivation of education (IMD_educat)
The OA Scale
OAData$Care_Prop <- (OAData$c_LilCare + OAData$c_LotCare) / OAData$c_Pop
cor(OAData[,c("Care_Prop", "c_Male", "c_Age20.24", "c_CarAvail", "IMD_educat")])
## Care_Prop c_Male c_Age20.24 c_CarAvail IMD_educat
## Care_Prop 1.0000000 0.12615522 -0.13078964 0.30331512 -0.15897706
## c_Male 0.1261552 1.00000000 0.59861930 0.28877296 -0.05905405
## c_Age20.24 -0.1307896 0.59861930 1.00000000 -0.09629814 -0.06860841
## c_CarAvail 0.3033151 0.28877296 -0.09629814 1.00000000 -0.61737138
## IMD_educat -0.1589771 -0.05905405 -0.06860841 -0.61737138 1.00000000
The LSOA Scale
LSOAData$Care_Prop <- (LSOAData$c_LilCare + LSOAData$c_LotCare) / LSOAData$c_Pop
cor(LSOAData[,c("Care_Prop", "c_Male", "c_Age20.24", "c_CarAvail", "IMD_educat")])
## Care_Prop c_Male c_Age20.24 c_CarAvail IMD_educat
## Care_Prop 1.0000000 -0.23223434 -0.49550605 0.4838717 -0.24535384
## c_Male -0.2322343 1.00000000 0.56920015 0.0855579 -0.01136351
## c_Age20.24 -0.4955061 0.56920015 1.00000000 -0.2107498 -0.07368436
## c_CarAvail 0.4838717 0.08555790 -0.21074981 1.0000000 -0.75222157
## IMD_educat -0.2453538 -0.01136351 -0.07368436 -0.7522216 1.00000000
We are able to see how the MAUP between two different levels, the Output Area and the Lower Super Output Area of Liverpool, have different correlations because of the spatial units that are within each polygon.
First, the data was sorted by LSOA so that we can see the hirarchical datastructure clearly
OAData <- OAData[order(OAData$LSOA_CD),]
head(OAData)
## OA_CD LSOA_CD MSOA_CD LAD_CD IMD_rank IMD_score IMD_income
## 50 E00176655 E01006512 E02001377 E08000012 10518 25.61 0.1
## 182 E00176676 E01006512 E02001377 E08000012 10518 25.61 0.1
## 203 E00033015 E01006512 E02001377 E08000012 10518 25.61 0.1
## 521 E00033013 E01006512 E02001377 E08000012 10518 25.61 0.1
## 524 E00176644 E01006512 E02001377 E08000012 10518 25.61 0.1
## 711 E00033016 E01006512 E02001377 E08000012 10518 25.61 0.1
## IMD_employ IMD_educat IMD_health IMD_crime IMD_housin IMD_living
## 50 0.08 10.06 1.19 -0.2 24.49 68.91
## 182 0.08 10.06 1.19 -0.2 24.49 68.91
## 203 0.08 10.06 1.19 -0.2 24.49 68.91
## 521 0.08 10.06 1.19 -0.2 24.49 68.91
## 524 0.08 10.06 1.19 -0.2 24.49 68.91
## 711 0.08 10.06 1.19 -0.2 24.49 68.91
## IMD_idaci IMD_idaopi IMD_Number c_Age20.24 c_Pop c_Male c_Female
## 50 0.16 0.31 1 245 193 270 219
## 182 0.16 0.31 1 52 174 119 70
## 203 0.16 0.31 1 42 209 136 73
## 521 0.16 0.31 1 28 202 95 107
## 524 0.16 0.31 1 57 194 123 71
## 711 0.16 0.31 1 191 448 327 270
## c_CarAvail c_LilCare c_LotCare Care_Prop
## 50 18 15 2 0.088082902
## 182 35 6 0 0.034482759
## 203 55 12 1 0.062200957
## 521 57 7 3 0.049504950
## 524 42 0 1 0.005154639
## 711 107 26 3 0.064732143
A temperary (temp) value was created to show us the number of OA’s nested into the LSOA code.
temp <- data.frame(table(OAData$LSOA_CD))
names(temp) <- c("LSOA Code", "The number of OA nested into")
head(temp)
## LSOA Code The number of OA nested into
## 1 E01006512 6
## 2 E01006513 9
## 3 E01006514 7
## 4 E01006515 6
## 5 E01006518 6
## 6 E01006519 5
Create a variable between the amount of little hours to high amount of hours that are put into unpaid provisional care.
OAData$Care_Prop <- (OAData$c_LilCare + OAData$c_LotCare) / OAData$c_Pop
model.0 <- lmer(Care_Prop ~ 1 + (1|LSOA_CD), data = OAData)
summary(model.0)
## Linear mixed model fit by REML ['lmerMod']
## Formula: Care_Prop ~ 1 + (1 | LSOA_CD)
## Data: OAData
##
## REML criterion at convergence: -6543.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.9057 -0.5606 -0.0515 0.5212 8.3678
##
## Random effects:
## Groups Name Variance Std.Dev.
## LSOA_CD (Intercept) 0.0003726 0.01930
## Residual 0.0007317 0.02705
## Number of obs: 1584, groups: LSOA_CD, 298
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.092929 0.001313 70.77
The Variance Partition Coefficient (VPC) can be calculated to the variance between the LSOA-Level (0.0003726) and OA-Level (0.0007317)
VPC <- 0.0003726 / (0.0003726 + 0.0007317)
VPC
## [1] 0.3374083
VPC equals 0.3374083 (33%) Showing a variation in unpaid provisional care between LSOAs, which potrays how nessecary it is to model Care (unpaid) at scales of OA and LSOA
Exracting the fixed effect estimates or the regression coefficients fixef(model.0)
Extracting the variance of the MSOA-Level random effect
VarCorr(model.0)
## Groups Name Std.Dev.
## LSOA_CD (Intercept) 0.019302
## Residual 0.027051
Confidence Intervals
confint(model.0, level = 0.95)
## Computing profile confidence intervals ...
## 2.5 % 97.5 %
## .sig01 0.01720887 0.02151874
## .sigma 0.02603841 0.02812972
## (Intercept) 0.09035304 0.09550822
Extract the LSOA-Level random effect
ranef(model.0)
## $LSOA_CD
## (Intercept)
## E01006512 -3.182056e-02
## E01006513 -3.424307e-02
## E01006514 -6.271769e-03
## E01006515 -2.389268e-02
## E01006518 4.357436e-03
## E01006519 1.255529e-02
## E01006520 -2.589256e-02
## E01006521 -1.782948e-03
## E01006522 -2.302917e-02
## E01006523 -9.711750e-03
## E01006524 1.670782e-02
## E01006525 1.326104e-02
## E01006526 1.221497e-02
## E01006527 1.241699e-02
## E01006528 2.342506e-03
## E01006529 1.035681e-02
## E01006530 3.352210e-02
## E01006531 3.370281e-02
## E01006532 1.936776e-02
## E01006533 3.348017e-02
## E01006534 2.174749e-04
## E01006535 2.297925e-02
## E01006536 2.285272e-02
## E01006537 -8.702351e-03
## E01006538 3.303271e-02
## E01006539 2.638548e-02
## E01006540 -2.189120e-02
## E01006541 -1.185700e-03
## E01006542 -2.652369e-03
## E01006543 5.572251e-03
## E01006544 4.113301e-03
## E01006545 6.589273e-03
## E01006546 -1.232262e-02
## E01006547 -2.229952e-03
## E01006548 -7.984114e-03
## E01006549 -1.599363e-02
## E01006550 -3.678480e-02
## E01006551 1.452530e-02
## E01006552 -2.658222e-02
## E01006553 -3.396303e-02
## E01006554 -1.138770e-02
## E01006556 -1.733070e-02
## E01006557 -3.855496e-02
## E01006558 -2.028484e-02
## E01006560 -7.160643e-03
## E01006562 -2.022378e-02
## E01006563 -1.612804e-03
## E01006564 6.433300e-03
## E01006565 1.443978e-02
## E01006566 1.145556e-02
## E01006567 1.210408e-03
## E01006568 5.469830e-03
## E01006569 1.076650e-02
## E01006570 1.943674e-02
## E01006571 2.287266e-02
## E01006572 -7.578150e-03
## E01006573 -5.914207e-03
## E01006574 1.598141e-03
## E01006575 7.775546e-03
## E01006576 2.387109e-02
## E01006577 1.691041e-02
## E01006578 1.514708e-05
## E01006579 5.723570e-03
## E01006580 9.335757e-03
## E01006581 1.162124e-02
## E01006582 2.294152e-02
## E01006583 2.730759e-02
## E01006584 1.773775e-02
## E01006585 7.954465e-03
## E01006586 2.448851e-03
## E01006587 1.003304e-02
## E01006588 2.706666e-04
## E01006589 1.279328e-02
## E01006590 -1.125102e-02
## E01006591 -8.093073e-03
## E01006592 2.225210e-02
## E01006593 -1.544089e-02
## E01006594 1.890099e-02
## E01006595 1.474868e-02
## E01006596 1.081927e-02
## E01006597 1.678431e-02
## E01006598 1.433672e-02
## E01006599 -1.376750e-02
## E01006600 1.425505e-02
## E01006603 2.621962e-02
## E01006604 2.208490e-02
## E01006605 8.405288e-03
## E01006606 1.945978e-02
## E01006607 7.686896e-03
## E01006608 1.206272e-02
## E01006609 8.203711e-03
## E01006610 -8.160835e-03
## E01006611 -1.919262e-02
## E01006612 -3.947673e-03
## E01006613 7.070806e-03
## E01006614 -5.046058e-03
## E01006615 -7.479317e-03
## E01006616 1.152941e-02
## E01006617 1.603185e-03
## E01006618 1.574361e-02
## E01006619 7.781391e-03
## E01006620 2.284200e-02
## E01006621 4.145800e-02
## E01006622 9.421717e-03
## E01006623 1.927478e-02
## E01006624 7.192950e-03
## E01006625 2.613628e-02
## E01006626 2.731821e-02
## E01006627 1.650893e-02
## E01006628 -4.897909e-04
## E01006629 1.022897e-02
## E01006630 -3.036968e-03
## E01006632 -1.091781e-02
## E01006633 -9.671836e-03
## E01006637 -1.330671e-02
## E01006638 -2.762730e-03
## E01006639 2.726903e-04
## E01006640 1.906137e-02
## E01006641 -2.007917e-02
## E01006642 -7.694855e-03
## E01006643 5.820140e-03
## E01006644 1.845258e-03
## E01006645 -2.164218e-03
## E01006646 -1.013735e-02
## E01006647 1.869488e-03
## E01006648 -4.981537e-03
## E01006651 1.140958e-02
## E01006652 1.235935e-02
## E01006653 1.921725e-02
## E01006654 -4.376887e-03
## E01006655 -5.324569e-04
## E01006656 4.114258e-03
## E01006657 -7.872799e-03
## E01006658 4.181273e-04
## E01006659 2.014006e-02
## E01006660 3.377731e-03
## E01006661 4.249064e-03
## E01006662 -4.559984e-03
## E01006663 -4.986052e-04
## E01006664 -8.414957e-03
## E01006665 1.291251e-02
## E01006666 3.628415e-03
## E01006667 1.091174e-02
## E01006668 2.110586e-03
## E01006669 -3.686651e-03
## E01006670 1.167296e-02
## E01006671 9.358581e-03
## E01006672 5.062009e-03
## E01006673 -2.407697e-02
## E01006674 -1.829823e-02
## E01006675 -2.518753e-02
## E01006676 -1.697750e-02
## E01006677 -1.756856e-02
## E01006678 1.211965e-02
## E01006679 -1.614432e-02
## E01006680 2.170238e-02
## E01006681 9.028126e-03
## E01006682 2.732908e-02
## E01006683 2.411389e-02
## E01006684 1.630417e-02
## E01006685 7.291282e-03
## E01006686 2.288973e-02
## E01006687 8.607007e-03
## E01006688 -4.810441e-03
## E01006689 6.103415e-03
## E01006690 -2.293878e-02
## E01006691 -1.887900e-02
## E01006692 -7.986259e-03
## E01006693 8.118563e-04
## E01006694 -2.279981e-02
## E01006695 -2.794374e-02
## E01006696 -1.542892e-02
## E01006697 -1.037761e-02
## E01006698 2.472150e-03
## E01006699 -3.348621e-03
## E01006700 -9.121578e-03
## E01006701 9.023180e-05
## E01006702 -5.752432e-03
## E01006703 -1.002697e-02
## E01006705 3.264763e-05
## E01006706 9.094105e-03
## E01006707 5.904415e-03
## E01006708 -3.727901e-03
## E01006709 -5.584794e-03
## E01006710 9.084507e-03
## E01006711 1.068391e-02
## E01006712 -6.659937e-03
## E01006713 -3.494552e-03
## E01006716 -3.972287e-03
## E01006717 1.611413e-02
## E01006718 7.096009e-03
## E01006719 9.482573e-03
## E01006720 -3.239984e-02
## E01006721 -1.646945e-02
## E01006722 -3.550460e-02
## E01006723 -2.322143e-02
## E01006724 -2.578817e-02
## E01006725 -1.290198e-02
## E01006726 -1.882985e-02
## E01006727 -9.800065e-03
## E01006728 -2.019934e-02
## E01006729 -8.322356e-03
## E01006730 7.501505e-03
## E01006731 -1.913531e-04
## E01006732 9.207381e-03
## E01006734 -4.517331e-03
## E01006735 -2.352048e-03
## E01006736 8.096132e-03
## E01006737 2.479464e-02
## E01006738 1.730998e-03
## E01006739 -9.628008e-03
## E01006740 -1.484395e-02
## E01006741 7.097818e-03
## E01006742 1.106181e-02
## E01006743 -6.391225e-03
## E01006744 -6.472019e-03
## E01006745 -6.211850e-03
## E01006746 -1.768134e-03
## E01006747 3.071708e-02
## E01006748 -3.060059e-02
## E01006751 -1.602370e-02
## E01006752 -4.895420e-03
## E01006753 4.636644e-03
## E01006754 -1.171528e-02
## E01006755 -7.826194e-03
## E01006756 -5.273068e-03
## E01006757 -1.858317e-02
## E01006758 -1.506321e-03
## E01006759 6.624059e-03
## E01006760 -1.579089e-02
## E01006761 1.686619e-03
## E01006762 3.442153e-03
## E01006763 6.350352e-03
## E01006764 -7.525493e-03
## E01006765 1.343083e-02
## E01006766 -1.184864e-02
## E01006767 -8.660403e-03
## E01006768 6.421767e-03
## E01006769 -1.394706e-03
## E01006770 9.889624e-03
## E01006771 5.493938e-04
## E01006772 1.181820e-02
## E01006773 1.920767e-02
## E01006774 1.400108e-02
## E01006775 5.768256e-03
## E01006776 -1.534655e-02
## E01006778 -1.793883e-03
## E01006779 1.165406e-02
## E01006780 6.661440e-03
## E01006781 1.349923e-02
## E01006782 9.569002e-03
## E01006783 -2.737926e-05
## E01006784 -5.673674e-03
## E01006785 1.736877e-03
## E01006786 1.143319e-02
## E01006787 2.719366e-02
## E01006788 8.298214e-03
## E01006790 -7.313847e-03
## E01006791 3.309313e-03
## E01006792 9.025187e-03
## E01006793 5.334619e-04
## E01006794 8.117879e-03
## E01006795 1.727118e-02
## E01006796 2.474855e-02
## E01006797 1.439675e-02
## E01006798 2.889985e-02
## E01006799 1.219872e-02
## E01006800 3.785718e-02
## E01006801 1.825128e-02
## E01032505 1.620683e-02
## E01032506 -1.339253e-02
## E01032507 -6.713807e-03
## E01032508 -9.880200e-03
## E01032509 -6.913134e-03
## E01032510 -2.220786e-03
## E01032511 1.664835e-02
## E01033747 -7.703295e-03
## E01033748 -2.991864e-02
## E01033749 -3.613846e-02
## E01033750 -3.348848e-02
## E01033751 -6.830149e-03
## E01033752 -4.916580e-02
## E01033753 -4.399901e-02
## E01033754 -2.636405e-02
## E01033755 -4.229885e-02
## E01033756 -3.572738e-02
## E01033757 -3.081787e-02
## E01033758 -1.541517e-03
## E01033759 -9.322819e-03
## E01033760 -2.644491e-02
## E01033761 -4.721788e-02
## E01033762 -1.453108e-02
## E01033763 -1.284377e-02
## E01033764 -1.591561e-04
## E01033765 -1.930591e-03
## E01033766 -1.677725e-02
## E01033767 -1.025712e-02
## E01033768 -2.315115e-02
Estimate standard errors of each random effect
REextract(model.0)
## groupFctr groupID (Intercept) (Intercept)_se
## 1 LSOA_CD E01006512 -3.182056e-02 0.009585429
## 2 LSOA_CD E01006513 -3.424307e-02 0.008169440
## 3 LSOA_CD E01006514 -6.271769e-03 0.009034957
## 4 LSOA_CD E01006515 -2.389268e-02 0.009585429
## 5 LSOA_CD E01006518 4.357436e-03 0.009585429
## 6 LSOA_CD E01006519 1.255529e-02 0.010250570
## 7 LSOA_CD E01006520 -2.589256e-02 0.009585429
## 8 LSOA_CD E01006521 -1.782948e-03 0.009585429
## 9 LSOA_CD E01006522 -2.302917e-02 0.009585429
## 10 LSOA_CD E01006523 -9.711750e-03 0.009585429
## 11 LSOA_CD E01006524 1.670782e-02 0.011076662
## 12 LSOA_CD E01006525 1.326104e-02 0.010250570
## 13 LSOA_CD E01006526 1.221497e-02 0.010250570
## 14 LSOA_CD E01006527 1.241699e-02 0.009585429
## 15 LSOA_CD E01006528 2.342506e-03 0.010250570
## 16 LSOA_CD E01006529 1.035681e-02 0.010250570
## 17 LSOA_CD E01006530 3.352210e-02 0.010250570
## 18 LSOA_CD E01006531 3.370281e-02 0.009585429
## 19 LSOA_CD E01006532 1.936776e-02 0.010250570
## 20 LSOA_CD E01006533 3.348017e-02 0.010250570
## 21 LSOA_CD E01006534 2.174749e-04 0.010250570
## 22 LSOA_CD E01006535 2.297925e-02 0.010250570
## 23 LSOA_CD E01006536 2.285272e-02 0.009585429
## 24 LSOA_CD E01006537 -8.702351e-03 0.008569590
## 25 LSOA_CD E01006538 3.303271e-02 0.011076662
## 26 LSOA_CD E01006539 2.638548e-02 0.010250570
## 27 LSOA_CD E01006540 -2.189120e-02 0.009585429
## 28 LSOA_CD E01006541 -1.185700e-03 0.009585429
## 29 LSOA_CD E01006542 -2.652369e-03 0.010250570
## 30 LSOA_CD E01006543 5.572251e-03 0.011076662
## 31 LSOA_CD E01006544 4.113301e-03 0.009585429
## 32 LSOA_CD E01006545 6.589273e-03 0.010250570
## 33 LSOA_CD E01006546 -1.232262e-02 0.010250570
## 34 LSOA_CD E01006547 -2.229952e-03 0.009585429
## 35 LSOA_CD E01006548 -7.984114e-03 0.010250570
## 36 LSOA_CD E01006549 -1.599363e-02 0.009585429
## 37 LSOA_CD E01006550 -3.678480e-02 0.011076662
## 38 LSOA_CD E01006551 1.452530e-02 0.010250570
## 39 LSOA_CD E01006552 -2.658222e-02 0.010250570
## 40 LSOA_CD E01006553 -3.396303e-02 0.009585429
## 41 LSOA_CD E01006554 -1.138770e-02 0.011076662
## 42 LSOA_CD E01006556 -1.733070e-02 0.009585429
## 43 LSOA_CD E01006557 -3.855496e-02 0.009585429
## 44 LSOA_CD E01006558 -2.028484e-02 0.009034957
## 45 LSOA_CD E01006560 -7.160643e-03 0.009585429
## 46 LSOA_CD E01006562 -2.022378e-02 0.010250570
## 47 LSOA_CD E01006563 -1.612804e-03 0.009585429
## 48 LSOA_CD E01006564 6.433300e-03 0.009585429
## 49 LSOA_CD E01006565 1.443978e-02 0.010250570
## 50 LSOA_CD E01006566 1.145556e-02 0.010250570
## 51 LSOA_CD E01006567 1.210408e-03 0.009034957
## 52 LSOA_CD E01006568 5.469830e-03 0.010250570
## 53 LSOA_CD E01006569 1.076650e-02 0.010250570
## 54 LSOA_CD E01006570 1.943674e-02 0.010250570
## 55 LSOA_CD E01006571 2.287266e-02 0.010250570
## 56 LSOA_CD E01006572 -7.578150e-03 0.011076662
## 57 LSOA_CD E01006573 -5.914207e-03 0.009585429
## 58 LSOA_CD E01006574 1.598141e-03 0.010250570
## 59 LSOA_CD E01006575 7.775546e-03 0.011076662
## 60 LSOA_CD E01006576 2.387109e-02 0.010250570
## 61 LSOA_CD E01006577 1.691041e-02 0.011076662
## 62 LSOA_CD E01006578 1.514708e-05 0.010250570
## 63 LSOA_CD E01006579 5.723570e-03 0.010250570
## 64 LSOA_CD E01006580 9.335757e-03 0.010250570
## 65 LSOA_CD E01006581 1.162124e-02 0.010250570
## 66 LSOA_CD E01006582 2.294152e-02 0.010250570
## 67 LSOA_CD E01006583 2.730759e-02 0.010250570
## 68 LSOA_CD E01006584 1.773775e-02 0.010250570
## 69 LSOA_CD E01006585 7.954465e-03 0.010250570
## 70 LSOA_CD E01006586 2.448851e-03 0.009034957
## 71 LSOA_CD E01006587 1.003304e-02 0.010250570
## 72 LSOA_CD E01006588 2.706666e-04 0.010250570
## 73 LSOA_CD E01006589 1.279328e-02 0.010250570
## 74 LSOA_CD E01006590 -1.125102e-02 0.010250570
## 75 LSOA_CD E01006591 -8.093073e-03 0.010250570
## 76 LSOA_CD E01006592 2.225210e-02 0.010250570
## 77 LSOA_CD E01006593 -1.544089e-02 0.010250570
## 78 LSOA_CD E01006594 1.890099e-02 0.011076662
## 79 LSOA_CD E01006595 1.474868e-02 0.009585429
## 80 LSOA_CD E01006596 1.081927e-02 0.010250570
## 81 LSOA_CD E01006597 1.678431e-02 0.010250570
## 82 LSOA_CD E01006598 1.433672e-02 0.010250570
## 83 LSOA_CD E01006599 -1.376750e-02 0.010250570
## 84 LSOA_CD E01006600 1.425505e-02 0.010250570
## 85 LSOA_CD E01006603 2.621962e-02 0.010250570
## 86 LSOA_CD E01006604 2.208490e-02 0.010250570
## 87 LSOA_CD E01006605 8.405288e-03 0.009585429
## 88 LSOA_CD E01006606 1.945978e-02 0.010250570
## 89 LSOA_CD E01006607 7.686896e-03 0.010250570
## 90 LSOA_CD E01006608 1.206272e-02 0.010250570
## 91 LSOA_CD E01006609 8.203711e-03 0.010250570
## 92 LSOA_CD E01006610 -8.160835e-03 0.010250570
## 93 LSOA_CD E01006611 -1.919262e-02 0.010250570
## 94 LSOA_CD E01006612 -3.947673e-03 0.009585429
## 95 LSOA_CD E01006613 7.070806e-03 0.010250570
## 96 LSOA_CD E01006614 -5.046058e-03 0.010250570
## 97 LSOA_CD E01006615 -7.479317e-03 0.011076662
## 98 LSOA_CD E01006616 1.152941e-02 0.009585429
## 99 LSOA_CD E01006617 1.603185e-03 0.010250570
## 100 LSOA_CD E01006618 1.574361e-02 0.010250570
## 101 LSOA_CD E01006619 7.781391e-03 0.009585429
## 102 LSOA_CD E01006620 2.284200e-02 0.010250570
## 103 LSOA_CD E01006621 4.145800e-02 0.009585429
## 104 LSOA_CD E01006622 9.421717e-03 0.010250570
## 105 LSOA_CD E01006623 1.927478e-02 0.011076662
## 106 LSOA_CD E01006624 7.192950e-03 0.010250570
## 107 LSOA_CD E01006625 2.613628e-02 0.010250570
## 108 LSOA_CD E01006626 2.731821e-02 0.010250570
## 109 LSOA_CD E01006627 1.650893e-02 0.011076662
## 110 LSOA_CD E01006628 -4.897909e-04 0.010250570
## 111 LSOA_CD E01006629 1.022897e-02 0.011076662
## 112 LSOA_CD E01006630 -3.036968e-03 0.011076662
## 113 LSOA_CD E01006632 -1.091781e-02 0.009585429
## 114 LSOA_CD E01006633 -9.671836e-03 0.010250570
## 115 LSOA_CD E01006637 -1.330671e-02 0.011076662
## 116 LSOA_CD E01006638 -2.762730e-03 0.010250570
## 117 LSOA_CD E01006639 2.726903e-04 0.010250570
## 118 LSOA_CD E01006640 1.906137e-02 0.009585429
## 119 LSOA_CD E01006641 -2.007917e-02 0.010250570
## 120 LSOA_CD E01006642 -7.694855e-03 0.010250570
## 121 LSOA_CD E01006643 5.820140e-03 0.009585429
## 122 LSOA_CD E01006644 1.845258e-03 0.008569590
## 123 LSOA_CD E01006645 -2.164218e-03 0.010250570
## 124 LSOA_CD E01006646 -1.013735e-02 0.009585429
## 125 LSOA_CD E01006647 1.869488e-03 0.010250570
## 126 LSOA_CD E01006648 -4.981537e-03 0.009034957
## 127 LSOA_CD E01006651 1.140958e-02 0.010250570
## 128 LSOA_CD E01006652 1.235935e-02 0.010250570
## 129 LSOA_CD E01006653 1.921725e-02 0.010250570
## 130 LSOA_CD E01006654 -4.376887e-03 0.010250570
## 131 LSOA_CD E01006655 -5.324569e-04 0.010250570
## 132 LSOA_CD E01006656 4.114258e-03 0.009585429
## 133 LSOA_CD E01006657 -7.872799e-03 0.010250570
## 134 LSOA_CD E01006658 4.181273e-04 0.010250570
## 135 LSOA_CD E01006659 2.014006e-02 0.010250570
## 136 LSOA_CD E01006660 3.377731e-03 0.010250570
## 137 LSOA_CD E01006661 4.249064e-03 0.009585429
## 138 LSOA_CD E01006662 -4.559984e-03 0.009034957
## 139 LSOA_CD E01006663 -4.986052e-04 0.010250570
## 140 LSOA_CD E01006664 -8.414957e-03 0.010250570
## 141 LSOA_CD E01006665 1.291251e-02 0.010250570
## 142 LSOA_CD E01006666 3.628415e-03 0.011076662
## 143 LSOA_CD E01006667 1.091174e-02 0.010250570
## 144 LSOA_CD E01006668 2.110586e-03 0.010250570
## 145 LSOA_CD E01006669 -3.686651e-03 0.010250570
## 146 LSOA_CD E01006670 1.167296e-02 0.010250570
## 147 LSOA_CD E01006671 9.358581e-03 0.011076662
## 148 LSOA_CD E01006672 5.062009e-03 0.009585429
## 149 LSOA_CD E01006673 -2.407697e-02 0.009585429
## 150 LSOA_CD E01006674 -1.829823e-02 0.009585429
## 151 LSOA_CD E01006675 -2.518753e-02 0.008569590
## 152 LSOA_CD E01006676 -1.697750e-02 0.010250570
## 153 LSOA_CD E01006677 -1.756856e-02 0.012141217
## 154 LSOA_CD E01006678 1.211965e-02 0.009585429
## 155 LSOA_CD E01006679 -1.614432e-02 0.009034957
## 156 LSOA_CD E01006680 2.170238e-02 0.010250570
## 157 LSOA_CD E01006681 9.028126e-03 0.010250570
## 158 LSOA_CD E01006682 2.732908e-02 0.011076662
## 159 LSOA_CD E01006683 2.411389e-02 0.010250570
## 160 LSOA_CD E01006684 1.630417e-02 0.009034957
## 161 LSOA_CD E01006685 7.291282e-03 0.010250570
## 162 LSOA_CD E01006686 2.288973e-02 0.011076662
## 163 LSOA_CD E01006687 8.607007e-03 0.008569590
## 164 LSOA_CD E01006688 -4.810441e-03 0.009585429
## 165 LSOA_CD E01006689 6.103415e-03 0.010250570
## 166 LSOA_CD E01006690 -2.293878e-02 0.009585429
## 167 LSOA_CD E01006691 -1.887900e-02 0.010250570
## 168 LSOA_CD E01006692 -7.986259e-03 0.009034957
## 169 LSOA_CD E01006693 8.118563e-04 0.009585429
## 170 LSOA_CD E01006694 -2.279981e-02 0.009585429
## 171 LSOA_CD E01006695 -2.794374e-02 0.008569590
## 172 LSOA_CD E01006696 -1.542892e-02 0.009585429
## 173 LSOA_CD E01006697 -1.037761e-02 0.009585429
## 174 LSOA_CD E01006698 2.472150e-03 0.009585429
## 175 LSOA_CD E01006699 -3.348621e-03 0.010250570
## 176 LSOA_CD E01006700 -9.121578e-03 0.010250570
## 177 LSOA_CD E01006701 9.023180e-05 0.010250570
## 178 LSOA_CD E01006702 -5.752432e-03 0.010250570
## 179 LSOA_CD E01006703 -1.002697e-02 0.009034957
## 180 LSOA_CD E01006705 3.264763e-05 0.009585429
## 181 LSOA_CD E01006706 9.094105e-03 0.010250570
## 182 LSOA_CD E01006707 5.904415e-03 0.010250570
## 183 LSOA_CD E01006708 -3.727901e-03 0.009585429
## 184 LSOA_CD E01006709 -5.584794e-03 0.010250570
## 185 LSOA_CD E01006710 9.084507e-03 0.010250570
## 186 LSOA_CD E01006711 1.068391e-02 0.010250570
## 187 LSOA_CD E01006712 -6.659937e-03 0.011076662
## 188 LSOA_CD E01006713 -3.494552e-03 0.010250570
## 189 LSOA_CD E01006716 -3.972287e-03 0.010250570
## 190 LSOA_CD E01006717 1.611413e-02 0.010250570
## 191 LSOA_CD E01006718 7.096009e-03 0.010250570
## 192 LSOA_CD E01006719 9.482573e-03 0.010250570
## 193 LSOA_CD E01006720 -3.239984e-02 0.009034957
## 194 LSOA_CD E01006721 -1.646945e-02 0.009585429
## 195 LSOA_CD E01006722 -3.550460e-02 0.009585429
## 196 LSOA_CD E01006723 -2.322143e-02 0.010250570
## 197 LSOA_CD E01006724 -2.578817e-02 0.010250570
## 198 LSOA_CD E01006725 -1.290198e-02 0.010250570
## 199 LSOA_CD E01006726 -1.882985e-02 0.010250570
## 200 LSOA_CD E01006727 -9.800065e-03 0.010250570
## 201 LSOA_CD E01006728 -2.019934e-02 0.009585429
## 202 LSOA_CD E01006729 -8.322356e-03 0.011076662
## 203 LSOA_CD E01006730 7.501505e-03 0.010250570
## 204 LSOA_CD E01006731 -1.913531e-04 0.011076662
## 205 LSOA_CD E01006732 9.207381e-03 0.010250570
## 206 LSOA_CD E01006734 -4.517331e-03 0.010250570
## 207 LSOA_CD E01006735 -2.352048e-03 0.010250570
## 208 LSOA_CD E01006736 8.096132e-03 0.011076662
## 209 LSOA_CD E01006737 2.479464e-02 0.010250570
## 210 LSOA_CD E01006738 1.730998e-03 0.010250570
## 211 LSOA_CD E01006739 -9.628008e-03 0.009585429
## 212 LSOA_CD E01006740 -1.484395e-02 0.010250570
## 213 LSOA_CD E01006741 7.097818e-03 0.009585429
## 214 LSOA_CD E01006742 1.106181e-02 0.010250570
## 215 LSOA_CD E01006743 -6.391225e-03 0.008569590
## 216 LSOA_CD E01006744 -6.472019e-03 0.009585429
## 217 LSOA_CD E01006745 -6.211850e-03 0.009034957
## 218 LSOA_CD E01006746 -1.768134e-03 0.010250570
## 219 LSOA_CD E01006747 3.071708e-02 0.008569590
## 220 LSOA_CD E01006748 -3.060059e-02 0.010250570
## 221 LSOA_CD E01006751 -1.602370e-02 0.009034957
## 222 LSOA_CD E01006752 -4.895420e-03 0.012141217
## 223 LSOA_CD E01006753 4.636644e-03 0.010250570
## 224 LSOA_CD E01006754 -1.171528e-02 0.009585429
## 225 LSOA_CD E01006755 -7.826194e-03 0.010250570
## 226 LSOA_CD E01006756 -5.273068e-03 0.010250570
## 227 LSOA_CD E01006757 -1.858317e-02 0.010250570
## 228 LSOA_CD E01006758 -1.506321e-03 0.010250570
## 229 LSOA_CD E01006759 6.624059e-03 0.012141217
## 230 LSOA_CD E01006760 -1.579089e-02 0.009585429
## 231 LSOA_CD E01006761 1.686619e-03 0.009585429
## 232 LSOA_CD E01006762 3.442153e-03 0.010250570
## 233 LSOA_CD E01006763 6.350352e-03 0.010250570
## 234 LSOA_CD E01006764 -7.525493e-03 0.010250570
## 235 LSOA_CD E01006765 1.343083e-02 0.010250570
## 236 LSOA_CD E01006766 -1.184864e-02 0.010250570
## 237 LSOA_CD E01006767 -8.660403e-03 0.010250570
## 238 LSOA_CD E01006768 6.421767e-03 0.010250570
## 239 LSOA_CD E01006769 -1.394706e-03 0.010250570
## 240 LSOA_CD E01006770 9.889624e-03 0.010250570
## 241 LSOA_CD E01006771 5.493938e-04 0.010250570
## 242 LSOA_CD E01006772 1.181820e-02 0.011076662
## 243 LSOA_CD E01006773 1.920767e-02 0.010250570
## 244 LSOA_CD E01006774 1.400108e-02 0.010250570
## 245 LSOA_CD E01006775 5.768256e-03 0.010250570
## 246 LSOA_CD E01006776 -1.534655e-02 0.009034957
## 247 LSOA_CD E01006778 -1.793883e-03 0.009034957
## 248 LSOA_CD E01006779 1.165406e-02 0.009034957
## 249 LSOA_CD E01006780 6.661440e-03 0.010250570
## 250 LSOA_CD E01006781 1.349923e-02 0.011076662
## 251 LSOA_CD E01006782 9.569002e-03 0.010250570
## 252 LSOA_CD E01006783 -2.737926e-05 0.010250570
## 253 LSOA_CD E01006784 -5.673674e-03 0.011076662
## 254 LSOA_CD E01006785 1.736877e-03 0.009585429
## 255 LSOA_CD E01006786 1.143319e-02 0.010250570
## 256 LSOA_CD E01006787 2.719366e-02 0.010250570
## 257 LSOA_CD E01006788 8.298214e-03 0.010250570
## 258 LSOA_CD E01006790 -7.313847e-03 0.010250570
## 259 LSOA_CD E01006791 3.309313e-03 0.009585429
## 260 LSOA_CD E01006792 9.025187e-03 0.010250570
## 261 LSOA_CD E01006793 5.334619e-04 0.010250570
## 262 LSOA_CD E01006794 8.117879e-03 0.010250570
## 263 LSOA_CD E01006795 1.727118e-02 0.010250570
## 264 LSOA_CD E01006796 2.474855e-02 0.010250570
## 265 LSOA_CD E01006797 1.439675e-02 0.010250570
## 266 LSOA_CD E01006798 2.889985e-02 0.010250570
## 267 LSOA_CD E01006799 1.219872e-02 0.009034957
## 268 LSOA_CD E01006800 3.785718e-02 0.009585429
## 269 LSOA_CD E01006801 1.825128e-02 0.010250570
## 270 LSOA_CD E01032505 1.620683e-02 0.010250570
## 271 LSOA_CD E01032506 -1.339253e-02 0.010250570
## 272 LSOA_CD E01032507 -6.713807e-03 0.010250570
## 273 LSOA_CD E01032508 -9.880200e-03 0.010250570
## 274 LSOA_CD E01032509 -6.913134e-03 0.010250570
## 275 LSOA_CD E01032510 -2.220786e-03 0.009034957
## 276 LSOA_CD E01032511 1.664835e-02 0.010250570
## 277 LSOA_CD E01033747 -7.703295e-03 0.011076662
## 278 LSOA_CD E01033748 -2.991864e-02 0.009034957
## 279 LSOA_CD E01033749 -3.613846e-02 0.013586635
## 280 LSOA_CD E01033750 -3.348848e-02 0.008569590
## 281 LSOA_CD E01033751 -6.830149e-03 0.011076662
## 282 LSOA_CD E01033752 -4.916580e-02 0.009585429
## 283 LSOA_CD E01033753 -4.399901e-02 0.010250570
## 284 LSOA_CD E01033754 -2.636405e-02 0.008569590
## 285 LSOA_CD E01033755 -4.229885e-02 0.010250570
## 286 LSOA_CD E01033756 -3.572738e-02 0.010250570
## 287 LSOA_CD E01033757 -3.081787e-02 0.011076662
## 288 LSOA_CD E01033758 -1.541517e-03 0.010250570
## 289 LSOA_CD E01033759 -9.322819e-03 0.010250570
## 290 LSOA_CD E01033760 -2.644491e-02 0.011076662
## 291 LSOA_CD E01033761 -4.721788e-02 0.009034957
## 292 LSOA_CD E01033762 -1.453108e-02 0.012141217
## 293 LSOA_CD E01033763 -1.284377e-02 0.009585429
## 294 LSOA_CD E01033764 -1.591561e-04 0.007238884
## 295 LSOA_CD E01033765 -1.930591e-03 0.011076662
## 296 LSOA_CD E01033766 -1.677725e-02 0.011076662
## 297 LSOA_CD E01033767 -1.025712e-02 0.011076662
## 298 LSOA_CD E01033768 -2.315115e-02 0.011076662
With exracting the standard errors, we are able to see how the multievel models have a large average of values in the outcome variable.
Visualizing the multilevel model to identify which groups have larger-than-average values of the outcome variable
LSOA_re <- REsim(model.0)
head(LSOA_re)
## groupFctr groupID term mean median sd
## 1 LSOA_CD E01006512 (Intercept) -0.032556935 -0.031104142 0.009661493
## 2 LSOA_CD E01006513 (Intercept) -0.033161739 -0.033161435 0.007786633
## 3 LSOA_CD E01006514 (Intercept) -0.006859774 -0.006194372 0.008786558
## 4 LSOA_CD E01006515 (Intercept) -0.022878719 -0.022667317 0.009667960
## 5 LSOA_CD E01006518 (Intercept) 0.004371021 0.004067831 0.009325570
## 6 LSOA_CD E01006519 (Intercept) 0.013687944 0.012488494 0.010294510
Now a caterpillar graph was created to visualise the mean of each LSOA random effect and the associated 95% confidence interval
p <- plotREsim(LSOA_re)
p
The caterpillar graph show the interesting findings of of the 95% confidence intervals and how they overlap with each other. The unpaid provsional care varies accross the graph significantly in the LSOA. Within the LSOA there shows to be a positive and negative effect.
The percentage of Provisional Care within Males, Age 20-24, having car availability and a Deprivation of education.
model.1 <- lmer(Care_Prop ~ c_Male + c_Age20.24 + c_CarAvail + IMD_educat + (1|LSOA_CD), data = OAData)
summary(model.1)
## Linear mixed model fit by REML ['lmerMod']
## Formula: Care_Prop ~ c_Male + c_Age20.24 + c_CarAvail + IMD_educat + (1 |
## LSOA_CD)
## Data: OAData
##
## REML criterion at convergence: -6562.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.8972 -0.6012 -0.0566 0.5480 9.2188
##
## Random effects:
## Groups Name Variance Std.Dev.
## LSOA_CD (Intercept) 0.0002855 0.01690
## Residual 0.0007122 0.02669
## Number of obs: 1584, groups: LSOA_CD, 298
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 7.894e-02 3.941e-03 20.030
## c_Male 1.590e-04 2.237e-05 7.109
## c_Age20.24 -1.185e-04 2.502e-05 -4.735
## c_CarAvail 2.000e-05 2.556e-05 0.782
## IMD_educat -2.300e-04 6.724e-05 -3.420
##
## Correlation of Fixed Effects:
## (Intr) c_Male c_A20. c_CrAv
## c_Male -0.190
## c_Age20.24 -0.009 -0.710
## c_CarAvail -0.561 -0.542 0.412
## IMD_educat -0.711 -0.283 0.248 0.539
Calculate the VPC
VPC <- 0.0002855 / (0.0002855 + 0.0007122)
VPC
## [1] 0.2861582
The variance gives a good idea that using this model should be a reason to continue with the MLM.
The merTools() package allows to find the fixed effects and the associated statistical uncertain measures and be calculated
fe.eff <- FEsim(model.1)
fe.eff
## term mean median sd
## 1 (Intercept) 7.871863e-02 7.888806e-02 3.978562e-03
## 2 c_Male 1.602584e-04 1.613549e-04 2.244197e-05
## 3 c_Age20.24 -1.187510e-04 -1.219885e-04 2.350806e-05
## 4 c_CarAvail 2.070127e-05 1.856137e-05 2.421730e-05
## 5 IMD_educat -2.297125e-04 -2.280328e-04 6.892201e-05
Visualize the fixed effects
plotFEsim(fe.eff) +
theme_bw() +
labs(x = "Median model coefficients and CIs", y = "Provisional Care")
The graph shows how much income deprivation varies negatively between the other variables and how males have a stronger positive effect. The notations are ranged from -4.0004 to 2.0004.
Another way to visualise the LSOA-level random effects is by geographically importing the LSOA shapefile to show a more potential spatial pattern of unpaid provisional car in Liveprool.
First Import the LSOA Spatial data
LSOA <- readOGR(dsn = "/Users/Ernie/Desktop/Spatial Analysis/Assignment 1/LSOA.shp", stringsAsFactors = FALSE)
## OGR data source with driver: ESRI Shapefile
## Source: "/Users/Ernie/Desktop/Spatial Analysis/Assignment 1/LSOA.shp", layer: "LSOA"
## with 298 features
## It has 22 fields
## Integer64 fields read as strings: IMD_rank IMD_Number c_Age20-24 c_Pop c_Male c_Female c_CarAvail c_LilCare c_LotCare
LSOA@data <- merge(LSOA@data, LSOA_re, by.x = "LSOA_CD", by.y = "groupID",
all.x = TRUE)
head(LSOA@data)
## LSOA_CD MSOA_CD LAD_CD IMD_rank IMD_score IMD_income IMD_employ
## 1 E01006512 E02001377 E08000012 10518 25.61 0.10 0.08
## 2 E01006513 E02006932 E08000012 10339 25.91 0.04 0.03
## 3 E01006514 E02001383 E08000012 5247 37.64 0.19 0.15
## 4 E01006515 E02001383 E08000012 1019 58.99 0.43 0.30
## 5 E01006518 E02001390 E08000012 662 63.37 0.43 0.34
## 6 E01006519 E02001402 E08000012 23033 10.98 0.05 0.08
## IMD_educat IMD_health IMD_crime IMD_housin IMD_living IMD_idaci
## 1 10.06 1.19 -0.20 24.49 68.91 0.16
## 2 20.13 0.58 1.50 25.15 85.48 0.21
## 3 15.50 1.86 0.74 21.85 58.90 0.23
## 4 33.51 1.90 1.16 17.40 29.78 0.46
## 5 49.90 2.24 0.67 15.52 31.03 0.50
## 6 1.76 0.26 0.11 11.37 26.35 0.05
## IMD_idaopi IMD_Number c_Age20.24 c_Pop c_Male c_Female c_CarAvail
## 1 0.31 1 615 1420 1070 810 314
## 2 0.20 1 1366 1691 1461 1480 353
## 3 0.48 1 586 1758 1177 931 466
## 4 0.76 1 141 1208 595 613 218
## 5 0.52 1 120 1630 843 853 345
## 6 0.08 1 56 1286 628 658 685
## c_LilCare c_LotCare groupFctr term mean median
## 1 66 10 LSOA_CD (Intercept) -0.032556935 -0.031104142
## 2 74 7 LSOA_CD (Intercept) -0.033161739 -0.033161435
## 3 134 21 LSOA_CD (Intercept) -0.006859774 -0.006194372
## 4 46 27 LSOA_CD (Intercept) -0.022878719 -0.022667317
## 5 88 72 LSOA_CD (Intercept) 0.004371021 0.004067831
## 6 110 31 LSOA_CD (Intercept) 0.013687944 0.012488494
## sd
## 1 0.009661493
## 2 0.007786633
## 3 0.008786558
## 4 0.009667960
## 5 0.009325570
## 6 0.010294510
Then, using spplot() function to map the random effect estimates
temp <- LSOA@data$mean
brks.temp <- classIntervals(temp, n = 5, style = "quantile")
brks.temp <- round(brks.temp$brks, digits = 2)
brks.temp[1] <- brks.temp[1] - 0.01
brks.temp[5 + 1] <- brks.temp[5 +1] + 0.01
# Adding the scale bar and legend
xx <- LSOA@bbox
scalebar <- list("SpatialPolygonsRescale", layout.scale.bar(),
offset = c(min(xx[1,] + 1000),xx[2,1] + 1000),
scale = 5000, fill = c("transparent", "black"))
text1 <- list("sp.text", c(min(xx[1,]) + 1000,xx[2,1] + 1500),
"0")
text2 <- list("sp.text", c(min(xx[1,]) + 6000,xx[2,1] + 1500),
"5km")
northarrow <- list("SpatialPolygonsRescale", layout.north.arrow(),
offset = c(min(xx[1,]) + 2000,xx[2,1] + 2000),
scale = 1500)
## Plot
spplot(LSOA, "mean", sp.layout = list(scalebar, text1, text2, northarrow),
at = brks.temp, col.regions = brewer.pal(5, "YlOrRd"),
col = "transparent", pretty = TRUE,
colorkey = list(labels=list(at=brks.temp)))
The final results show how a magority of people that have unpaid provisional care within the age group of 20-24 are in the east and south east area of Liverpool which consisist of a high suburban area.
A random sample vnvestigation of varying relationships between Car Availability and people with provision of unpaid care
sample.20 <- sample(unique(OAData$LSOA_CD), 20, replace = FALSE)
ggplot(OAData[OAData$LSOA_CD %in% sample.20,], aes(x = c_CarAvail, y = Care_Prop)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE) +
facet_wrap(~ LSOA_CD) +
xlab("Car Availability") +
ylab("Percent of Provisional Care") +
theme_bw()
The positive and negative slopes in each different LSOAs can be produced later on to show a random slope MLM, but for now the intercepts are a good enough conclusion that shows a reason for producing a Multilevel Model within different Output Areas.
Fotheringham, A S and D W S Wong. “The Modifiable Areal Unit Problem In Multivariate Statistical Analysis”. Environment and Planning A 23.7 (1991): 1025-1044. Web.
Snijders, Tom A. B and R. J Bosker. Multilevel Analysis. 1st ed. Los Angeles: SAGE, 2012. Print.