Skip to content

Robust standard errors? #208

@jalavery

Description

@jalavery

Thanks for all of your work on this great package! I am trying to apply a weighted survreg model using flexsurvreg, but am noticing that the naive SE is returned with flexsurvreg as opposed to the robust SE from survreg. Is it possible to obtain the robust standard errors when weights are applied to a flexsurvreg object? Reprex below to demonstrate the comparison of the SE. Thank you!

library(flexsurv)
library(gtsummary)
library(tidyverse)

# use trial dataset as an example
head(trial)

# define manual weights, constant across all observations
trial2 <- trial %>% 
  mutate(trt_numeric = as.numeric(trt == "Drug A"),
         manual_weight5 = 5,
         record_id = 1:n()) %>% 
  drop_na()

# try weight of 5 with survreg: (robust) SE and naive SE returned
survreg(Surv(ttdeath, death) ~ trt + stage,
        dist = "lognormal",
        data = trial2,
        weights = manual_weight5,
        robust = TRUE) %>% summary()

# repeat w/ flexsurvreg: only naive SE returned
flexsurvreg(Surv(ttdeath, death) ~ trt + stage,
            dist = "lognormal",
            data = trial2,
            weights = manual_weight5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions