# set how ordered logit runs
options(contrasts = rep("contr.treatment", 2))
library(tidyverse) # package for data cleaning and plotting
library(ordinal) # package for ordinal logit regression
library(MetBrewer) # package for nice color scale
library(modelsummary)
First, import the sampled and coded data set
#import the raw data file
socialcare_raw <- read_csv("data/sample_new.csv")
#select relevant columns, rename and relabel
socialcare <- socialcare_raw %>%
# recode legal form types to be more readable / easier to present
mutate(location_id = factor(location_id),
form = case_when(form_num == 1 ~ "FPO",
form_num == 2 ~ "NPO",
form_num == 3 ~ "GOV",
form_num == 4 ~ "CIC",
form_num == 5 ~ "IND",
TRUE ~ as.character(NA)),
inherited = ifelse(inherited == "Y", TRUE, FALSE),
rating = recode(rating,
"Insufficient evidence to rate" = "NA",
"Requires improvement" = "Req improv")) %>%
# set the order of the values in the factors
mutate(form = ordered(form, levels = c("FPO", "NPO", "GOV", "CIC", "FAM")),
domain = ordered(domain, levels = c("Safe", "Effective", "Caring",
"Reponsive", "Well-led", "Overall")),
# assume the order of the ratings as follows but need to double check with the source
rating = ordered(rating, levels = c("Inadequate","Req improv", "Good", "Outstanding")))
# show first several rows of the data set derived
head(socialcare)
## # A tibble: 6 x 34
## ...1 location_id `Location ODS Co~` `Location Name` `Care Home` primary_cat
## <dbl> <fct> <chr> <chr> <chr> <chr>
## 1 1 1-10000792582 VNH4P 69 Tenter Lane N Community ~
## 2 2 1-10000792582 VNH4P 69 Tenter Lane N Community ~
## 3 3 1-10000792582 VNH4P 69 Tenter Lane N Community ~
## 4 4 1-10000792582 VNH4P 69 Tenter Lane N Community ~
## 5 5 1-10000792582 VNH4P 69 Tenter Lane N Community ~
## 6 6 1-10000792582 VNH4P 69 Tenter Lane N Community ~
## # ... with 28 more variables: `Location Street Address` <chr>,
## # `Location Address Line 2` <chr>, `Location City` <chr>,
## # `Location Post Code` <chr>, `Location Local Authority` <chr>, region <chr>,
## # `Location NHS Region` <chr>, `Location ONSPD CCG Code` <chr>,
## # `Location ONSPD CCG` <chr>, `Location Commissioning CCG Code` <lgl>,
## # `Location Commissioning CCG Name` <lgl>,
## # `Service / Population Group` <chr>, domain <ord>, rating <ord>, ...
# inspecting the distribution of the data
point_graph <- ggplot(socialcare, aes(x = form, y = fct_rev(rating),
color = domain)) +
facet_wrap(vars(domain), ncol = 3) +
geom_point(size = 0.3, position = position_jitter(), alpha = 0.5) +
scale_color_manual(values = met.brewer("Austria", 5)) +
guides(color = "none") +
theme_minimal()
point_graph
I check here the region and primary_cat
variables, since the total number of categories are not too large, I
decide to first include region in the model. But the
primary_cat’s distribution is actually two main categories
– community based and residential (divided by 6 rating domains, there
are only 1 or 2 facilities in other categories).I will only keep the
data for these two categories.
table(socialcare$region)
##
## East Midlands East of England London
## 8132 9378 9141
## North East North West South East
## 3654 10619 15609
## South West West Midlands Yorkshire and The Humber
## 10460 9660 8058
table(socialcare$primary_cat)
##
## Community based adult social care services
## 28201
## Community health - NHS & Independent
## 6
## Community substance misuse
## 12
## Mental health - community & hospital - independent
## 12
## Residential social care
## 56480
# creating a new dummy variable for facility category
socialcare <- socialcare %>%
mutate(category = case_when(primary_cat == "Community based adult social care services" ~ "community",
primary_cat == "Residential social care" ~ "residential",
TRUE ~ as.character(NA)))
# converting the ordinal variable to numerical
socialcare_num <- socialcare %>%
mutate(rating_num = case_when(rating == "Inadequate" ~ 1,
rating == "Req improv" ~ 2,
rating == "Good" ~ 3,
rating == "Outstanding" ~ 4))
# sum up the scores
socialcare_total = socialcare_num %>%
group_by(location_id) %>%
summarise(total = sum(rating_num),
form = first(form),
category = first(category),
region = first(region),
inherited = first(inherited),
cic_type = first(cic_type))
# show first several rows of the data set derived
head(socialcare_total)
## # A tibble: 6 x 7
## location_id total form category region inherited cic_type
## <fct> <dbl> <ord> <chr> <chr> <lgl> <chr>
## 1 1-10000792582 13 FPO community Yorkshire and The Hu~ TRUE <NA>
## 2 1-10000812939 18 FPO residential North West TRUE <NA>
## 3 1-10000813008 18 FPO residential North West FALSE <NA>
## 4 1-1000210669 18 FPO residential South East FALSE <NA>
## 5 1-1000401911 18 FPO residential London FALSE <NA>
## 6 1-10005776421 19 FPO residential South West TRUE <NA>
I think I am right by using location_id instead of
provider_id. My understanding is that one provider can have
multiple locations. In other words. location_id is the
unique id for the facilities rated.
# run the naive ols model
model_ols_simple <- lm(total ~ form,
data = socialcare_total)
summary(model_ols_simple)
##
## Call:
## lm(formula = total ~ form, data = socialcare_total)
##
## Residuals:
## Min 1Q Median 3Q Max
## -13.8751 0.1249 0.4359 0.4359 26.1249
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 17.56408 0.01972 890.668 < 2e-16 ***
## formNPO 0.31099 0.04663 6.670 2.68e-11 ***
## formGOV 0.29614 0.09743 3.040 0.00237 **
## formCIC 0.33836 0.20417 1.657 0.09750 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.84 on 11055 degrees of freedom
## (2508 observations deleted due to missingness)
## Multiple R-squared: 0.004721, Adjusted R-squared: 0.004451
## F-statistic: 17.48 on 3 and 11055 DF, p-value: 2.566e-11
# run the ols model with control on total score
model_ols_total <- lm(total ~ form + category + region + inherited,
data = socialcare_total)
summary(model_ols_total)
##
## Call:
## lm(formula = total ~ form + category + region + inherited, data = socialcare_total)
##
## Residuals:
## Min 1Q Median 3Q Max
## -13.8549 -0.1677 0.3171 0.5545 25.8323
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 17.55702 0.06169 284.613 < 2e-16 ***
## formNPO 0.29791 0.04644 6.415 1.47e-10 ***
## formGOV 0.28193 0.09694 2.908 0.00364 **
## formCIC 0.21410 0.20311 1.054 0.29184
## categoryresidential -0.26020 0.03683 -7.065 1.71e-12 ***
## regionEast of England 0.15583 0.07586 2.054 0.03998 *
## regionLondon 0.08813 0.07773 1.134 0.25693
## regionNorth East 0.60755 0.10117 6.005 1.97e-09 ***
## regionNorth West 0.31279 0.07522 4.159 3.23e-05 ***
## regionSouth East 0.28410 0.06855 4.144 3.44e-05 ***
## regionSouth West 0.56981 0.07490 7.608 3.02e-14 ***
## regionWest Midlands -0.11154 0.07539 -1.480 0.13901
## regionYorkshire and The Humber -0.01757 0.07942 -0.221 0.82496
## inheritedTRUE -0.28418 0.06976 -4.073 4.66e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.823 on 11041 degrees of freedom
## (2512 observations deleted due to missingness)
## Multiple R-squared: 0.02355, Adjusted R-squared: 0.0224
## F-statistic: 20.48 on 13 and 11041 DF, p-value: < 2.2e-16
What I find interesting is he the dummy variable “inherited” does negatively affect the total score. Does it mean facilities with lower rating are more liked to be bought by others?
One caveat with the summing up method is not all locations have all the ratings in each domain. But as shown below the result is quite consistent among different rating categories, with NPO and GOV having higher rating, FAM has lower rating, CIC insignificant difference, compared with FPO.
# run the ols model with control on different domains
model_ols_overall <- lm(rating_num ~ form + category + region + inherited,
data = filter(socialcare_num, domain == "Overall"))
model_ols_safe <- lm(rating_num ~ form + category + region + inherited,
data = filter(socialcare_num, domain == "Safe"))
model_ols_effective <- lm(rating_num ~ form + category + region + inherited,
data = filter(socialcare_num, domain == "Effective"))
model_ols_caring <- lm(rating_num ~ form + category + region + inherited,
data = filter(socialcare_num, domain == "Caring"))
model_ols_well_led <- lm(rating_num ~ form + category + region + inherited,
data = filter(socialcare_num, domain == "Well-led"))
modelsummary(list("total" = model_ols_total, "overall" = model_ols_overall, "safe" = model_ols_safe,
"effective" = model_ols_effective, "caring"= model_ols_caring, "well-led" = model_ols_well_led),
statistic = "({p.value}) {stars}")
| total | overall | safe | effective | caring | well-led | |
|---|---|---|---|---|---|---|
| (Intercept) | 17.557*** | 2.874*** | 2.792*** | 2.896*** | 3.019*** | 2.815*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| formNPO | 0.298*** | 0.082*** | 0.082*** | 0.040*** | 0.027*** | 0.100*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| formGOV | 0.282** | 0.082*** | 0.097*** | 0.039* | 0.029+ | 0.097*** |
| (0.004) ** | (0.001) *** | (0.000) *** | (0.023) * | (0.064) + | (0.000) *** | |
| formCIC | 0.214 | 0.105* | 0.102* | 0.020 | 0.080* | 0.110+ |
| (0.292) | (0.040) * | (0.028) * | (0.578) | (0.014) * | (0.051) + | |
| categoryresidential | -0.260*** | -0.071*** | -0.065*** | -0.038*** | -0.049*** | -0.068*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| regionEast of England | 0.156* | 0.039* | 0.039* | 0.037** | 0.011 | 0.026 |
| (0.040) * | (0.038) * | (0.019) * | (0.006) ** | (0.337) | (0.203) | |
| regionLondon | 0.088 | 0.020 | 0.050** | 0.050*** | 0.000 | 0.026 |
| (0.257) | (0.300) | (0.003) ** | (0.000) *** | (0.980) | (0.210) | |
| regionNorth East | 0.608*** | 0.132*** | 0.119*** | 0.094*** | 0.072*** | 0.156*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| regionNorth West | 0.313*** | 0.046* | 0.062*** | 0.055*** | 0.015 | 0.044* |
| (0.000) *** | (0.011) * | (0.000) *** | (0.000) *** | (0.205) | (0.027) * | |
| regionSouth East | 0.284*** | 0.066*** | 0.101*** | 0.052*** | 0.039*** | 0.060** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.001) ** | |
| regionSouth West | 0.570*** | 0.143*** | 0.119*** | 0.089*** | 0.085*** | 0.144*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| regionWest Midlands | -0.112 | -0.025 | 0.023 | 0.020 | -0.016 | -0.069*** |
| (0.139) | (0.170) | (0.174) | (0.123) | (0.160) | (0.001) *** | |
| regionYorkshire and The Humber | -0.018 | -0.032+ | -0.021 | 0.024+ | 0.032** | -0.037+ |
| (0.825) | (0.096) + | (0.225) | (0.075) + | (0.009) ** | (0.079) + | |
| inheritedTRUE | -0.284*** | -0.020 | -0.020 | -0.032** | -0.033** | -0.019 |
| (0.000) *** | (0.244) | (0.205) | (0.009) ** | (0.003) ** | (0.332) | |
| Num.Obs. | 11055 | 12129 | 12153 | 12121 | 12117 | 12150 |
| R2 | 0.024 | 0.023 | 0.023 | 0.012 | 0.018 | 0.025 |
| R2 Adj. | 0.022 | 0.022 | 0.022 | 0.011 | 0.017 | 0.024 |
| AIC | 44664.0 | 15905.1 | 13388.4 | 7578.3 | 4933.4 | 18300.7 |
| BIC | 44773.7 | 16016.1 | 13499.5 | 7689.3 | 5044.4 | 18411.8 |
| Log.Lik. | -22317.000 | -7937.541 | -6679.192 | -3774.126 | -2451.688 | -9135.359 |
| F | 20.485 | 22.066 | 22.140 | 11.208 | 17.020 | 23.829 |
# derive output table
model_order_overall <- clm(rating ~ form + category + region + inherited,
data = filter(socialcare, domain == "Overall"),
link = "logit")
summary(model_order_overall)
## formula: rating ~ form + category + region + inherited
## data: filter(socialcare, domain == "Overall")
##
## link threshold nobs logLik AIC niter max.grad cond.H
## logit flexible 12129 -7764.53 15561.05 7(0) 2.38e-08 2.3e+02
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## formNPO 0.45441 0.06423 7.075 1.50e-12 ***
## formGOV 0.42906 0.13398 3.202 0.00136 **
## formCIC 0.59048 0.29161 2.025 0.04288 *
## categoryresidential -0.38914 0.04911 -7.923 2.31e-15 ***
## regionEast of England 0.22652 0.09872 2.295 0.02175 *
## regionLondon 0.11226 0.09902 1.134 0.25692
## regionNorth East 0.75085 0.13666 5.494 3.93e-08 ***
## regionNorth West 0.26871 0.09674 2.777 0.00548 **
## regionSouth East 0.35133 0.08893 3.951 7.79e-05 ***
## regionSouth West 0.84680 0.10103 8.382 < 2e-16 ***
## regionWest Midlands -0.13097 0.09464 -1.384 0.16642
## regionYorkshire and The Humber -0.15353 0.09898 -1.551 0.12086
## inheritedTRUE -0.11644 0.09193 -1.267 0.20529
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Threshold coefficients:
## Estimate Std. Error z value
## Inadequate|Req improv -4.44553 0.11393 -39.02
## Req improv|Good -1.69876 0.08035 -21.14
## Good|Outstanding 3.13239 0.08827 35.49
## (1989 observations deleted due to missingness)
I will ran the models but only show the results in the comparing table
# run the ordered logit model with control
model_order_safe <- clm(rating ~ form + category + region + inherited,
data = filter(socialcare, domain == "Safe"),
link = "logit")
model_order_effective <- clm(rating ~ form + category + region + inherited,
data = filter(socialcare, domain == "Effective"),
link = "logit")
model_order_caring <- clm(rating ~ form + category + region + inherited,
data = filter(socialcare, domain == "Caring"),
link = "logit")
model_order_well_led <- clm(rating ~ form + category + region + inherited,
data = filter(socialcare, domain == "Well-led"),
link = "logit")
modelsummary(list("overall" = model_order_overall, "safe" = model_order_safe,
"effective" = model_order_effective, "caring"= model_order_caring, "well-led" = model_order_well_led),
statistic = "({p.value}) {stars}")
| overall | safe | effective | caring | well-led | |
|---|---|---|---|---|---|
| Inadequate|Req improv | -4.446*** | -4.258*** | -5.983*** | -7.143*** | -4.105*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| Req improv|Good | -1.699*** | -1.454*** | -2.108*** | -3.452*** | -1.329*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| Good|Outstanding | 3.132*** | 5.800*** | 4.333*** | 2.976*** | 3.157*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| formNPO | 0.454*** | 0.580*** | 0.412*** | 0.313*** | 0.471*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| formGOV | 0.429** | 0.684*** | 0.390* | 0.323+ | 0.443*** |
| (0.001) ** | (0.000) *** | (0.030) * | (0.069) + | (0.000) *** | |
| formCIC | 0.590* | 0.800* | 0.196 | 0.822* | 0.480+ |
| (0.043) * | (0.039) * | (0.605) | (0.012) * | (0.083) + | |
| categoryresidential | -0.389*** | -0.428*** | -0.391*** | -0.580*** | -0.303*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| regionEast of England | 0.227* | 0.232* | 0.316** | 0.159 | 0.118 |
| (0.022) * | (0.019) * | (0.008) ** | (0.277) | (0.195) | |
| regionLondon | 0.112 | 0.281** | 0.444*** | 0.005 | 0.139 |
| (0.257) | (0.006) ** | (0.000) *** | (0.972) | (0.131) | |
| regionNorth East | 0.751*** | 0.798*** | 0.933*** | 0.864*** | 0.752*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| regionNorth West | 0.269** | 0.400*** | 0.491*** | 0.191 | 0.228* |
| (0.005) ** | (0.000) *** | (0.000) *** | (0.183) | (0.011) * | |
| regionSouth East | 0.351*** | 0.628*** | 0.444*** | 0.491*** | 0.254** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.002) ** | |
| regionSouth West | 0.847*** | 0.813*** | 0.890*** | 1.005*** | 0.716*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| regionWest Midlands | -0.131 | 0.119 | 0.172 | -0.216 | -0.305*** |
| (0.166) | (0.215) | (0.137) | (0.134) | (0.000) *** | |
| regionYorkshire and The Humber | -0.154 | -0.110 | 0.225+ | 0.390** | -0.161+ |
| (0.121) | (0.263) | (0.068) + | (0.010) ** | (0.080) + | |
| inheritedTRUE | -0.116 | -0.157 | -0.288* | -0.397** | -0.082 |
| (0.205) | (0.105) | (0.010) * | (0.003) ** | (0.340) | |
| Num.Obs. | 12129 | 12153 | 12121 | 12117 | 12150 |
| AIC | 15561.1 | 12522.9 | 9692.2 | 8490.0 | 17733.1 |
| BIC | 15679.5 | 12641.4 | 9810.6 | 8608.4 | 17851.6 |
| Log.Lik. | -7764.526 | -6245.460 | -4830.101 | -4228.977 | -8850.556 |
| edf | 16.000 | 16.000 | 16.000 | 16.000 | 16.000 |
My exposure to ordered logit models is limited. Will research more into the correct way to interpret results and derive essential model metrics later. But as is shown the coeffients for the main IV form is consistent with ols models.
# derive the sub-set of home-based care facilities
socialcare_home <- socialcare_num %>%
filter(category == "community")
I will ran the ordered logit models but only show the results in the comparing table
# run the ordered logit model with control
model_order_overall_home <- clm(rating ~ form + region + inherited,
data = filter(socialcare_home, domain == "Overall"),
link = "logit")
model_order_safe_home <- clm(rating ~ form + region + inherited,
data = filter(socialcare_home, domain == "Safe"),
link = "logit")
model_order_effective_home <- clm(rating ~ form + region + inherited,
data = filter(socialcare_home, domain == "Effective"),
link = "logit")
model_order_caring_home <- clm(rating ~ form + region + inherited,
data = filter(socialcare_home, domain == "Caring"),
link = "logit")
model_order_well_led_home <- clm(rating ~ form + region + inherited,
data = filter(socialcare_home, domain == "Well-led"),
link = "logit")
modelsummary(list("overall" = model_order_overall_home, "safe" = model_order_safe_home,
"effective" = model_order_effective_home, "caring"= model_order_caring_home,
"well-led" = model_order_well_led_home),
statistic = "({p.value}) {stars}")
| overall | safe | effective | caring | well-led | |
|---|---|---|---|---|---|
| Inadequate|Req improv | -4.484*** | -4.321*** | -5.658*** | -7.785*** | -4.203*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| Req improv|Good | -1.663*** | -1.373*** | -1.973*** | -4.126*** | -1.297*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| Good|Outstanding | 3.469*** | 5.968*** | 4.913*** | 2.755*** | 3.264*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| formNPO | 0.649*** | 0.951*** | 0.570** | 0.299+ | 0.661*** |
| (0.000) *** | (0.000) *** | (0.002) ** | (0.066) + | (0.000) *** | |
| formGOV | 0.828*** | 1.370*** | 0.845** | 0.267 | 0.801*** |
| (0.000) *** | (0.000) *** | (0.005) ** | (0.315) | (0.000) *** | |
| formCIC | 0.668+ | 0.499 | 0.563 | 0.745+ | 0.330 |
| (0.057) + | (0.221) | (0.261) | (0.053) + | (0.291) | |
| regionEast of England | 0.376* | 0.278 | 0.706** | -0.120 | 0.202 |
| (0.036) * | (0.120) | (0.002) ** | (0.638) | (0.205) | |
| regionLondon | 0.061 | 0.048 | 0.425* | -0.541* | 0.036 |
| (0.716) | (0.774) | (0.042) * | (0.034) * | (0.809) | |
| regionNorth East | 0.768** | 0.674* | 0.976** | 0.204 | 0.692** |
| (0.003) ** | (0.024) * | (0.006) ** | (0.553) | (0.003) ** | |
| regionNorth West | 0.580** | 0.625** | 0.864*** | -0.087 | 0.331* |
| (0.001) ** | (0.001) ** | (0.000) *** | (0.734) | (0.039) * | |
| regionSouth East | 0.567*** | 0.746*** | 0.844*** | 0.190 | 0.388** |
| (0.001) *** | (0.000) *** | (0.000) *** | (0.417) | (0.010) ** | |
| regionSouth West | 1.079*** | 1.336*** | 1.409*** | 0.856*** | 0.833*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| regionWest Midlands | -0.083 | 0.152 | 0.254 | -0.592* | -0.248 |
| (0.633) | (0.390) | (0.230) | (0.026) * | (0.107) | |
| regionYorkshire and The Humber | -0.331+ | -0.207 | 0.210 | -0.103 | -0.354* |
| (0.070) + | (0.262) | (0.369) | (0.711) | (0.031) * | |
| inheritedTRUE | -0.153 | -0.061 | -0.413* | -0.510* | -0.238+ |
| (0.314) | (0.716) | (0.029) * | (0.026) * | (0.072) + | |
| Num.Obs. | 4224 | 4241 | 4207 | 4200 | 4238 |
| AIC | 4854.8 | 3826.9 | 2859.9 | 2707.4 | 5902.8 |
| BIC | 4950.0 | 3922.1 | 2955.1 | 2802.5 | 5998.1 |
| Log.Lik. | -2412.375 | -1898.427 | -1414.965 | -1338.698 | -2936.424 |
| edf | 15.000 | 15.000 | 15.000 | 15.000 | 15.000 |
# derive the sub-set of home-based care facilities
socialcare_resident <- socialcare_num %>%
filter(category == "residential")
I will ran the ordered logit models but only show the results in the comparing table
# run the ordered logit model with control
model_order_overall_resid <- clm(rating ~ form + region + inherited,
data = filter(socialcare_resident, domain == "Overall"),
link = "logit")
model_order_safe_resid <- clm(rating ~ form + region + inherited,
data = filter(socialcare_resident, domain == "Safe"),
link = "logit")
model_order_effective_resid <- clm(rating ~ form + region + inherited,
data = filter(socialcare_resident, domain == "Effective"),
link = "logit")
model_order_caring_resid <- clm(rating ~ form + region + inherited,
data = filter(socialcare_resident, domain == "Caring"),
link = "logit")
model_order_well_led_resid <- clm(rating ~ form + region + inherited,
data = filter(socialcare_resident, domain == "Well-led"),
link = "logit")
modelsummary(list("overall" = model_order_overall_resid, "safe" = model_order_safe_resid,
"effective" = model_order_effective_resid, "caring"= model_order_caring_resid,
"well-led" = model_order_well_led_resid),
statistic = "({p.value}) {stars}")
| overall | safe | effective | caring | well-led | |
|---|---|---|---|---|---|
| Inadequate|Req improv | -4.060*** | -3.824*** | -5.725*** | -6.362*** | -3.779*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| Req improv|Good | -1.336*** | -1.068*** | -1.775*** | -2.662*** | -1.051*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| Good|Outstanding | 3.352*** | 6.261*** | 4.466*** | 3.602*** | 3.412*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| formNPO | 0.386*** | 0.479*** | 0.364*** | 0.319** | 0.403*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.002) ** | (0.000) *** | |
| formGOV | 0.159 | 0.318 | 0.131 | 0.427+ | 0.165 |
| (0.364) | (0.104) | (0.564) | (0.087) + | (0.321) | |
| formCIC | 0.625 | 2.404* | -0.401 | 1.389* | 1.159+ |
| (0.286) | (0.024) * | (0.505) | (0.043) * | (0.056) + | |
| regionEast of England | 0.157 | 0.205+ | 0.164 | 0.260 | 0.066 |
| (0.186) | (0.083) + | (0.244) | (0.138) | (0.554) | |
| regionLondon | 0.180 | 0.498*** | 0.532*** | 0.270 | 0.241* |
| (0.151) | (0.000) *** | (0.001) *** | (0.146) | (0.042) * | |
| regionNorth East | 0.729*** | 0.825*** | 0.898*** | 1.120*** | 0.761*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| regionNorth West | 0.141 | 0.308** | 0.358* | 0.291+ | 0.168 |
| (0.218) | (0.008) ** | (0.011) * | (0.086) + | (0.119) | |
| regionSouth East | 0.269* | 0.583*** | 0.310* | 0.606*** | 0.198* |
| (0.010) * | (0.000) *** | (0.014) * | (0.000) *** | (0.044) * | |
| regionSouth West | 0.756*** | 0.673*** | 0.722*** | 1.031*** | 0.667*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| regionWest Midlands | -0.154 | 0.098 | 0.148 | -0.078 | -0.339** |
| (0.174) | (0.392) | (0.285) | (0.644) | (0.001) ** | |
| regionYorkshire and The Humber | -0.093 | -0.087 | 0.219 | 0.588*** | -0.090 |
| (0.431) | (0.452) | (0.131) | (0.001) *** | (0.420) | |
| inheritedTRUE | -0.102 | -0.209+ | -0.229 | -0.351* | 0.016 |
| (0.383) | (0.080) + | (0.103) | (0.037) * | (0.886) | |
| Num.Obs. | 7905 | 7912 | 7914 | 7917 | 7912 |
| AIC | 10697.1 | 8678.7 | 6825.7 | 5781.4 | 11831.8 |
| BIC | 10801.8 | 8783.4 | 6930.4 | 5886.0 | 11936.4 |
| Log.Lik. | -5333.572 | -4324.368 | -3397.853 | -2875.684 | -5900.884 |
| edf | 15.000 | 15.000 | 15.000 | 15.000 | 15.000 |
cic_num <- socialcare_num %>%
filter(form_num == 4)
cic_total <- socialcare_total %>%
filter(form == "CIC")
# run the ols model with control on total score
model_ols_total_cic <- lm(total ~ category + region + inherited + cic_type,
data = cic_total)
summary(model_ols_total_cic)
##
## Call:
## lm(formula = total ~ category + region + inherited + cic_type,
## data = cic_total)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.4947 -0.7219 0.1532 0.6343 4.8111
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 19.13805 1.03110 18.561 <2e-16 ***
## categoryresidential -0.35211 0.51712 -0.681 0.4982
## regionEast of England -0.87705 1.14789 -0.764 0.4474
## regionLondon -1.77239 1.16197 -1.525 0.1317
## regionNorth East -1.83910 1.52419 -1.207 0.2316
## regionNorth West 0.05086 1.12238 0.045 0.9640
## regionSouth East -1.56903 1.25023 -1.255 0.2137
## regionSouth West -0.56903 1.25023 -0.455 0.6504
## regionWest Midlands -2.29739 1.23788 -1.856 0.0677 .
## regionYorkshire and The Humber -1.41618 1.20943 -1.171 0.2456
## inheritedTRUE 1.10316 1.40940 0.783 0.4364
## cic_typeCIC_S -0.41416 0.47769 -0.867 0.3889
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.764 on 70 degrees of freedom
## Multiple R-squared: 0.1783, Adjusted R-squared: 0.04913
## F-statistic: 1.38 on 11 and 70 DF, p-value: 0.2016
# run the ols model with control on different domains
model_ols_overall_cic <- lm(rating_num ~ category + region + inherited + cic_type,
data = filter(cic_num, domain == "Overall"))
model_ols_safe_cic <- lm(rating_num ~ category + region + inherited + cic_type,
data = filter(cic_num, domain == "Safe"))
model_ols_effective_cic <- lm(rating_num ~ category + region + inherited + cic_type,
data = filter(cic_num, domain == "Effective"))
model_ols_caring_cic <- lm(rating_num ~ category + region + inherited + cic_type,
data = filter(cic_num, domain == "Caring"))
model_ols_well_led_cic <- lm(rating_num ~ category + region + inherited + cic_type,
data = filter(cic_num, domain == "Well-led"))
modelsummary(list("overall" = model_ols_overall_cic, "safe" = model_ols_safe_cic,
"effective" = model_ols_effective_cic, "caring"= model_ols_caring_cic,
"well-led" = model_ols_well_led_cic),
statistic = "({p.value}) {stars}")
| overall | safe | effective | caring | well-led | |
|---|---|---|---|---|---|
| (Intercept) | 3.281*** | 3.043*** | 2.991*** | 3.027*** | 3.286*** |
| (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | (0.000) *** | |
| categoryresidential | -0.125 | 0.050 | -0.140 | -0.087 | 0.021 |
| (0.319) | (0.608) | (0.127) | (0.430) | (0.892) | |
| regionEast of England | -0.133 | 0.049 | -0.105 | 0.234 | -0.282 |
| (0.599) | (0.804) | (0.568) | (0.295) | (0.368) | |
| regionLondon | -0.431+ | -0.274 | -0.005 | 0.016 | -0.428 |
| (0.093) + | (0.173) | (0.976) | (0.943) | (0.176) | |
| regionNorth East | -0.301 | -0.049 | -0.034 | -0.213 | -0.710 |
| (0.389) | (0.858) | (0.892) | (0.488) | (0.102) | |
| regionNorth West | 0.031 | 0.091 | 0.043 | 0.304 | 0.070 |
| (0.900) | (0.631) | (0.807) | (0.158) | (0.815) | |
| regionSouth East | -0.427 | -0.181 | 0.003 | -0.009 | -0.429 |
| (0.127) | (0.407) | (0.988) | (0.971) | (0.213) | |
| regionSouth West | -0.094 | -0.014 | 0.003 | 0.158 | -0.095 |
| (0.736) | (0.947) | (0.988) | (0.519) | (0.781) | |
| regionWest Midlands | -0.478+ | -0.158 | -0.227 | -0.102 | -0.682* |
| (0.085) + | (0.463) | (0.257) | (0.674) | (0.047) * | |
| regionYorkshire and The Humber | -0.297 | -0.073 | 0.021 | 0.187 | -0.701* |
| (0.269) | (0.729) | (0.913) | (0.430) | (0.037) * | |
| inheritedTRUE | 0.060 | 0.018 | 0.130 | 0.560+ | 0.271 |
| (0.860) | (0.947) | (0.601) | (0.067) + | (0.522) | |
| cic_typeCIC_S | -0.123 | -0.172+ | 0.036 | -0.107 | -0.145 |
| (0.282) | (0.058) + | (0.661) | (0.290) | (0.307) | |
| Num.Obs. | 84 | 84 | 84 | 84 | 84 |
| R2 | 0.176 | 0.152 | 0.110 | 0.149 | 0.247 |
| R2 Adj. | 0.050 | 0.022 | -0.026 | 0.019 | 0.131 |
| AIC | 108.8 | 68.1 | 55.1 | 87.6 | 144.3 |
| BIC | 140.4 | 99.7 | 86.7 | 119.2 | 175.9 |
| Log.Lik. | -41.401 | -21.059 | -14.543 | -30.797 | -59.164 |
| F | 1.401 | 1.170 | 0.806 | 1.149 | 2.142 |
# run the ordered logit model with control
model_order_overall_cic <- clm(rating ~ category + region + inherited + cic_type,
data = filter(cic_num, domain == "Overall"),
link = "logit")
model_order_safe_cic <- clm(rating ~ category + region + inherited + cic_type,
data = filter(cic_num, domain == "Safe"),
link = "logit")
model_order_effective_cic <- clm(rating ~ category + region + inherited + cic_type,
data = filter(cic_num, domain == "Effective"),
link = "logit")
model_order_caring_cic <- clm(rating ~ category + region + inherited + cic_type,
data = filter(cic_num, domain == "Caring"),
link = "logit")
model_order_well_led_cic <- clm(rating ~ category + region + inherited + cic_type,
data = filter(cic_num, domain == "Well-led"),
link = "logit")
modelsummary(list("overall" = model_order_overall_cic, "safe" = model_order_safe_cic,
"effective" = model_order_effective_cic, "caring"= model_order_caring_cic,
"well-led" = model_order_well_led_cic),
statistic = "({p.value}) {stars}")
| overall | safe | effective | caring | well-led | |
|---|---|---|---|---|---|
| Req improv|Good | -4.924*** | -4.165+ | -3.490 | -3.875+ | -3.606** |
| (0.001) *** | (0.064) + | (0.115) | (0.094) + | (0.004) ** | |
| Good|Outstanding | 0.911 | 3.284 | 3.601 | 3.436 | 0.847 |
| (0.427) | (0.136) | (0.103) | (0.135) | (0.436) | |
| categoryresidential | -0.863 | 0.554 | -1.387 | -0.676 | 0.058 |
| (0.272) | (0.608) | (0.144) | (0.423) | (0.927) | |
| regionEast of England | -1.089 | -0.110 | -1.243 | 2.537 | -1.466 |
| (0.477) | (0.963) | (0.606) | (0.301) | (0.286) | |
| regionLondon | -3.264* | -2.579 | -0.031 | 0.123 | -2.112 |
| (0.040) * | (0.266) | (0.990) | (0.962) | (0.126) | |
| regionNorth East | -2.144 | -0.581 | -0.472 | -1.740 | -3.395+ |
| (0.366) | (0.873) | (0.887) | (0.553) | (0.058) + | |
| regionNorth West | 0.211 | 1.059 | 0.519 | 2.951 | 0.439 |
| (0.871) | (0.651) | (0.827) | (0.216) | (0.722) | |
| regionSouth East | -3.256+ | -2.201 | 0.019 | -0.071 | -2.132 |
| (0.058) + | (0.373) | (0.995) | (0.980) | (0.152) | |
| regionSouth West | -0.514 | -0.130 | 0.019 | 1.959 | -0.412 |
| (0.738) | (0.962) | (0.995) | (0.438) | (0.772) | |
| regionWest Midlands | -3.422* | -1.911 | -1.937 | -1.538 | -3.183* |
| (0.037) * | (0.440) | (0.418) | (0.545) | (0.029) * | |
| regionYorkshire and The Humber | -2.322 | -1.242 | 0.287 | 2.107 | -3.215* |
| (0.170) | (0.615) | (0.913) | (0.403) | (0.025) * | |
| inheritedTRUE | 0.411 | 0.418 | 1.495 | 3.808+ | 1.360 |
| (0.871) | (0.909) | (0.609) | (0.079) + | (0.452) | |
| cic_typeCIC_S | -0.739 | -1.581+ | 0.223 | -0.848 | -0.676 |
| (0.271) | (0.063) + | (0.820) | (0.262) | (0.248) | |
| Num.Obs. | 84 | 84 | 84 | 84 | 84 |
| AIC | 113.1 | 84.2 | 79.6 | 95.1 | 143.9 |
| BIC | 144.7 | 115.8 | 111.2 | 126.7 | 175.5 |
| Log.Lik. | -43.529 | -29.091 | -26.810 | -34.537 | -58.927 |
| edf | 13.000 | 13.000 | 13.000 | 13.000 | 13.000 |
end of document 8/15/2022