Skip to contents

The calculate_* functions are based on the OxCGRT’s methodology described here. There are two sets of calculate functions included in oxcgrt. The first calculates the OxCGRT sub-indices described in the table below:

ID Name Description Measurement Coding Policy Group
C1 School closing Record closings of schools and universities Ordinal scale 0 - no measures; 1 - recommend closing or all schools open with alterations resulting in significant differences compared to non-Covid-19 operations; 2 - require closing (only some levels or categories, eg just high school, or just public schools); 3 - require closing all levels; Blank - no data Containment and closure policies
C2 Workplace closing Record closings of workplaces Ordinal scale 0 - no measures; 1 - recommend closing (or recommend work from home) or all businesses open with alterations resulting in significant differences compared to non-Covid-19 operation; 2 - require closing (or work from home) for some sectors or categories of workers; 3 - require closing (or work from home) for all-but-essential workplaces (eg grocery stores, doctors); Blank - no data Containment and closure policies
C3 Cancel public events Record cancelling public events Ordinal scale 0 - no measures; 1 - recommend cancelling; 2 - require cancelling; Blank - no data Containment and closure policies
C4 Restrictions on gatherings Record limits on gatherings Ordinal scale 0 - no restrictions; 1 - restrictions on very large gatherings (the limit is above; 1000 people); 2 - restrictions on gatherings between; 101-1000 people; 3 - restrictions on gatherings between; 11-100 people; 4 - restrictions on gatherings of; 10 people or less; Blank - no data Containment and closure policies
C5 Close public transport Record closing of public transport Ordinal scale 0 - no measures; 1 - recommend closing (or significantly reduce volume/route/means of transport available); 2 - require closing (or prohibit most citizens from using it); Blank - no data Containment and closure policies
C6 Stay at home requirements Record orders to “shelter-in-place” and otherwise confine to the home Ordinal scale 0 - no measures; 1 - recommend not leaving house; 2 - require not leaving house with exceptions for daily exercise, grocery shopping, and ‘essential’ trips; 3 - require not leaving house with minimal exceptions (eg allowed to leave once a week, or only one person can leave at a time, etc); Blank - no data Containment and closure policies
C7 Restrictions on internal movement Record restrictions on internal movement between cities/regions Ordinal scale 0 - no measures; 1 - recommend not to travel between regions/cities; 2 - internal movement restrictions in place; Blank - no data Containment and closure policies
C8 International travel controls Record restrictions on international travel Note: this records policy for foreign travellers, not citizens Ordinal scale 0 - no restrictions; 1 - screening arrivals; 2 - quarantine arrivals from some or all regions; 3 - ban arrivals from some regions; 4 - ban on all regions or total border closure; Blank - no data Containment and closure policies
E1 Income support (for households) Record if the government is providing direct cash payments to people who lose their jobs or cannot work. Note: only includes payments to firms if explicitly linked to payroll/salaries Ordinal scale 0 - no income support; 1 - government is replacing less than 50% of lost salary (or if a flat sum, it is less than 50% median salary); 2 - government is replacing 50% or more of lost salary (or if a flat sum, it is greater than 50% median salary); Blank - no data Economic policies
E2 Debt/contract relief (for households) Record if the government is freezing financial obligations for households (eg stopping loan repayments, preventing services like water from stopping, or banning evictions) Ordinal scale 0 - no debt/contract relief; 1 - narrow relief, specific to one kind of contract; 2 - broad debt/contract relief Economic policies
E3 Fiscal measures Announced economic stimulus spending Note: only record amount additional to previously announced spending USD Record monetary value in USD of fiscal stimuli, includes any spending or tax cuts NOT included in E4, H4 or H5; 0 - no new spending that day; Blank - no data Economic policies
E4 International support Announced offers of Covid-19 related aid spending to other countries Note: only record amount additional to previously announced spending USD Record monetary value in USD; 0 - no new spending that day; Blank - no data Economic policies
H1 Public information campaigns Record presence of public info campaigns Ordinal scale 0 - no Covid-19 public information campaign; 1 - public officials urging caution about Covid-19; 2- coordinated public information campaign (eg across traditional and social media); Blank - no data Health system policies
H2 Testing policy Record government policy on who has access to testing Note: this records policies about testing for current infection (PCR tests) not testing for immunity (antibody test) Ordinal scale 0 - no testing policy; 1 - only those who both (a) have symptoms AND (b) meet specific criteria (eg key workers, admitted to hospital, came into contact with a known case, returned from overseas); 2 - testing of anyone showing Covid-19 symptoms; 3 - open public testing (eg “drive through” testing available to asymptomatic people); Blank - no data Health system policies
H3 Contact tracing Record government policy on contact tracing after a positive diagnosis Note: we are looking for policies that would identify all people potentially exposed to Covid-19; voluntary bluetooth apps are unlikely to achieve this Ordinal scale 0 - no contact tracing; 1 - limited contact tracing; not done for all cases; 2 - comprehensive contact tracing; done for all identified cases Health system policies
H4 Emergency investment in healthcare Announced short term spending on healthcare system, eg hospitals, masks, etc Note: only record amount additional to previously announced spending USD Record monetary value in USD; 0 - no new spending that day; Blank - no data Health system policies
H5 Investment in vaccines Announced public spending on Covid-19 vaccine development Note: only record amount additional to previously announced spending USD Record monetary value in USD; 0 - no new spending that day; Blank - no data Health system policies
H6 Facial Coverings Record policies on the use of facial coverings outside the home Ordinal scale 0 - No policy; 1 - Recommended; 2 - Required in some specified shared/public spaces outside the home with other people present, or some situations when social distancing not possible; 3 - Required in all shared/public spaces outside the home with other people present or all situations when social distancing not possible; 4 - Required outside the home at all times regardless of location or presence of other people Health system policies
H7 Vaccination Policy Record policies for vaccine delivery for different groups Ordinal scale 0 - No availability; 1 - Availability for ONE of following: key workers/ clinically vulnerable groups (non elderly) / elderly groups; 2 - Availability for TWO of following: key workers/ clinically vulnerable groups (non elderly) / elderly groups; 3 - Availability for ALL of following: key workers/ clinically vulnerable groups (non elderly) / elderly groups; 4 - Availability for all three plus partial additional availability (select broad groups/ages) 5 - Universal availability Health system policies
H8 Protection of elderly people Record policies for protecting elderly people (as defined locally) in Long Term Care Facilities and/or the community and home setting Ordinal scale 0 - no measures; 1 - Recommended isolation, hygiene, and visitor restriction measures in LTCFs and/or elderly people to stay at home; 2 - Narrow restrictions for isolation, hygiene in LTCFs, some limitations on external visitors and/or restrictions protecting elderly people at home; 3 - Extensive restrictions for isolation and hygiene in LTCFs, all non-essential external visitors prohibited, and/or all elderly people required to stay at home and not leave the home with minimal exceptions, and receive no external visitors; Blank - no data Health system policies
Vaccine prioritisation V1 Vaccine prioritisation 0-4 yrs Infants 5-15 yrs Young people General 16-19 yrs General 20-24 yrs General 25-29 yrs General 30-34 yrs General 35-39 yrs General 40-44 yrs General 45-49 yrs General 50-54 yrs General 55-59 yrs General 60-64 yrs General 65-69 yrs General 70-74 yrs General 75-79 yrs General 80+ yrs At Risk 16-19 yrs At Risk 20-24 yrs At Risk 25-29 yrs At Risk 30-34 yrs At Risk 35-39 yrs At Risk 40-44 yrs At Risk 45-49 yrs At Risk 50-54 yrs At Risk 55-59 yrs At Risk 60-64 yrs At Risk 65-69 yrs At Risk 70-74 yrs At Risk 75-79 yrs At Risk 80+ yrs Airport/Border/Airline Staff Clinically vulnerable/chronic illness/significant underlying health condition (excluding elderly and disabled) Crowded/communal living conditions (dormitories for migrant workers, temporary accommodations) Disabled People Educators Ethnic minorities Factory workers Frontline/essential workers (when subcategories not specified) Frontline retail workers Healthcare workers/carers (excluding care home staff) Military Other ‘high contact’ professions/groups (taxi drivers, security guards) People living with a vulnerable/shielding person or other priority group Police/ first responders Pregnant people Primary and secondary school students Religious/Spiritual Leaders Residents in an elderly care home Staff working in an elderly care home Tertiary education students Refugees/migrantsGovernment Officials Record the ranked position for different groups within a countries prioritisation plan Rank order Blank – category not selected for prioritisation1,; 2,; 3,; 4… – category has been selected for prioritisation; number represents the rank of prioritisation; equal-ranked categories will share the same number Vaccination policies
Vaccine eligibility/availability V2 Vaccine eligibility/availability 0-4 yrs Infants 5-15 yrs Young people General 16-19 yrs General 20-24 yrs General 25-29 yrs General 30-34 yrs General 35-39 yrs General 40-44 yrs General 45-49 yrs General 50-54 yrs General 55-59 yrs General 60-64 yrs General 65-69 yrs General 70-74 yrs General 75-79 yrs General 80+ yrs At Risk 16-19 yrs At Risk 20-24 yrs At Risk 25-29 yrs At Risk 30-34 yrs At Risk 35-39 yrs At Risk 40-44 yrs At Risk 45-49 yrs At Risk 50-54 yrs At Risk 55-59 yrs At Risk 60-64 yrs At Risk 65-69 yrs At Risk 70-74 yrs At Risk 75-79 yrs At Risk 80+ yrs Airport/Border/Airline Staff Clinically vulnerable/chronic illness/significant underlying health condition (excluding elderly and disabled) Crowded/communal living conditions (dormitories for migrant workers, temporary accommodations) Disabled People Educators Ethnic minorities Factory workers Frontline/essential workers (when subcategories not specified) Frontline retail workers Healthcare workers/carers (excluding care home staff) Military Other ‘high contact’ professions/groups (taxi drivers, security guards) People living with a vulnerable/shielding person or other priority group Police/ first responders Pregnant people Primary and secondary school students Religious/Spiritual Leaders Residents in an elderly care home Staff working in an elderly care home Tertiary education students Refugees/migrantsGovernment Officials Record which categories of people – regardless of their position in a prioritised rollout plan – are currently receiving vaccines Categorical/ binary Blank – no data; 0 - vaccines are not being made available to this category; 1 - vaccines are being made available to this category Vaccination policies
Vaccine financial support V3 Vaccine financial support 0-4 yrs Infants 5-15 yrs Young people General 16-19 yrs General 20-24 yrs General 25-29 yrs General 30-34 yrs General 35-39 yrs General 40-44 yrs General 45-49 yrs General 50-54 yrs General 55-59 yrs General 60-64 yrs General 65-69 yrs General 70-74 yrs General 75-79 yrs General 80+ yrs At Risk 16-19 yrs At Risk 20-24 yrs At Risk 25-29 yrs At Risk 30-34 yrs At Risk 35-39 yrs At Risk 40-44 yrs At Risk 45-49 yrs At Risk 50-54 yrs At Risk 55-59 yrs At Risk 60-64 yrs At Risk 65-69 yrs At Risk 70-74 yrs At Risk 75-79 yrs At Risk 80+ yrs Airport/Border/Airline Staff Clinically vulnerable/chronic illness/significant underlying health condition (excluding elderly and disabled) Crowded/communal living conditions (dormitories for migrant workers, temporary accommodations) Disabled People Educators Ethnic minorities Factory workers Frontline/essential workers (when subcategories not specified) Frontline retail workers Healthcare workers/carers (excluding care home staff) Military Other ‘high contact’ professions/groups (taxi drivers, security guards) People living with a vulnerable/shielding person or other priority group Police/ first responders Pregnant people Primary and secondary school students Religious/Spiritual Leaders Residents in an elderly care home Staff working in an elderly care home Tertiary education students Refugees/migrantsGovernment Officials Record how vaccines are funded for each category of people identified in V2 as currently receiving vaccines. Ordinal scale Blank - no data; 1 - full cost borne by the individual (or through private health insurance) or no policy; 2 - partially funded by government and individual pays nominal fee; 3 - fully covered by government funding, FREE Vaccination policies
V4 Vaccine requirement/mandate 0-4 yrs Infants 5-15 yrs Young people General 16-19 yrs VGeneral 20-24 yrs General 25-29 yrs General 30-34 yrs General 35-39 yrs General 40-44 yrs General 45-49 yrs General 50-54 yrs General 55-59 yrs General 60-64 yrs General 65-69 yrs General 70-74 yrs General 75-79 yrs General 80+ yrs At Risk 16-19 yrs At Risk 20-24 yrs At Risk 25-29 yrs At Risk 30-34 yrs At Risk 35-39 yrs At Risk 40-44 yrs VAt Risk 45-49 yrs At Risk 50-54 yrs At Risk 55-59 yrs At Risk 60-64 yrs At Risk 65-69 yrs At Risk 70-74 yrs At Risk 75-79 yrs At Risk 80+ yrs Airport/Border/Airline Staff Clinically vulnerable/chronic illness/significant underlying health condition (excluding elderly and disabled) Crowded/communal living conditions (dormitories for migrant workers, temporary accommodations) Disabled People Educators Ethnic minorities Factory workers Frontline/essential workers (when subcategories not specified) Frontline retail workers Healthcare workers/carers (excluding care home staff) Military Other ‘high contact’ professions/groups (taxi drivers, security guards) People living with a vulnerable/shielding person or other priority group Police/ first responders Pregnant people Primary and secondary school students Religious/Spiritual Leaders Residents in an elderly care home Staff working in an elderly care home Tertiary education students Refugees/migrantsGovernment Officials Reports the existence of a requirement to be vaccinated Binary Blank - no data; 0 - no requirement to be vaccinated; 1 - requirement to be vaccinated Vaccination policies
V1 Vaccine prioritisation (summary) Reports the existence of a prioritised plan for vaccine rollout Ordinal scale Blank – no data; 0 - no plan ; 1 – a prioritised plan is in place; 2 – universal/general eligibility; no prioritisation between groups Vaccination policies
V2 Vaccine eligibility/availability (summary) Reports whether any categories of people are receiving vaccines Ordinal scale Blank – no data; 0 – no categories are receiving vaccines; 1 – vaccines are available to some categories; 2 – vaccines are available to anyone over the age of; 16 yrs; 3 – vaccines are available to anyone over the age of; 16 yrs PLUS one or both of 5-15 yrs and; 0-4 yrs Vaccination policies
V2B V2B_Vaccine age eligibility/availability age floor(General population summary) Reports lowest age range of general population being vaccinated Numerical Blank – no data; 0 – no categories are receiving vaccines numerical range – Lowest age range for ‘General’ category Vaccination policies
V2C V2C_Vaccine age eligibility/availability age floor(At-risk population summary) Reports lowest age range of at risk population being vaccinated Numerical Blank – no data; 0 – no categories are receiving vaccines numerical range – Lowest age range from either ‘General’ or ‘At-risk’ categories Vaccination policies
V2D V2D_Medically/ clinically vulnerable (Non-elderly) Reports the number of categories selected from thematic group: V2_At risk age ranges below 60 (one or more selected counts as 1 x category) V2_Clinically vulnerable/chronic illness/significant underlying health condition (excluding elderly and disabled) V2_Disabled people V2_Pregnant people V2_People living with a vulnerable/shielding person or other priority group Ordinal Blank – no data; 0 – no categories are receiving vaccines; 1 –; 1 or; 2 categories in group selected; 2 –; 3 or more categories selected or all from V2_General; 16-19 years up to V2_General 80+ yearspresent Vaccination policies
V2E V2E_Education Reports the number of categories selected from thematic group: V2_Educators V2_Primary and secondary school students V2_Tertiary education students Ordinal Blank – no data; 0 – no categories are receiving vaccines; 1 –; 1 category in group selected; 2 -; 2 or more categories selected or all from V2_General; 16-19 years up to V2_General 80+ yearspresent Vaccination policies
V2F V2F_Frontline workers (non healthcare) Reports the number of categories selected from thematic group: V2_Police/first responders V2_Airport/Border/Airline staff V2_Factory workers V2_Frontline retail workers V2_Military V2_Other high contact professions/groups (taxi drivers, security guards) V2_Frontline/essential workers (when subcategories not specified) (triggers an automatic 2) Ordinal Blank – no data; 0 – no categories are receiving vaccines; 1 –; 1 or; 2 categories in group selected; 2 -; 3 or more categories selected or all from V2_General; 16-19 years up to V2_General 80+ yearspresent Vaccination policies
V2F V2F_Frontline workers (healthcare) Reports the number of categories selected from thematic group: V2_Staff working in an elderly care home V2_Healthcare workers/carers (excluding care home staff) Ordinal Blank – no data; 0 – no categories are receiving vaccines; 1 –; 1 category in group selected; 2 -; 2 categories selected or all from V2_General; 16-19 years up to V2_General 80+ yearspresent Vaccination policies
V3 Vaccine financial support (summary) Reports the overall approach taken to vaccine funding – whether paid by the individual or the government Ordinal scale Blank - no data; 0 – no availability ; 1 – full cost to the individual for all categories identified in V2 ; 2 – full cost to the individual for some categories identified in V2, some subsidy for other categories ; 3- partial funding by the government for all of the categories identified in V2 ; 4 – partial funding by the government for some categories identified in V2, full funding for other categories 5 – all categories fully funded by the government Vaccination policies
V4 Mandatory Vaccination (summary) Reports the existence of a requirement to be vaccinated Binary Blank - no data; 0 – no requirement to be vaccinated ; 1 – requirement to be vaccinated is in place for one or more groups Vaccination policies
M1 Wildcard Record policy announcements that do not fit anywhere else Free text notes field Note unusual or interesting interventions that are worth flagging Miscellaneous policies

