Description Usage Arguments Author(s) References Examples
This function implements the estimation and inference for high dimensional classification rule under a joint model which simply pool all the labels.
1 2 3 4 5 6 7 8 9 10 11 |
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. |
anonymous <anonymous@anonymous.net>
anonymous.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.