cv.lori: The cv.lori method performs automatic selection of the...

Description Usage Arguments Value Examples

View source: R/cv.lori.R

Description

The cv.lori method performs automatic selection of the regularization parameters (lambda1 and lambda2) used in the lori function. These parameters are selected by cross-validation. The classical procedure is to apply cv.lori to the data to select the regularization parameters, and to then impute and analyze the data using the lori function (or mi.lori for multiple imputation).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
cv.lori(
  Y,
  cov = NULL,
  intercept = T,
  reff = T,
  ceff = T,
  rank.max = 5,
  N = 5,
  len = 20,
  prob = 0.2,
  algo = c("alt", "mcgd"),
  thresh = 1e-05,
  maxit = 10,
  trace.it = F,
  parallel = F
)

Arguments

Y

[matrix, data.frame] abundance table (nxp)

cov

[matrix, data.frame] design matris (npxq)

intercept

[boolean] whether an intercept should be fitted, default value is FALSE

reff

[boolean] whether row effects should be fitted, default value is TRUE

ceff

[boolean] whether column effects should be fitted, default value is TRUE

rank.max

[integer] maximum rank of interaction matrix, default is 2

N

[integer] number of cross-validation folds

len

[integer] the size of the grid

prob

[numeric in (0,1)] the proportion of entries to remove for cross-validation

algo

type of algorithm to use, either one of "mcgd" (mixed coordinate gradient descent, adapted to large dimensions) or "alt" (alternating minimization, adapted to small dimensions)

thresh

[positive number] convergence threshold, default is 1e-5

maxit

[integer] maximum number of iterations, default is 100

trace.it

[boolean] whether information about convergence should be printed

parallel

[boolean] whether computations should be performed in parallel on multiple cores

Value

A list with the following elements

lambda1

regularization parameter estimated by cross-validation for nuclear norm penalty (interaction matrix)

lambda2

regularization parameter estimated by cross-validation for l1 norm penalty (main effects)

errors

a table containing the prediction errors for all pairs of parameters

Examples

1
2
3
X <- matrix(rnorm(20), 10)
Y <- matrix(rpois(10, 1:10), 5)
res <- cv.lori(Y, X, N=2, len=2)

lori documentation built on Dec. 16, 2020, 5:08 p.m.