trans_alasso: Adaptive LASSO for Semiparametric Transformation Models.

Description Usage Arguments Details Value References Examples

View source: R/trans_alasso.R

Description

Select the important variables in semiparametric transformation models for right censored data using adaptive lasso.

Usage

1
trans_alasso(Z, Y, delta_i, r, lamb_vec, solu = TRUE)

Arguments

Z

the baseline covariates

Y

observed event times

delta_i

censoring indicator. If Y is censored, delta_i=0. If not, delta_i=1.

r

parameter in transformation function

lamb_vec

the grad of the tuning parameter λ

solu

determines whether the solution path will be plotted. The default is TRUE.

Details

The initial value of the coefficient β used as the adapting weights is EM estimator, which is computed by the function EM_est. The tuning parameter λ is data-dependent and we select it using generalized crossvalidation. There may be some errors for small λ, in which case the λ and the number of adaptive lasso iteration are recorded in the skip_para.

Value

a list containing

beta_res the estimated β with the selected tuning parameter λ
GCV_res the value of GCV with the selected tuning parameter λ
lamb_res the selected tuning parameter λ
beta_all estimated β with all tuning parameters
CSV_all value of GCV with all tuning parameters
skip_para a list containing the λ and the number of adaptive lasso iteration when adaptive lasso doesn't work.

References

Xiaoxi, L. , & Donglin, Z. . (2013). Variable selection in semiparametric transformation models for right-censored data. Biometrika(4), 859-876.

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 if(!requireNamespace("MASS", quietly = TRUE))
 {stop("package MASS needed for this example. Please install it.")}

 gen_lasdat = function(n,r,rho,beta_true,a,b,seed=66,std = FALSE)
{

  set.seed(seed)
  beta_len = length(beta_true)
  beta_len = beta_len
  sigm = matrix(0, nrow = beta_len, ncol = beta_len)
  for(i in 1:(beta_len-1))
  {
    diag(sigm[1:(beta_len+1-i),i:beta_len]) = rho^(i-1)
  }
  sigm[1,beta_len] = rho^(beta_len-1)
  sigm[lower.tri(sigm)] = t(sigm)[lower.tri(sigm)]

  Z = MASS::mvrnorm(n, mu = rep(0, beta_len), Sigma = sigm)
  beta_Z.true = c(Z %*% beta_true)
  U = runif(n)
  if(r>0)
  {
    t = ((U^(-r)-1)/(a*r*exp(beta_Z.true)))^(1/b)
  }else if(r == 0)
  {
    t = (-log(U)/(a*exp(beta_Z.true)))^(1/b)
    #t = (exp(-log(U)/(0.5 * exp(beta_Z.true))) - 1)
  }
  C = runif(n,0,8)
  Y = pmin(C,t)
  delta_i = ifelse( C >= t, 1, 0)
  if(std)
  {
    Z = apply(Z,2,normalize)
  }
  return(list(Z = Z, Y = Y, delta_i = delta_i,censor = mean(1-delta_i)))
}

now_rep=1
dat = gen_lasdat(100,1,0.5,c(0.3,0.5,0.7,0,0,0,0,0,0,0),2,5,seed= 6+60*now_rep,std = FALSE)
Z = dat$Z
Y = dat$Y
delta_i = dat$delta_i

tra_ala = trans_alasso(Z,Y,delta_i,lamb_vec = c(5,7),r=1)
tra_ala$GCV_res
tra_ala$beta_res
tra_ala$lamb_res

transmdl documentation built on Oct. 14, 2021, 5:07 p.m.