causal-curve icon indicating copy to clipboard operation
causal-curve copied to clipboard

External vector of GPS

Open athammad opened this issue 3 years ago • 4 comments

Hi guys,

It seems to me that the GPS is calculated internally. What if I have a vector with the GPS (calculated using my own code) and I would like to "plug it" into the model to estimate the DRF?

Thank you very much.

athammad avatar Nov 26 '21 07:11 athammad

Hi @athammad ! You are correct, it is calculated internally, but I believe you should be able to substitute in your estimates of GPS values here: https://github.com/ronikobrosly/causal-curve/blob/bb9dab9362bbf88aef42967d023ed9ceee3672fd/causal_curve/gps_core.py#L462

That is, after you run the ‘fit’ function you can do something like this

‘gps.gps_at_grid = [your array of your own GPS values at the treatment grid points]’

… and then you can calculate the CDRC as usual. Does that make sense?

ronikobrosly avatar Nov 26 '21 14:11 ronikobrosly

HI @ronikobrosly! Thank you for getting back to me. What do you mean by "GPS values at the treatment grid points"? I have a vector with the calculated GPS for every observation in my Dataframe. Are you suggesting that I should recalculate the GPS with a multinomial regression after creating a quantile-based grid across the values of the treatment equivalent to the one I would have to select in GPS_Regressor(treatment_grid_num = 100)?

Best wishes

athammad avatar Nov 28 '21 10:11 athammad

Thinking about this a bit more, I think there is a simpler approach here that will save you time @athammad . If you already have an estimate of the GPS for each observation, then you really dont even need this package: you can estimate the CDRC directly using the treatment values, GPS values, and outcome values. See the methods section of this paper for more details: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5969262/

Specifically the section “ 2.3. Estimation of the dose‐response function using the GPS”.

ronikobrosly avatar Nov 28 '21 22:11 ronikobrosly

Probably easier than adapting the package to fit your GPS, if that makes sense

ronikobrosly avatar Nov 28 '21 22:11 ronikobrosly