ncvsurv(X, y, model=c("cox","aft"), penalty=c("MCP", "SCAD", "lasso"),
gamma=switch(penalty, SCAD=3.7, 3), alpha=1,
lambda.min=ifelse(n>p,.001,.05), nlambda=100, lambda, eps=.001,
max.iter=1000, convex=TRUE, dfmax=p, penalty.factor=rep(1, ncol(X)),
warn=TRUE, returnX=FALSE, ...)
ncvsurv
standardizes the data prior to fitting.Surv
object. The first column should be time on study (follow
up time); the second column should be a binary variable with 1
indicating that the event has occurred and 0 indicancvreg
.alpha=1
is equivalent to MCP/SCAD penalty,
while alpha=0
would be equivalent tnlambda
is computed, equally
spaced on the log scale.eps
. Default
is .001
.penalty.factor
must be a
numeric vector of length equal to the number of columns of
X
. The purpose of penalty.factor
is "ncvsurv"
containing:nlambda
.nlambda
containing the number
of iterations until convergence at each value of lambda
.lambda[convex.min]
,
with corresponding coefficients beta[,convex.min]
.lambda
.W
does
not correspond to the ith row of X
):exp(beta)
values for each subject over all
lambda
values.lambda
is fit using a coordinate descent algorithm. In order
to accomplish this, the second derivative (Hessian) of the Cox partial
log-likelihood is diagonalized (see references for details). The
objective function is defined to be
$$-\frac{1}{n}L(\beta|X,y) + \textrm{penalty},$$
where L is the partial log-likelihood from the Cox regression
model. Presently, ties are not handled by ncvsurv
in a particularly
sophisticated manner. This will be improved upon in a future release
of ncvreg
.
Adaptive rescaling (see references) is used for MCP and SCAD models.
The convexity diagnostics rely on a fine covering of (lambda.min,
lambda.max); choosing a low value of nlambda
may produce
unreliable results.
plot.ncvreg
, cv.ncvsurv
data(Lung)
X <- Lung$X
y <- Lung$y
par(mfrow=c(2,2))
fit <- ncvsurv(X, y)
plot(fit, main=expression(paste(gamma,"=",3)))
fit <- ncvsurv(X, y, gamma=10)
plot(fit, main=expression(paste(gamma,"=",10)))
fit <- ncvsurv(X, y, gamma=1.5)
plot(fit, main=expression(paste(gamma,"=",1.5)))
fit <- ncvsurv(X, y, penalty="SCAD")
plot(fit, main=expression(paste("SCAD, ",gamma,"=",3)))
fit <- ncvsurv(X,y)
ll <- log(fit$lambda)
par(mfrow=c(2,1))
plot(ll, BIC(fit), type="l", xlim=rev(range(ll)))
lam <- fit$lambda[which.min(BIC(fit))]
b <- coef(fit, lambda=lam)
b[b!=0]
plot(fit)
abline(v=lam)
S <- predict(fit, X, type='survival', lambda=lam)
par(mfrow=c(1,1))
plot(S, xlim=c(0,200))
Run the code above in your browser using DataLab