Description Usage Arguments Details Value Examples
View source: R/fitting_function.R
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.
1 2 3 |
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≤ |
true.prob |
The prevalence parameter, should be provided by users. Can be tuned in the cross-validation function. |
beta_start |
A user supplied starting coefficients vector. |
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. |
XtX.input |
If gram.input is TRUE, users should supply the corresponding gram matrix X'X. |
ytx.input |
If gram.input is TRUE, users should supply the product of y'X. |
XtX_reduce.input |
If gram.input is TRUE, users should supply a matrix of X'X without the diagnol entries. |
The function fits a presence-only model with an elastic net penalty.
beta
The fitting vector of the coefficients, the intercept is included.
1 2 3 4 5 6 7 8 9 | 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.beta<-PO.EN(x_train,y_train,lambda=0.1,
true.prob=sum(y_train)/length(y_train),beta_start=rep(0,ncol(x_train)+1))
predictions<-PO.EN.predict(x_test,PO.EN.beta)
pROC::roc(y_test~predictions)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.