Learn R Programming

pre (version 0.3.0)

coef.gpe: Coefficients for the final prediction rule ensemble

Description

coef.pre returns coefficients for prediction rules and linear terms in the final ensemble

Usage

# S3 method for gpe
coef(object, penalty.par.val = "lambda.1se", ...)

# S3 method for pre coef(object, penalty.par.val = "lambda.1se", ...)

Arguments

object

object of class pre

penalty.par.val

character. Penalty parameter criterion to be used for selecting final model: lambda giving minimum cv error ("lambda.min") or lambda giving cv error that is within 1 standard error of minimum cv error ("lambda.1se"). Alternatively, a numeric value may be specified, corresponding to one of the values of lambda in the sequence used by glmnet, for which estimated cv error can be inspected by running object$glmnet.fit and plot(object$glmnet.fit).

...

additional arguments to be passed to coef.glmnet.

Value

returns a dataframe with 3 columns: coefficient, rule (rule or variable name) and description (NA for linear terms, conditions for rules).

Details

In rare cases, duplucated variable names may appear in the model. For example, when the first variable is named 'V1' and is a factor, and there is a variable called 'V10' and/or 'V11' and/or 'V12' (etc), which is/are numeric. For the binary factor V1, dummy contrast variables were created to fit the model, called 'V10', 'V11', 'V12' (etc). As should be clear from this example, this yields replicated variable names, which may yield errors or incorrect results. Users should avoid this situation by renaming the variables prior to the analysis.

See Also

pre, plot.pre, cvpre, importance, predict.pre, interact, print.pre

Examples

Run this code
# NOT RUN {
set.seed(42)
airq.ens <- pre(Ozone ~ ., data = airquality[complete.cases(airquality),])
coefs <- coef(airq.ens)
# }

Run the code above in your browser using DataLab