OHDSI Home | Forums | Wiki | Github

Get mean(SD) age from the CohortMethod output

I’m constructing table 1 from my CohortMethod output and would like to change age group pre/post PS characteristics to simple mean(SD) age. I couldn’t find such a feature in my balance output (maybe because I used only age groups as my covariates). Is there any easy (or not that easy) way to extract this information?

You will need to construct a different feature for that using FeatureExtraction: useDemographicsAge = TRUE instead of useDemographicsAgeGroup = TRUE. Actually, you may want to use both, and exclude the continuous covariate from things like the propensity model, using the excludeCovariateIds argument of the createPs() function. (The covariate ID should be 2).

Assuming you’re using the default covariate settings, here’s an easy hack to add the additional covariate:

settings <- FeatureExtraction::createDefaultCovariateSettings(<whatever your settings are>)
settings$DemographicsAge <- TRUE

(Obviously, mean (SD) is not a very good way to characterize age, which is probably not normally distributed. But I’m assuming you’re trying to appease a random reviewer request :wink: )

Thanks a lot, Martijn! The thing is that I don’t want to rerun all analysis for that single number, so I was looking for a way to get it from the existing output. Or median(IQR), I haven’t gotten to the age distribution yet :slight_smile:

Well computing median (IQR) from the existing data would trivial if you’re ok with a resolution of 5-year bins :wink:

Alternatively, you could hack some SQL to compute the ages for everyone in the original target and comparator cohort, and use the cohortMethodData$cohorts object to link the person ID +cohort start date to the internal rowId, which will allow you to join it to the strataPop files. Then you could compute whatever you want.

t