OHDSI Home | Forums | Wiki | Github

CohortMethod user group

(Martijn Schuemie) #21

We just released CohortMethod v3.0.0!

The changes, as already discussed in the population-level estimation workgroup, are the following:

  1. Adding inverse probability weighting: see inversePtWeighting argument in the fitOutcomeModel function. This is also described in the single studies vignette.

  2. Adding interaction terms: see interactionCovariateIds argument in the fitOutcomeModel function. This is also described in the single studies vignette.

  3. Adding summary statistics to plots: see show... arguments in the plotPs and plotCovariateBalanceScatterPlot functions.

  4. Enforcing consistency in language: for example, createDrugComparatorOutcome has become createTargetComparatorOutcome. There are many small changes, and unfortunately it probably means your old code won’t work anymore.

  5. Relative instead of absolute paths: the result of runCmAnalyses used to have absolute paths to the various files. Now these are relative to whatever was the outputFolder. Note that the summarizeAnalyses function now requires the outputFolder as argument.

  6. Compression of intermediate results: see compress argument in the saveCohortMethodData function and the compressCohortMethodData argument in the runCmAnalyses function.

In addition, there are many improvements in speed that will likely only matter if you run millions of analyses (which few people seem to do).

If you still require the old version of CohortMethod, please run:

devtools::install_github("ohdsi/CohortMethod", ref = "v2.6.2")

I’ve also updated the population-level estimation study package skeleton to be compatible with CohortMethod v3.0.0. Another new feature of this skeleton is that it exports to a well-defined data model.

(Seng Chan You) #22

Thank you for great work, @schuemie I’ll make the Cohort Study with the new skeleton package. Thank you again!

(Martijn Schuemie) #23

Just a heads up that a late minute change introduced an annoying bug in v3.0.0 (stratified population files were not being generated.). Please use v3.0.1 instead.

(Jungeun Park) #24

I feel like I’m the only one having trouble of installing v3.0.1.I’ve tried many different ways, but none of those worked out. Am I supposed to get rid of the old version first? I’m trying to installing it in the server that’s not connected to internet. Could it be the reason of the error?

the error message says:
cannot open compressed file ‘CohortMethod/DESCRIPTION’, probable reason ‘No such file or directory’
Error in install.packages : cannot open the connection.

by the way, I used the code
install.packages() with the option repos=NULL, type=“binary”

Any help or comment would be appreciated. Thank you.

(Martijn Schuemie) #25

The correct way to install the package is:


Could your try that?

(Jungeun Park) #26

Thank you very much for your reply.
I tried those codes and it had another issue.

Error in curl::curl_fetch_memory(url, handle = h) :
Failed to connect to api.github.com port 80: Timed out

(Martijn Schuemie) #27

That looks like a network problem when connecting to Github. Could you try again? Maybe your institute’s firewall is blocking the connection?

(Ajit Londhe) #28

Maybe it’s trying to get to port 80 (unsecured) when github (I think) only uses SSL port 443?

(Jungeun Park) #30

If that is the case, is there any solution for this problem? I haven’t solved it yet!

(Seng Chan You) #31

What about downloading the whole github repository of CohortMethod, and then installing the library by using local github repo?

git clone https://github.com/OHDSI/CohortMethod.git

(Jungeun Park) #32

Thank you for your reply! Actually I’ve tried that, but had another issue. ’

Below is the code I used to install CohortMethod.

and I could see “CohortMethod-master” folder(not .zip) newly created,
but when I tried to load package by running library(CohortMethod), (I’ve also tried “CohortMethod-master”)
it didn’t really work.
there is no package called ‘CohortMethod'

I think I’m missing something, but have no idea how I could fix this.

Thank you very much.

(Seng Chan You) #33

Could you try to clone the git repo to local repo of yours (using ‘git clone’ in command) and then launch the .Rproj object in that repo? Then, click the ‘build and reinstall’ button in the RStudio. I think this would be the easiest way.

(Martijn Schuemie) #34

I think @SCYou’s approach would indeed be easiest. Alternatively, you can download the source package here.

(Jungeun Park) #35

Thank you very much for your help!!

  • Please let me know if anyone’s used rohit43/DiabetesTxPath Package!

(Jungeun Park) #36

I have a question. (with CohortMethod 2.6.4)

I am running R code for population-level estimation, which Atlas gives automatically.

Everytime I do propensity score matching, the data slightly changes. but what if I want to have the exactly same matching? Is there any argument that makes it possible? I walked through the CohortMethod.pdf but couldn’t find any solutions.
(Is it saving the data of matched target to comparator persons would be the only way to see the ouput of that anlaysis? Is there any way I could replicate the match?)

Thank you for your support.

(Seng Chan You) #37


  1. please use set.seed before execute the cohortmethod function to replicate the exactly same result.

  2. And use readRDS to use RDS in R

Good luck!

(Jungeun Park) #38

Thank you again!

and I have one more question.
I am looking at the readRDS, but I don’t see the data of the data of matched target to comparator persons(the output of the matchOnPs()). Is it not saved automatically as .rds, or am I doing something wrong?

(Seng Chan You) #39

@JUNGEUN_PARK please look at 'StratPop~~.rds" (for matched patients). The 'strudyPop~~.rds" contains the information for unmatched cohort.

(Jungeun Park) #40

I wonder if I could ask help about executing DiabetesTxPath package.

Wihle running runCompleteStudy(), I had an error in the picture attached.

What could be the reason of this error, and what could I do to fix it?

Thank you.

(Martijn Schuemie) #41

Hi @JUNGEUN_PARK. The next step (the one that fails) is a call to FeatureExtraction. Most likely the DiabetesTxPath study requires a different version of the FeatureExtraction package than you’re running. I don’t see a mention of which version you should use. @rohitv: do you know?