The second calculates the four OxCGRT indices which are composed of various combinations of the indicators described in the table above. These combinations are described in the table below:

ID Name Government response index Containment and health index Stringency index Economic support index
C1 School closing x x x  
C2 Workplace closing x x x
C3 Cancel public events x x x
C4 Restrictions on gatherings x x x
C5 Close public transport x x x
C6 Stay at home requirements x x x
C7 Restrictions on internal movement x x x
C8 International travel controls x x x
E1 Income support (for households) x x  
E2 Debt/contract relief (for households) x x  
E3 Fiscal measures NA NA NA NA
E4 International support NA NA NA NA
H1 Public information campaigns x x x
H2 Testing policy x x  
H3 Contact tracing x x  
H4 Emergency investment in healthcare NA NA NA NA
H5 Investment in vaccines NA NA NA NA
H6 Facial Coverings x x  
M1 Wildcard NA NA NA NA

Calculating OxCGRT sub-indices

The OxCGRT subindices can be calculated using the calculate_subindex and calculate_subindices functions. To calculate a specific sub-index, the following code is used:

## Given the C1 data in indicatorData, calculate C1 sub-index
calculate_subindex(indicator_code = indicatorData[1, "indicator"], 
                   value = indicatorData[1, "value"], 
                   flag_value = indicatorData[1, "flag_value"])

