comte: Compound decision method for multivariate linear models

View source: R/RcppExports.R

comteR Documentation

Compound decision method for multivariate linear models

Description

The function uses EM algorithm to solve multivariate linear regression problems

Y = XB + ε

' both outcome Y and feature X are multi-dimensional. Users can set distinct residual estimations fordifferent outcomes or set identical estimation for more robust results. Details can be found in our paper.

Usage

comte(
  y,
  x,
  S,
  tol = 1e-06,
  maxit = 100000L,
  min_s2 = NULL,
  scale = 1,
  cutoff = 0
)

Arguments

y

n x q matrix of outcomes for training.

x

n x p matrix of features for training.

S

d x L matrix of support points. If L = p + 1, then the first p columns are βs and the last column is the corresponding residual error estimates. If L = p, then each column of S is a vector of βs and argument min_s2 is required. d = q x g where g is the number of groups of support points. Support points can be estimated by other methods that solve multivariate linear regression. Eg. LASSO from glmnet.

tol

error tolerance for convergence of EM algorithm. Default value of tol is 1e-6.

maxit

maximum number of allowable iterations. Default value of maxit is 1e5.

min_s2

a positive number corresponds to minimal variance of estimated y, min_s2 is required when there are p columns in S.

Value

  • f: vector with g x q elements that describes the mixture of βs.

  • A: matrix with dimension q x d. A is an estimation of likelihood by EM algorithm and will be used in predicting.

  • bs: Matrix with dimension d x (p + 1). bs is support points used in updating prior distribution f. bs is equivalent to S when L = p + 1 and will be used in predicting.

Examples


## generate data
p = 10
q = 5
n = 50
x = matrix(rnorm(n*p,0,10), n, p)
beta = matrix(rnorm(p*q,0,10), q, p)
e = matrix(rnorm(n*q,0,0.1),n,q)
y = x %*% t(beta) + e
s2 = matrix(rep(0.1,q), q, 1)
## initialize parameters for EM algorithm
x_test = matrix(rnorm(n*p,0,1), n, p)
## set minimal variance estimation min_s2 = 0.1
output1 = comte(y=y, x=x, S=beta, min_s2=0.1)
## use distinct variance from multivariate linear regression models
output2 = comte(y=y, x=x, S=cbind(beta,s2))



sdzhao/cole documentation built on May 2, 2022, 9:42 a.m.