coef.pre: Coefficients for the final prediction rule ensemble

Description Usage Arguments Details Value See Also Examples

View source: R/pre.R

Description

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

Usage

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

Arguments

object

object of class pre

penalty.par.val

character or numeric. Value of the penalty parameter λ to be employed for selecting the final ensemble. The default "lambda.min" employs the λ value within 1 standard error of the minimum cross-validated error. Alternatively, "lambda.min" may be specified, to employ the λ value with minimum cross-validated error, or a numeric value >0 may be specified, with higher values yielding a sparser ensemble. To evaluate the trade-off between accuracy and sparsity of the final ensemble, inspect pre_object$glmnet.fit and plot(pre_object$glmnet.fit).

...

additional arguments to be passed to coef.cv.glmnet.

Details

In some cases, duplicated variable names may appear in the model. For example, the first variable is a factor named 'V1' and there are also variables named 'V10' and/or 'V11' and/or 'V12' (etc). Then for for the binary factor V1, dummy contrast variables will be created, named 'V10', 'V11', 'V12' (etc). As should be clear from this example, this yields duplicated variable names, which may yield problems, for example in the calculation of predictions and importances, later on. This can be prevented by renaming factor variables with numbers in their name, prior to analysis.

Value

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

See Also

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

Examples

1
2
3
set.seed(42)
airq.ens <- pre(Ozone ~ ., data = airquality[complete.cases(airquality),])
coefs <- coef(airq.ens)

Example output



pre documentation built on March 13, 2020, 2:23 a.m.