optimized_lambda: Optimizing ridge parameter based on MSE

Description Usage Arguments Value Examples

View source: R/optimized-lambda.R

Description

This is a function that attempts the best lambda parameter.

Usage

1
optimized_lambda(form, data, lambdas, fold.num = 10)

Arguments

form

a formula with the legal format.

data

a dataframe provided by the user.

lambdas

a set of ridge parameter from which the function searches the best one.

fold.num

number of folds divided for the cross validation (default=10).

Value

a list including the MSE vector, the optimized ridge parameter, and the minimimal MSE which indicates the best lambda.

Examples

1
2
data(iris)
best.lambda <- optimized_lambda(Sepal.Length ~ ., iris, lambdas=seq(0, 2, by=0.01))

BillyTian/bis557 documentation built on Dec. 19, 2020, 7:30 a.m.