predict_comte: Predicting function for compound decision method

View source: R/RcppExports.R

predict_comteR Documentation

Predicting function for compound decision method

Description

The function takes returned object from comte and testing data as input. Return value is the prediction for corresponding output.

Usage

predict_comte(comte_obj, newx)

Arguments

comte_obj

returned object from comte function that contains important information for predicting.

newx

m x p matrix corresponds to testing data.

Value

  • esty: m x q matrix of estimated y based on newx.

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)
esty1 = predict_comte(output1, x_test)
## use distinct variance from multivariate linear regression models
output2 = comte(y=y, x=x, S=cbind(beta,s2))
esty2 = predict_comte(output2, x_test)



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