baseGLMnet {BioMM} | R Documentation

## Prediction by generalized linear regression models

### Description

Prediction by generalized regression models with lasso or elastic net regularization.

### Usage

    baseGLMnet(
      trainData,
      testData,
      predMode = c("classification", "probability", "regression"),
      paramlist = list(family = "binomial", alpha = 0.5, typeMeasure = "mse", typePred =
        "class")
    )

### Arguments

`trainData` | The input training dataset. The first column is named the 'label'.
`testData` | The input test dataset. The first column is named the 'label'.
`predMode` | The prediction mode. Available options are c('classification', 'probability', 'regression').
`paramlist` | A set of model parameters defined in an R list object. The valid option: list(family, alpha, typeMeasure, typePred). 'family': Response type: 'gaussian','binomial','poisson', 'multinomial','cox','mgaussian'. (Default: 'binomial') 'alpha': The elastic net mixing parameter, with 0<=alpha<= 1. 'typeMeasure': error metrics for internal cross-validation. 'mse' uses squared loss; 'deviance' uses actual deviance; 'mae' uses mean absolute error; 'class' gives misclassification error; 'auc' (for two-class logistic regression ONLY) gives area under the ROC curve. 'typePred': The type of prediction: 'response' and 'class'. (Default: 'class' for binary classification)

### Value

The predicted output for the test data.

### Author(s)

Junfang Chen

### Examples

    ## Load data
    methylfile <- system.file('extdata', 'methylData.rds', package='BioMM')
    methylData <- readRDS(methylfile)
    dataY <- methylData[,1]
    ## select a subset of genome-wide methylation data at random
    methylSub <- data.frame(label=dataY, methylData[,c(2:2001)])
    trainIndex <- sample(nrow(methylSub), 16)
    trainData = methylSub[trainIndex,]
    testData = methylSub[-trainIndex,]
    library(glmnet)
    ## classification
    predY <- baseGLMnet(trainData, testData,
                        predMode='classification',
                        paramlist=list(family='binomial', alpha=0.5,
                                       typeMeasure='mse', typePred='class'))
    testY <- testData[,1]
    accuracy <- classifiACC(dataY=testY, predY=predY)
    print(accuracy)

[Package BioMM version 1.6.0 Index]