This gives a C1 index value of:

#>      value
#> 1 66.66667

To calculate all OxCGRT subindices, the following code is used:

## Given the indicatorData dataset, calculate all sub-indices
indicatorData |>
  calculate_subindices(indicator_code = "indicator", 
                       value = "value", 
                       flag_value = "flag_value",
                       add = TRUE)

This results in the following output:

#> # A tibble: 16 × 7
#>    indicator value flag_value max_value  flag score score.1
#>    <chr>     <int>      <int>     <int> <int> <dbl>   <dbl>
#>  1 C1            2          1         3     1  66.7    66.7
#>  2 C2           NA         NA         3     1   0       0  
#>  3 C3            2          0         2     1  75      75  
#>  4 C4            2          0         4     1  37.5    37.5
#>  5 C5            0         NA         2     1   0       0  
#>  6 C6            1          0         3     1  16.7    16.7
#>  7 C7            1          1         2     1  50      50  
#>  8 C8            3         NA         4     0  75      75  
#>  9 E1            2          0         2     1  75      75  
#> 10 E2            2         NA         2     0 100     100  
#> 11 H1            2          0         2     1  75      75  
#> 12 H2            3         NA         3     0 100     100  
#> 13 H3            2         NA         2     0 100     100  
#> 14 H6            2          0         4     1  37.5    37.5
#> 15 H7            2          1         5     1  40      40  
#> 16 H8            2          1         3     1  66.7    66.7

