Learn R Programming

gencve (version 0.3)

yh_logistic: Logistic Regression and Regularized Logistic Regression Prediction

Description

The training data is fit and then the mis-classifcation rate for the test data is computed.

Usage

yh_logistic(dfTr, dfTe, alpha = NULL)

Arguments

dfTr
Training data frame, last column factor response and other columns are numeric inputs.
dfTe
Test data frame, columns same variables as in training data frame
alpha
alpha=1 for LASSO, alpha=0.5 for half-mixture, alpha=0 for ridge regression

Value

vector with named values misclassificationRate, logloss, pcorr

Details

alpha=0.02 often is numerically better behaved than alpha=0

Examples

Run this code
z <- kyphosis[,c(2:4,1)]
set.seed(37771)
i <- sample(1:81, size=7, replace=TRUE)
dfTe <- z[i,]
i <- setdiff(1:81, i)
dfTr <- z[i,]
yh_logistic(dfTr, dfTe)
yh_logistic(dfTr, dfTe, alpha=1)
## Not run: #cross-validation, takes a few minutes
# X <- kyphosis[,3:4]
# y <- kyphosis[,4]
# cgcv(X, y, yh=yh_logistic, NCores=8)
# cgcv(X, y, yh=yh_logistic, NCores=8, alpha=1)
# cgcv(X, y, yh=yh_logistic, NCores=8, alpha=0.5)
# cgcv(X, y, yh=yh_logistic, NCores=8, alpha=0.02)
# #
# ## End(Not run)

Run the code above in your browser using DataLab