lambda. The algorithm uses Fisher Scoring
with Coordinate Descent updates.ordinalNet(x, y, alpha = 1, standardize = TRUE, penalizeID = NULL,
positiveID = NULL, link = c("logit", "probit", "cloglog", "cauchit"),
lambdaVals = NULL, nLambda = 100, lambdaMinRatio = ifelse(nObs < nVar,
0.01, 1e-04), alphaMin = 0.01, trace = FALSE, epsOut = 0.001,
epsIn = 0.001, maxiterOut = Inf, maxiterIn = Inf, pMin = 1e-20,
betaMin = 1e-08, convNorm = Inf, zetaStart = NULL, thetaStart = NULL)alpha=1 is the lasso penalty, and alpha=0 is the ridge penalty.
See "Details".standardize=TRUE, the predictor variables are
scaled to have unit variance. Coefficient estimates are returned on the
original scale.lambda sequence based on nLambda
and lambdaMinRatio.lambda values in the solution path.
Default is 100.lambda as a fraction of the maximum
lambda. (The maximum lambda is the smallest value that sets all penalized
coefficients to zero.)alpha < alphaMin, then alphaMin is used
to calculate the maximum lambda value.trace=TRUE the algorithm progress is printed to the terminal.lambda values as the coefficient estimates diverge to $+/-\infty$.betaMin, it is
set to zero. This improves the stability and speed of the fitting algorithm.epsIn or epsOut). The elastic net penalty is defined as $$\lambda{(1-\alpha)/2||\beta||_2^2+\alpha||\beta||_1}.$$
The objective function is $$-1/N*loglik + penalty.$$
set.seed(10)
x <- matrix(rnorm(50*5), ncol=5)
beta <- c(1, 0, 0, 0, 0)
intercepts <- c(-1, 1)
xb <- x %*% beta
eta <- cbind(xb+intercepts[1], xb+intercepts[2])
probMatCumul <- 1 / (1 + exp(-eta))
probMat <- cbind(probMatCumul, 1) - cbind(0, probMatCumul)
y <- apply(probMat, 1, function(p) sample(1:3, size=1, prob=p))
y <- as.factor(y)
fit <- ordinalNet(x, y)
print(fit)
coef(fit)
predict(fit, type="class")
predict(fit, type="prob")Run the code above in your browser using DataLab