Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions R/ridge.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# $Id: ridge.S 11166 2008-11-24 22:10:34Z therneau $
ridge <- function(..., theta, df=nvar/2, eps=.1, scale=TRUE) {
x <- cbind(...)
nvar <- ncol(x)
xname <- as.character(parse(text=substitute(cbind(...))))[-1]
vars <- apply(x, 2, function(z) var(z[!is.na(z)]))
class(x) <- 'coxph.penalty'

xvars <- cbind(data.frame( list(...) ))
names(xvars) <- as.character(parse(text=substitute(cbind(...))))[-1]
x <- model.matrix(~.,model.frame(~., data=xvars, na.action=na.pass))[,-1]
nvar <- ncol(x)
xname <- colnames(x)
vars <- apply(x, 2, function(z) var(z[!is.na(z)]))
class(x) <- 'coxph.penalty'

if (!missing(theta) && !missing(df))
stop("Only one of df or theta can be specified")
Expand Down