OHDSI Home | Forums | Wiki | Github

How to fit outcome model with only specified covariates using CohortMethod package?

Hi all,

I need to fit outcome model using only specified covariates, different from covariates that were used for propensity matching.

In my case, I need just two covariates in the outcome model as age and gender. What is the best way to do it using existing CohortMethod API?

Current prototype looks as following

createFitOutcomeModelArgs <- function(modelType = “logistic”,
stratified = FALSE,
useCovariates = FALSE,
inversePsWeighting = FALSE,
excludeCovariateIds = c(),
includeCovariateIds = c(),
prior = createPrior(“laplace”, useCrossValidation = TRUE),
control = createControl(cvType = “auto”,
startingVariance = 0.01,
tolerance = 2e-07,
cvRepetitions = 10,
noiseLevel = “quiet”))

It looks that the only available option is to specify separate concept set via includeCovariateIds?

BR,

Yuriy

Hi @YuriK ,

Yes, just specify the two covariate IDs in includeCovariateIds. This assumes that the covariates were constructed when calling getDbCohortMethodData (in other words, they were implied in your covariateSettings). Note that you need to specify covariate IDs, which are not the same as concept IDs.

1 Like

Hi @schuemie,

I got it, thank you.

There is one thing, that still remains unclear for me. I’m using runCmAnalyses function, which takes includeCovariateIds as an input parameter (not directly, but via function createFitOutcomeModelArg ). getDbCohortMethodData is called within runCmAnalyses. So, in fact, I have to specify includeCovariateIds before the covariates were constructed?

Is there any other way to specify includeCovariateIds for outcome mode using runCmAnalyses? If not it looks as I have to run getDbCohortMethodData separately, then get ids for age and gender and hardcode them into runCmAnalyses.

BR,

Yuriy

Yes, runCmAnalysis requires you to prespecify everything, and only then executes the entire set of analyses. Note that the covariate IDs are deterministic, designed to be identical for every run on every platform. Most covariate IDs are simply concept ID * 1000 + analysis ID. So for example, analysis ID 101 indicates conditions observed any time prior.The covariate ID for concept 254761 (‘Cough’) observed any time prior is therefore 254761101.

Some covariates are not based on specific concepts (e.g. age), and some are more complex (e.g. when combining a measurement concept with a unit concept), but the principle remains: the covariateID will always be the same.

Thanks,

@schuemie everything is pretty clear now.

BR,

Yuriy

t