3
$\begingroup$

I've been looking for layman-accessible information about implementing the generalised linear regression with a complementary log-log (cloglog) function as survival analysis in R, but couldn't find anything satisfactory.

A similar question has been asked here: link however, I'm still unsure how to use that function on data.

Another question was answered here: link but I don't understand 1) what the offset actually does and why we include it? 2) if this is what I'm looking for: they refer to it as logistic regression, which is not what I'm after. (I don't have enough reputation to comment on those posts).

The dataset I will be using contains information on the screening time and outcome for a diabetes complication, along with other covariates I would like to include (age, sex, etc.). Although it will contain information on multiple screening events, I assume the model should be supplied only with the last interval, outcome and covariates. Therefore my dataset should look similar to the icenReg's miceData.

How do I build a generalised linear regression model with a complementary log-log function to model survival (time to event) in R? And if possible, how do I extract and interpret the results?

Thanks in advance for your help!

$\endgroup$
1
  • 1
    $\begingroup$ The offset that troubles you is for a predictor that is forced to have a regression coefficient of exactly 1. An offset is used for example to correct for things that depend on the scale of observations, the durations of different time periods in the page you link. That doesn't seem at all necessary for your data. You should, however, include all observation periods for all individuals in your analysis, not just the final ones. The icenReg package might be more helpful depending on your data structure, but I've answered your specific question below. $\endgroup$
    – EdM
    Commented Aug 10, 2022 at 19:39

1 Answer 1

3
$\begingroup$

The discrete-time survival analysis you want to do is just a form of binomial regression. This page nicely outlines how to proceed. You put your data into a person-period format, with one row for each at-risk individual in each time period, as shown in this answer, with the time period specified in the row along with covariate values in place and the event indicator for the individual in that time period. This answer has helpful links to more reading.

The advantage of using the cloglog link instead of the default logit is that it's suitable for evaluating a proportional hazards model in discrete time ("interval-censored" data). See this page for details. Coefficients for covariates then have the usual interpretation as for log-hazards in Cox continuous-time models, and the baseline hazard is provided by the time-period-specific coefficients.

Once the data are formatted it's very straightforward. After you set up your regression formula in the generalized linear model, you just specify family=binomial(link="cloglog") instead of accepting the default logit link.

$\endgroup$
5
  • $\begingroup$ thanks for the answer, but it's still unclear to me how to shape the data, sorry! the link you put points to a question where the intervals seem to be the same for all, which is not the case for my data. Did you have something like this in mind? $\endgroup$
    – Wojty
    Commented Aug 15, 2022 at 15:35
  • $\begingroup$ {r} ID <- c(1,1,1,1,2,2,2,2,3,3,3) sex <- c(rep("F", 8), rep("M", 3)) screen_time_since_diagnosis <- c(48, 400, 760, 900, 20, 360, 800, 1400, 0, 400, 600) outcome <- c(0,0,0,1,0,0,0,0,0,0,1) diabetes <- as.data.frame(cbind(ID, sex, screen_time_since_diagnosis, outcome), stringsAsFactors = T) glm(outcome~ sex + screen_time_since_diagnosis, data = diabetes, family = binomial(link = "cloglog")) $\endgroup$
    – Wojty
    Commented Aug 15, 2022 at 15:35
  • $\begingroup$ If all individuals have different time intervals then a binomial regression will become unwieldy. Each individual would need separate rows for all observation times for all individuals while at risk. See the page linked from the second paragraph of the answer. A proportional hazards model with interval censoring, as provided for example by icenReg, will be more useful and have the same interpretation of regression coefficients. $\endgroup$
    – EdM
    Commented Aug 15, 2022 at 17:17
  • $\begingroup$ Isn't that exactly what my mock data is like? could you clarify what you mean by "useful" and why you think so? Is there a way to compare their model fit to be able to make an informed decision on which method is better? $\endgroup$
    – Wojty
    Commented Aug 22, 2022 at 13:55
  • $\begingroup$ @WojciechBanaś The way you formatted the data in your comment, the software has no way to know that ID1 and ID2 are both at risk at t=600 when ID3 has an event, and no way to know that ID2 is at risk at t=900 when ID1 has the event. For this type of model, for each individual in the cohort you need to add extra rows of data for all event times (for anyone in the cohort) when that individual is at risk. If observation times aren't synchronized, that becomes increasingly unwieldy as the size of the data set increases. $\endgroup$
    – EdM
    Commented Aug 23, 2022 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.