Skip to contents

Calculate an OxCGRT index or indices

Usage

calculate_index(df, codes, tolerance)

calculate_gov_response(df)

calculate_containment_health(df)

calculate_stringency(df)

calculate_economic_support(df)

calculate_indices(df)

Arguments

df

A data.frame produced by a call to calculate_subindices().

codes

A vector of policy type codes to use for the index calculation.

tolerance

An integer specifying the number of missing values above which index will not be calculated and reported.

Value

A numeric value for mean subindex scores of specified policy types. For calculate_indices(), a tibble calculated OxCGRT indices

Author

Ernest Guevarra based on calculation methods by Hale, Thomas, Noam Angrist, Emily Cameron-Blake, Laura Hallas, Beatriz Kira, Saptarshi Majumdar, Anna Petherick, Toby Phillips, Helen Tatlow, Samuel Webster (2020). Oxford COVID-19 Government Response Tracker, Blavatnik School of Government.

Examples

## Get policy actions data for Afghanistan on 1 September 2020
x <- get_data(json = get_json_actions(ccode = "AFG",
                                      from = NULL,
                                      to = "2020-09-01"))

## Calculate OxCGRT subindices
y <- calculate_subindices(df = x$policyActions)

## Calculate OxCGRT index
calculate_index(df = y,
                codes = c(paste("C", 1:8, sep = ""),
                          paste("E", 1:2, sep = ""),
                          paste("H", 1:3, sep = ""), "H6"),
                tolerance = 1)
#> [1] 33.33333

## Calculate OxCGRT government response index
calculate_gov_response(df = y)
#> [1] 35.41667

## Calculate OxCGRT containment and health index
calculate_containment_health(df = y)
#> [1] 40.47619

## Calculate OxCGRT stringency index
calculate_stringency(df = y)
#> [1] 28.7037

## Calculate OxCGRT economic support index
calculate_economic_support(df = y)
#> [1] 0

## Calculate all OxCGRT indices
calculate_indices(df = y)
#> # A tibble: 4 × 2
#>   index                        values
#>   <chr>                         <dbl>
#> 1 Government Response Index      35.4
#> 2 Containment and Health Index   40.5
#> 3 Stringency Index               28.7
#> 4 Economic Support Index          0