mcnnm_wc_lam_range: This function computes the minimum value of lambda_L and...

Description Usage Arguments Value See Also Examples

View source: R/RcppExports.R

Description

This function computes the minimum value of lambda_L and lambda_H which causes L and H to be zero. User can get the output of this function and fit the low-rank matrix L, and the sparse matrix H, for her desired values of lambda_L and lambda_H.

Usage

1
2
mcnnm_wc_lam_range(M, X, Z, mask, to_normalize = 1L, to_estimate_u = 1L,
  to_estimate_v = 1L, to_add_ID = 1L, niter = 1000L, rel_tol = 1e-05)

Arguments

M

Matrix of observed entries. The input should be N (number of units) by T (number of time periods).

X

Matrix containing unit-related covariates. The number of rows of X should match with the number of units (number of rows of M). If unit-related covariates do not exist X = matrix(0L,0,0) should be used as input.

Z

Matrix containing time-related covariates. The number of rows of Z should match with the number of time periods (number of columns in M). If time-related covariates do not exist use Z = matrix(0L,0,0)

mask

Binary mask with the same shape as M containing observed entries.

to_normalize

Optional boolean parameter indicating whether to normalize covariates or not (columns of X and Z). The default value is 1. If this value is set to 0, the result would be sensitive to scales in covariates.

to_estimate_u

Optional boolean input for wheter estimating fixed unit effects (row means of M) or not. Default is 1.

to_add_ID

Optional boolean parameter indicating whether identity matrices are concatenated with X and Z in the model X * H * Z'. The default value is true (identity matrices are concatenated) and the model becomes X*H_X + X*H_XZ*Z^T+ H_Z Z^T (the rest of matrix in H forced to zero).

niter

Optional parameter on the number of iterations taken in the algorithm for each fixed value of lambda_L. The default value is 1000 and it is sufficiently large as the algorithm is using warm-start strategy.

rel_tol

Optional parameter on the stopping rule. Once the relative improve in objective value drops below rel_tol, execution is halted. Default value is 1e-5.

Value

The minimum value of lambda_L and lambda_H which makes L and H equal to zero. This function is helpful when user wants to manually choose (lambda_L, lambda_H) pair.

See Also

mcnnm_lam_range

Examples

1
mcnnm_wc_lam_range(M = replicate(5,rnorm(5)), X = replicate(3, rnorm(5)), Z = matrix(0L, 0, 0),  mask = matrix(rbinom(5*5,1,0.8),5,5))

susanathey/MCPanel documentation built on May 29, 2019, 9:51 a.m.