grpregOverlap icon indicating copy to clipboard operation
grpregOverlap copied to clipboard

cv.grpsurvOverlap

Open gunthergl opened this issue 5 years ago • 0 comments

Hi, when trying to use cv.grpsurvOverlap I get the following error:

Error in cv.grpsurv(X = fit$X.latent, y = y, group = fit$grp.vec, ...,  : 
argument "cv.ind" is missing, with no default

MWE:

library(grpreg)
X <- Lung$X
y <- survival::Surv(time = Lung$y[, 1], event = Lung$y[, 2])
group <- Lung$group

fit <- grpsurv(X, y, group)
# plot(fit)
fit <- cv.grpsurv(X, y, group)
# plot(fit)

library(grpregOverlap)

named.groups <- lapply(levels(group), function(x)colnames(X)[levels(group) == x])
names(named.groups) <- levels(group)

# I know there are no overlapping groups now, but that should not matter:
cv.fit <- cv.grpsurvOverlap(
	X = X
	,y = y
	,group = named.groups
	,penalty="gel"
	,trace = TRUE
	# ,cv.ind = 1
)

The previous cv.grpsurvOverlap now throws the mentioned error, as well as the following:

# Generating overlapping groups:
named.groups_overlapping <- named.groups
named.groups_overlapping$trt <- c(named.groups$trt, "age2")
cv.fit <- cv.grpsurvOverlap(
	X = X
	,y = y
	,group = named.groups_overlapping
	,penalty="gel"
	,trace = TRUE
	# ,cv.ind = 1
)

I found that cv.grpsurvOverlap.R calls cv.grpsurv with cv.ind=cv.ind but cv.grpsurv's code does not seem to use it?

I must have missed something somewhere because if cv.ind was not used at all the error would not even occur.

Maybe a second issue; But defining cv.ind with any value seems to solve the problem and does not change anything in the cv folds.

Could you please take a look?

Best regards

gunthergl avatar Sep 02 '19 11:09 gunthergl