oscar.sparsify {oscar}R Documentation

Create a sparse matrix representation of betas as a function of k

Description

Variable estimates (rows) as a function of cardinality (k, columns). Since a model can drop out variables in favor of two better ones as k increases, this sparse representation helps visualize which variables are included at what cardinality.

Usage

oscar.sparsify(fit, kmax = fit@kmax)

Arguments

fit

oscar-model object

kmax

Create matrix until kmax-value; by default same as for fit object, but for high dimensional tasks one may wish to reduce this

Details

Uses sparseMatrix-class from Matrix-package

Value

A sparse matrix of variables (rows) as a function of cardinality k (columns), where elements are the beta estimates.

Examples

if(interactive()){
  data(ex)
  fit <- oscar(x=ex_X, y=ex_Y, k=ex_K, w=ex_c, family='cox')
  oscar.sparsify(fit, kmax=5)
}


[Package oscar version 1.2.1 Index]