Closed EQUIWDH closed 1 year ago
Sorry for disturbing, I am using the loss function structure provided by loss.R
which is
loss<- function(x,beta,y ,total=TRUE) {
eta = x%*%beta
ind <- order(y[,1])
d <- as.double(y[ind,2])
if (is.matrix(eta)) {
eta <- eta[ind, , drop=FALSE]
r <- apply(eta, 2, function(x) rev(cumsum(rev(exp(x)))))
} else {
eta <- eta[ind]
r <- rev(cumsum(rev(exp(eta))))
}
if (total) {
return(-2*(crossprod(d, eta) - crossprod(d, log(r))))
} else {
return(-2*(eta[d==1,] - log(r)[d==1,]))
}
}
compareloss(fit$X,fit$beta,train$y)
and fit$loss
, I find they don't correspond as the picture showing
Hello, I am wondering if
fit$loss
returned byncvsurv
represents only the cox -2*logL calculating by estImated $\beta$ or the -2logL + penalty form ,thanks!