cInfer: This function implements the estimation and inference for...

Description Usage Arguments Author(s) References Examples

View source: R/cInfer.R

Description

This function implements the estimation and inference for high dimensional classification rule under a joint model which simply pool all the labels.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
cInfer(
  x,
  y = list(y1, y2, y3),
  y_refit = NULL,
  fit = NULL,
  weight = rep(1, times = NCOL(x)),
  lossType = "logistic",
  parallel = TRUE,
  indexToTest = NULL,
  ...
)

Arguments

x

a n by p matrix representing predictors, where n is the sample size and p is the number of the predictors.

y

a list of the labels; each elment is a array of the single label.

fit

a list contains the model fitting result from the joint modeling; fit$coef contains the coefficients (p dimension) and fit$cutoff contains J cutoff for J labels.

weight

array of weights assigned to each observation.

lossType

user can choose from 'logistic', 'exponential', and 'smoothed_hinge'.

parallel

whether use parallel computing to tune parameters.

indexToTest

the index of the coefficients the user would like to test; the default in Null.

Author(s)

anonymous <anonymous@anonymous.net>

References

anonymous.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# generate data
nobs <- 500
p <- 500
rate <- 0
alpha <- 0
V <- function(p, rate = 0.5){
  V.matrix <- array(0, c(p,p))
  for (i in 1:p){
    for (j in 1:p){
      V.matrix[i,j] <- rate ^ (abs(i-j))
    }
  }
  V.matrix
}
x <- mgcv::rmvn(nobs, rep(0, times=p), V(p, rate))
beta_true <- c(1,-1,1,-1, rep(0, times=p-4))
beta_modify <- c(1,1,1,1, rep(0, times=p-4))
mix <- rbinom(nobs, 1, 1-alpha)
U <- sapply(pnorm(x%*%beta_true), function(t){
  v <- rbinom(1, 4, t)
  if (v==3){
    v.add <- rbinom(1, 1, alpha)
    v <- v+v.add
  } else if (v==4){
    v.add <- rbinom(1, 1, alpha)
    v <- v-v.add
  }
  v
})
y.cutoff <- list(U>0, U>3)
# fit use the proposed method
fit <- cInfer(x, y=y.cutoff, y_refit = list(y.cutoff[[1]]), weight = c(1, 1, 1, 1, rep(1, times= p-4)), lossType = 'logistic', tol = 1e-3, parallel = FALSE)

muxuanliang/concordLearn documentation built on Dec. 21, 2021, 11:04 p.m.