It can be noted that the results of the calculations are added to the input data.frame under the column name score.1. Comparing this with the value in the column named score that is included in the indicatorData dataset, the results are the same.

Calculating OxCGRT indices

The OxCGRT indices can be calculated using the calculate_index and calculate_indices functions. To calculate a specific sub-index, the following code can be used:

indicatorData |>
  calculate_subindices(indicator_code = "indicator",
                       value = "value",
                       flag_value = "flag_value",
                       add = FALSE) |>
  calculate_index(codes = c(paste("C", 1:8, sep = ""),
                            paste("E", 1:2, sep = ""),
                            paste("H", 1:3, sep = ""),
                            paste("H", 6:8, sep = "")), 
                  tolerance = 1)

This code calculates the government response index which is:

#> [1] 57.1875

The same result can be reached by using the specialised function calculate_gov_response as follows:

indicatorData |> 
  calculate_subindices(indicator_code = "indicator",
                       value = "value",
                       flag_value = "flag_value",
                       add = FALSE) |>
  calculate_gov_response()

which results in the same value as the previous code:

#> [1] 57.1875

To calculate all four OxCGRT indices, the following code can be implemented:

indicatorData |> 
  calculate_subindices(indicator_code = "indicator",
                       value = "value",
                       flag_value = "flag_value",
                       add = FALSE) |>
  calculate_indices()

which outputs the following results:

#> # A tibble: 4 × 2
#>   index                        values
#>   <chr>                         <dbl>
#> 1 Government Response Index      57.2
#> 2 Containment and Health Index   52.9
#> 3 Stringency Index               44.0
#> 4 Economic Support Index         87.5