Closed Xintong-Li-ZnCu closed 2 years ago
Could you provide the analysis settings you're using? Especially your calls to createEraCovariateSettings()
.
please see below.
createStudyPopulationArgs1 <- SelfControlledCaseSeries::createCreateStudyPopulationArgs( firstOutcomeOnly = TRUE)
covarVax <- createEraCovariateSettings(label = "post-vaccine 21d",
startAnchor = "era start" ,
start = 1,
end = 21,
endAnchor = "era start",
splitPoints = c(7,14))
sameday <- createEraCovariateSettings(label = "vaccine 0",
# includeEraIds = VaxAZ,
startAnchor = "era start" ,
start = 0,
end = 0,
endAnchor = "era start")
covarPreVax <- createEraCovariateSettings(label = "Pre-exposure 21d",
startAnchor = "era start" ,
start = -21,
end = -1,
endAnchor = "era start")
createSccsIntervalDataArgs1 <- createCreateSccsIntervalDataArgs(
eraCovariateSettings = list(sameday,
covarVax,
covarPreVax))
fitSccsModelArgs <- createFitSccsModelArgs(control = createControl(threads = parallel::detectCores()-1))
sccsAnalysis1 <- createSccsAnalysis(analysisId = 1,
description = "Simplest model",
getDbSccsDataArgs = getDbSccsDataArgs1,
createStudyPopulationArgs = createStudyPopulationArgs1,
createSccsIntervalDataArgs = createSccsIntervalDataArgs1,
fitSccsModelArgs = fitSccsModelArgs)
Ah, yes, I know this is a bit counterintuitive, but you need to tell the package which exposures to use for which 'era covariate'. Right now, no exposures are specified, and the default is to use all exposures found in the data.
Since you're using the era covariate settings in runAnalyses
, you can't provide the actual exposure ID (because it will be different for each exposure-outcome combination), so you have to point to the variable containing the exposure ID. (See this part of the vignette). For example, for covarVax
, you'd need to change the code to:
covarVax <- createEraCovariateSettings(label = "post-vaccine 21d",
includeEraIds = "exposureId",
startAnchor = "era start" ,
start = 1,
end = 21,
endAnchor = "era start",
splitPoints = c(7,14))
(Note the includeEraIds
argument)
The reason for this complicated way of working is because it allows you to include different types of exposures into a single model (e.g. you could have separate covariates for the first and second dose of a vaccine, if you have separate cohorts for those two exposures). See for example this code in Eumaeus, together with this code)
Thank you so much! It worked ;)
When I ran
runSccsAnalyses
with a exposureOutcomeList, the outcome models included all exposure cohorts into one model, though I have only one exposure and one outcome id in each e/o pair.I don't get why there is
Exposure cohort 2
as I only want to study single e/o id.