Learn R Programming

SentimentAnalysis (version 1.3-4)

enetEstimation: Elastic net estimation

Description

Function estimates coefficients based on elastic net regularization.

Usage

enetEstimation(
  x,
  response,
  control = list(alpha = 0.5, s = "lambda.min", family = "gaussian", grouped = FALSE),
  ...
)

Value

Result is a list with coefficients, coefficient names and the model intercept.

Arguments

x

An object of type DocumentTermMatrix.

response

Response variable including the given gold standard.

control

(optional) A list of parameters defining the model as follows:

  • "alpha"Abstraction parameter for switching between LASSO and ridge regularization (with default alpha=0.5). Best option is to loop over this parameter and test different alternatives.

  • "s"Value of the parameter lambda at which the elastic net is evaluated. Default is s="lambda.1se" which takes the calculated minimum value for \(\lambda\) and then subtracts one standard error in order to avoid overfitting. This often results in a better performance than using the minimum value itself given by lambda="lambda.min".

  • "family"Distribution for response variable. Default is family="gaussian". For non-negative counts, use family="poisson". For binary variables family="binomial". See glmnet for further details.

  • "grouped" Determines whether grouped function is used (with default FALSE).

...

Additional parameters passed to function for glmnet.