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

Use of weights with cox() family #1642

Open
cccnrc opened this issue Apr 8, 2024 · 0 comments
Open

Use of weights with cox() family #1642

cccnrc opened this issue Apr 8, 2024 · 0 comments
Labels
Milestone

Comments

@cccnrc
Copy link

cccnrc commented Apr 8, 2024

I already started a topic on stackoverflow: Using IPTW weights inside a Bayesian brm() cox model

I can create a Bayesian coxph model with brms:

library(brms)

### use brms package dataframe
data("kidney")

### create random propensity scores to simulate the database
kidney$sw <- runif( nrow(kidney), min=0.5, max=2.5 )

### create the brm model
model <- brms::brm(
  time | cens(censored) ~ sex,
  data = kidney,
  family = cox()
)

and everything works fine. I tried to implement weights but I cannot figure out the syntax:

model <- brms::brm(
  Surv( time, censored ) | weights(sw) ~ sex,
  data = kidney,
  family = cox()
)
Error in Ops.Surv(y, 0) : Invalid operation on a survival time

How can I specify weights if I am using a cox() syntax?

@paul-buerkner paul-buerkner added this to the brms 2.22.0 milestone Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants