Here, you will find data necessary to recreate the figures and tables of the main manuscript about the association between the recombinant shingles vaccine and dementia.
### Code ###
The code used to produce Kaplan-Meier plots, calculate time-varying hazard ratios, calculate ratios of RMTL, perform parametric and bootstrap testing, and align follow-up horizons can be found in `OSF_Code.R`.
It is commented and hopefully therefore easily understandable. But please feel free to reach out to the corresponding author for any question.
The script can be executed using as input the life table from the coarsened exact matching (as described in the last section below).
----------
### Data from propensity score matching ###
Each RDS file contains an R object that contains the results for the comparison between two cohorts:
**OSF_ShinglesVaccine_Dementia_Primary.rds** contains the results for the primary analysis (comparison between those vaccinated after and those vaccinated before the uptake of the recombinant vaccine).
**OSF_ShinglesVaccine_Dementia_AdjustedForSocialDeprivation.rds** contains the results for the comparison adjusted for social deprivation.
**OSF_ShinglesVaccine_Dementia_ExcludingCrossingOver.rds** contains the results for the robustness analysis in which people who received both vaccines were excluded.
**OSF_ShinglesVaccine_Dementia_PredominantVaccine.rds** contains the results for the robustness analysis in which only those who received the predominant vaccine (i.e. the recombinant vaccine after October 2017 and the live vaccine before October 2017) were included.
**OSF_ShinglesVaccine_Dementia_RestrictedExposureWindow.rds** contains the results for the robustness analysis in which the exposure window was restricted to 6 months on either side of October 2017.
**OSF_ShinglesVaccine_Dementia_Females.rds** containes the results in females.
**OSF_ShinglesVaccine_Dementia_Males.rds** containes the results in males.
**OSF_ShinglesVaccine_Dementia_RecombinantVsFluVaccine.rds** contains the results for the comparison between the recombinant shingles vaccine and the flu vaccine.
**OSF_ShinglesVaccine_Dementia_RecombinantVsTdapVaccine.rds** contains the results for the comparison between the recombinant shingles vaccine and the Tdap vaccine.
**OSF_ShinglesVaccine_Dementia_LiveVsFluVaccine.rds** contains the results for the comparison between the live shingles vaccine and the flu vaccine.
**OSF_ShinglesVaccine_Dementia_LiveVsTdapVaccine.rds** contains the results for the comparison between the live shingles vaccine and the flu vaccine.
Once loaded, the variable contains a list with the following fields:
`outcomeNames`: a vector of outcome names. In many cases, only one outcome is present (dementia) but in the primary analysis and in the comparisons stratified by sex, multiple outcomes are present. This allows to then navigate the outcomes (e.g. in the primary analysis, dementia is the firs outcome, Alzheimer's is the second, etc).
`outcomes`: a list of the same length as `outcomeNames` which contains the results for each outcome (i.e. it is a list of lists). For instance, `outcomes[[1]]` contains the results for dementia. Each outcome contains the following fields:
- `RMST`: the results in terms of restricted mean time lost (including the ratio of RMTL in `RMST$rRMTL` and its confidence interval in `RMST$rRMTL.ci` and the p-value in `RMST$p`).
- `HRt` (when it was calculated): containing the time-varying hazard ratio (HR) including the value of the HR over time (`HRt$value`), the time axis (`HRt$time`), and the confidence interval (`HRt$CI.low` and `HRt$CI.high`).
- `KM`: a list that contains the data for the Kaplan-Meier curves and its confidence interval
- `propHazardTest` the results of the test of the proportional hazard assumption (showing in most cases that it is violated, hence the use of the RMTL and time-varying HR rather than a constant HR).
`cohort1`: the name of the first cohort
`cohort2`: the name of the second cohort
As an illustration, the following lines of code would plot the KM curves for dementia (outcome #1) for the comparison in the primary analysis (corresponding to Figure 1B of the manuscript without the 95% CI and without the style):
`res=readRDS('OSF_ShinglesVaccine_Dementia_Primary.rds')`
`plot(res$outcomes[[1]]$KM$time,1-res$outcomes[[1]]$KM$values2,type='l')`
`lines(res$outcomes[[1]]$KM$time,1-res$outcomes[[1]]$KM$values1,lty=2)`
Note that the KM values are stored as survival probability (hence the need to calculate 1-value to get the incidence as in Fig. 1).
----------
### Data from coarsened exact matching ###
The life table from the coarsened exact matching approach is available as `cem_data.rds`. These data can be used as input to the script to illustrate the use of the code to calculate the time-varying hazard ratio, the ratio of RMTL and the statistical tests.