PO.EN: A robust presence-only model with Elastic Net penalty

View source: R/fitting_function.R

PO.ENR Documentation

A robust presence-only model with Elastic Net penalty

Description

Fit a logistic regression with presence-only response via penalized maximum likelihood. The regularization path is computed for the elastic-net penalty at a pair values of lambda and the prevalence parameter.

Usage

PO.EN(x,y,o.iter=5, i.iter=5, lambda=.01,alpha=.5,
true.prob=0.5,beta_start,epsilon=1e-4, gram.input=F,XtX.input=0,
ytx.input=0,XtX_reduce.input)

Arguments

x

Input design matrix. Should not include the intercept vector.

y

Response variable. Should be a binary vector, such that 0 represents background observations and 1 represents presence observations.

o.iter

Number of outer loop iteration.

i.iter

Number of inner loop iteration.

lambda

A user supplied Elastic Net penalty parameter.

alpha

The elastic net mixing parameter, where 0≤alpha≤ 1.

true.prob

The prevalence parameter, should be provided by users. Can be tuned in the cross-validation function.

epsilon

The threshold for stopping the coordinate descent algorithm.

gram.input

The function allows users to feed the gram matrix for fasting computation. The default setting is False, and the function compute the gram matrix for computation.

Details

The function fits a presence-only model with an elastic net penalty.

Value

beta The fitting vector of the coefficients, the intercept included.

Examples

data(example.data) # example datasets, including training dataset and testing dataset
train_data<-example.data$train.data
y_train=train_data$response;x_train=train_data[,-1]  # response and design matrix of training data
test_data<-example.data$test.data
y_test=test_data$response;x_test=test_data[,-1]  # response and design matrix of testing data
PO.EN.cv<-cv.PO.EN(x_train,y_train,input.pi=seq(0.01,0.4,length.out=10))
PO.EN.beta<-PO.EN(x_train,y_train,lambda=PO.EN.cv$lambda.min,
           true.prob=PO.EN.cv$pi,beta_start=rep(0,ncol(x_train)+1))
predictions<-PO.EN.predict(x_test,PO.EN.beta)
roc(y_test~predictions)

Iuliana-Ionita-Laza/PO.EN documentation built on April 19, 2022, 7:10 a.m.