Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supplying user-created weights to adjustedcif with method=iptw? #20

Open
cegepi opened this issue Jan 11, 2024 · 3 comments
Open

Supplying user-created weights to adjustedcif with method=iptw? #20

cegepi opened this issue Jan 11, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@cegepi
Copy link

cegepi commented Jan 11, 2024

Thank you for your terrific work with this package; it is incredibly helpful and thorough! Was delighted when I found this package.

My question pertains to the adjustedcif function when one is using method=iptw. Is there any way to pass a vector of weights instead of a model to the treatment_model argument? This would be similar to the functionality offered by method=iptw for the adjustedsurv function. Asking because it would be great to estimate weights outside of the package and then just supply the user-created weights to the treatment_model argument of adjustedcif.

Reasons for wanting to externally generate weights: ability to try different packages for weight creation (WeightIt versus PSWeight), trim weights, assess covariate balance, etc.

@RobinDenz1
Copy link
Owner

RobinDenz1 commented Jan 11, 2024

Thanks for the kind words.

In the current version I rely on the ate function of the riskRegression package to get the estimates when using method="iptw" in the adjustedcif function, because I don't know any nice formula for its' variance that I could implement myself without reinventing the wheel. That function sadly does not support direct input of weights.

However, you can use method="iptw_pseudo", which is almost the same thing (but relies on pseudo-values). When you use that method instead you can easily supply weights directly or use the built in support for WeightIt in the same way you could with the adjustedsurv function. If you do that though, make sure to install the github version (devtools::install_github("RobinDenz1/adjustedCurves")) and to use both iso_reg=TRUE and force_bounds=TRUE.

Hope this helps!

@cegepi
Copy link
Author

cegepi commented Jan 11, 2024

I appreciate the fast and helpful reply, that makes sense! In prior work I have bootstrapped to get 95% CIs for parameters from a IPT-weighted Aalen-Johansen estimator to get around the "no nice formula for its variance" issue. But I was excited when I saw that the adjustedcif function could provide the CIs without bootstrapping (I am using multiple imputation and combining it with bootstrapping is computationally intensive). The weights from method=iptw would potentially even be the same as my user-defined weights, I just wanted a way to report balance metrics. Just an idea--I'm sure it would be quite a bit of work--but an option to output SMD values would be awesome (and average SMDs if using a multiple impution mids object). Think this would involve integration with the cobalt package. Cheers again on the great contribution!

@RobinDenz1
Copy link
Owner

No problem! And thank you for the suggestion.

I thought about implementing stuff like balance metrics etc. when I first built this package and ultimately decided against it for the following reasons:

1.) Large packages are hard to maintain. This package is very large already (and is going to get larger with each method that I can find and implement). So I try to focus on the most important part, which is estimation methods + visualization tools.
2.) There are specialiced packages such as the cobalt package which do a much better job if used separately.

That being said, maybe it would be a good idea to write some functions for the cobalt package which implement direct support for adjustedsurv and adjustedcif objects (if fitted with methods based on weighting). Most of the required information is contained in the output of the objects anyways so there is no reason this couldn't be done. Noah Greifer (the author of WeightIt and cobalt) has publicly recommended adjustedCurves so maybe if I contact him we can arrange something.

Might be a while till I get to it, but I will keep this issue open for now. If you want to participate directly you are of course highly welcome to do so.

@RobinDenz1 RobinDenz1 self-assigned this Jan 12, 2024
@RobinDenz1 RobinDenz1 added the enhancement New feature or request label Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants