# modelSelectionR: Exact model selection function In penaltyLearning: Penalty Learning

## Description

Given `loss.vec` L_i, `model.complexity` K_i, the model selection function i*(lambda) = argmin_i L_i + lambda*K_i, compute all of the solutions (i, min.lambda, max.lambda) with i being the solution for every lambda in (min.lambda, max.lambda). This function uses the quadratic time algorithm implemented in R code. This function is mostly meant for internal use and comparison – it is instead recommended to use `modelSelection`.

## Usage

 ```1 2 3``` ```modelSelectionR(loss.vec, model.complexity, model.id) ```

## Arguments

 `loss.vec` numeric vector: loss L_i `model.complexity` numeric vector: model complexity K_i `model.id` vector: indices i

## Value

data.frame with a row for each model that can be selected for at least one lambda value, and the following columns. (min.lambda, max.lambda) and (min.log.lambda, max.log.lambda) are intervals of optimal penalty constants, on the original and log scale; `model.complexity` are the K_i values; `model.id` are the model identifiers (also used for row names); and model.loss are the C_i values.

## Author(s)

Toby Dylan Hocking

## Examples

 ```1 2 3 4 5 6``` ```loss.vec <- c( -9.9, -12.8, -19.2, -22.1, -24.5, -26.1, -28.5, -30.1, -32.2, -33.7, -35.2, -36.8, -38.2, -39.5, -40.7, -41.8, -42.8, -43.9, -44.9, -45.8) seg.vec <- seq_along(loss.vec) penaltyLearning::modelSelectionR(loss.vec, seg.vec, seg.vec) ```

penaltyLearning documentation built on July 1, 2020, 10:26 p.m.