alexpkeil1 / qgcomp

QGcomp (quantile g-computation): estimating the effects of exposure mixtures. Works for continuous, binary, and right-censored survival outcomes. Flexible, unconstrained, fast and guided by modern causal inference principles
27 stars 6 forks source link

Obtaining hazards ratio confidence intervals as a function of exposure #27

Closed sethfrnd closed 1 year ago

sethfrnd commented 1 year ago

I apologize, but I'm a little confused following the introduction posted for qgcomp.

When estimating the hazard function using qgcomp.cox.boot you explain you can obtain the hazard ratios as a function of overall exposure:

examining the overall hazard ratio as a function of overall exposure hrs_q = exp(matrix(c(0,0,1,1,2,4,3,9), ncol=2, byrow=TRUE)%*%qc.survfit4$msmfit$coefficients) colnames(hrs_q) = "Hazard ratio" print("Hazard ratios by quartiles (min-25%,25-50%, 50-75%, 75%-max)")

However, it doesn't seem that you can easily obtain the confidence intervals of these hazards ratios? I'm probably missing something.

alexpkeil1 commented 1 year ago

There's no extra information in the HRs that isn't there in the psi values, so it's typically done as a visual aid for model fit, rather than for testing or precision purposes.

The variance of the hazard ratio can be obtained via the bootstrap covariance matrix at qc.survfit4$covmat.psi. That would be the same as any computation with any model coefficient covariance matrix, which you should be able to track down somewhere looking for variances of linear combinations of random variables in examples with a quadratic model: y ~ b0 + b1x + b2x^2, where the variance calculation is based on b1, b2, x, x^2 and the covariance matrix of b1,b2 (psi1, psi2 in this circumstance). That's not implemented in the package itself for this particular circumstance, but there should be examples that aren't too difficult to find.

sethfrnd commented 1 year ago

Thank you for your kind and quick response. This seemed so intuitive!

Could you help me understand the meaning of the p-value for psi? (I do dislike p-values but some live and die by them). Is this a p-for-trend where it represents an omnibus test across all quantiles of the mixture? Or is this a p-value for psi at a referent quantile so that if we could set poinwiseref to a different quantile we would get a different p-value and confidence intervals?

alexpkeil1 commented 1 year ago

It's a p-value for the slope (or polynomial parameter), so there is no implied reference quartile for the p-value. It's the same interpretation as a slope parameter for a continuous independent variable in any linear/generalized linear model.

On Tue, Nov 1, 2022 at 5:06 AM sethfrnd @.***> wrote:

Thank you for your kind and quick response. This seemed so intuitive!

Could you help me understand the meaning of the p-value for psi? (I do dislike p-values but some live and die by them). Is this a p-for-trend where it represents an omnibus test across all quantiles of the mixture? Or is this a p-value for psi at a referent quantile so that if we could set poinwiseref to a different quantile we would get a different p-value and confidence intervals?

— Reply to this email directly, view it on GitHub https://github.com/alexpkeil1/qgcomp/issues/27#issuecomment-1298240210, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLC2W6KXZDBH3FOTEK7QLDWGDMPPANCNFSM6AAAAAAROLEM7A . You are receiving this because you modified the open/close state.Message ID: @.***>