yh_logistic: Logistic Regression and Regularized Logistic Regression...

Description Usage Arguments Details Value Author(s) Examples

View source: R/yh_logistic.R

Description

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

Usage

1
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

Details

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

Value

vector with named values misclassificationRate, logloss, pcorr

Author(s)

A. I. McLeod

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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)

gencve documentation built on May 29, 2017, 7:12 p.m.