Learn R Programming

transmdl (version 0.1.0)

trans_alasso: Adaptive LASSO for Semiparametric Transformation Models.

Description

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

Usage

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 \(\lambda\)

solu

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

Value

a list containing

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

Details

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

References

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

Examples

Run this code
# NOT RUN {

 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


# }

Run the code above in your browser using DataLab