fold: Particular fold of a data after k fold partition

Description Usage Arguments Details Value Author(s) Examples

View source: R/extlasso.R

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)

B N 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 -1.5238080 -0.1806526 -0.6008558 -1.03040762
 [2,]    2 -0.2833568 -0.1659303 -0.4088608 -0.01863115
 [3,]    1  0.1078302 -0.7666660 -0.1722857 -0.53734678
 [4,]    2 -0.6647047  1.2511642 -0.9097613 -0.14051319
 [5,]    3 -0.4832177  0.8969362  1.3612483  0.53473071
 [6,]    2 -0.7668504  0.4865193 -1.2587702 -1.37646265
 [7,]    1  1.0924261  0.6266706 -1.2582389 -1.17112033
 [8,]    3 -0.8793050  1.6548411 -0.6934884  1.01147876
 [9,]    1 -1.3562145  0.5351869  0.2456851  0.34684211
[10,]    3 -1.7724909  0.5465003 -0.0878413 -1.08976711
     [,1]       [,2]       [,3]       [,4]       [,5]
[1,]    2 -1.5238080 -0.1806526 -0.6008558 -1.0304076
[2,]    2  0.1078302 -0.7666660 -0.1722857 -0.5373468
[3,]    2 -0.6647047  1.2511642 -0.9097613 -0.1405132

extlasso documentation built on May 2, 2019, 11:39 a.m.

Related to fold in extlasso...