ronikobrosly/causal-curve

External vector of GPS

athammad opened this issue · 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.

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:

self.gps_at_grid = self._gps_values_at_grid()

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?

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

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”.

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