fold: Particular fold of a data after k fold partition

Description Usage Arguments Details Value Author(s) Examples

Description

The function returns a particular fold after k-fold partitioning by kfold function.

Usage

1
fold(data1,k,i)

Arguments

data1

A matrix.

k

Number of folds

i

The fold to be returned

Details

This function is internal and used by cross validation routines.

Value

A matrix with desired fold specified.

Author(s)

Baidya Nath Mandal and Jun Ma

Examples

1
2
3
data=matrix(rnorm(10*4),10,4)
kfold(data,3)
fold(data,3,2)

Example output

      [,1]        [,2]        [,3]        [,4]       [,5]
 [1,]    3  0.21742404  0.05785494  0.38528301 0.24479345
 [2,]    2  0.66730215 -1.71241968 -0.09319634 1.40077846
 [3,]    3  1.12223089  1.24007430 -0.50052581 0.27841223
 [4,]    3  2.24537589 -0.63274004  0.16561024 0.48616213
 [5,]    2 -0.29674340  0.44449322 -0.60770946 0.56666136
 [6,]    2  0.11722773  0.45246439  1.43709248 0.76919567
 [7,]    1 -0.94921884  1.31378733 -0.08278243 0.01215495
 [8,]    1  0.06671021  0.67636403  1.27556070 1.62802777
 [9,]    3  0.96281403  0.92772784 -0.28777799 0.22125584
[10,]    1 -1.58836445 -0.33797424 -0.54904400 0.81557279
     [,1]       [,2]       [,3]        [,4]       [,5]
[1,]    2 -0.9492188  1.3137873 -0.08278243 0.01215495
[2,]    2  0.9628140  0.9277278 -0.28777799 0.22125584
[3,]    2 -1.5883645 -0.3379742 -0.54904400 0.81557279

nnlasso documentation built on May 2, 2019, 8:19 a.m.

Related to fold in nnlasso...