When using the comp() function, I noticed a discrepancy in the variance between what I calculated (also verified with SAS) and what the comp() output displayed. Using the equation on variance here, I noticed that in the COV() source code, the variance was calculated not with the overall observed events, but with the observed events for only one treatment group. This would only be a problem if an event were observed in multiple groups at the same time - which is how I found it.
It's found in this line: res2 <- x[, (ncg / n) * (1 - (ncg / n)) * ((n - e) / (n - 1)) * e, by=list(t, cg)] where e is the number of events for that time and in that group.
When using the comp() function, I noticed a discrepancy in the variance between what I calculated (also verified with SAS) and what the comp() output displayed. Using the equation on variance here, I noticed that in the COV() source code, the variance was calculated not with the overall observed events, but with the observed events for only one treatment group. This would only be a problem if an event were observed in multiple groups at the same time - which is how I found it.
It's found in this line:
res2 <- x[, (ncg / n) * (1 - (ncg / n)) * ((n - e) / (n - 1)) * e, by=list(t, cg)]where e is the number of events for that time and in that group.