Learn R Programming

flassomsm (version 0.1.0)

flassomsm_pirls: flassomsm_pirls

Description

Fits a penalized regression model with combined Fusedlasso penalty using PIRLS algorithm

Usage

flassomsm_pirls(
  msdata,
  X,
  p,
  lambda_lasso,
  lambda_fused,
  tol_lim = 1e-04,
  max_iter = 50,
  trace = TRUE,
  MSM_profile = FALSE,
  use_parallel = TRUE
)

Value

A list with elements like matrix of estimated beta coefficients along with standard error and p value,number of iterations, aic (Akaike Information Criterion) value, gcv (GCV criterion) value and df (degrees of freedom)

Arguments

msdata

is a multi-state model in extended form having columns Tstart,Tstop,trans (covariates expanded transition wise)

X

expanded covariate matrix of the msdata

p

number of covariates in the dataset before expanding

lambda_lasso

parameter for lasso penalty

lambda_fused

parameter for fused penalty

tol_lim

tolerence limit in the algorithm to stop

max_iter

maximum number of iterations reached

trace

logical triggering for status information

MSM_profile

logical triggering to return the results

use_parallel

logical flag to indicate whether to use parallel processing

Author

Atanu Bhattacharjee,Gajendra Kumar Vishwakarma,Abhipsa Tripathy

Details

This function fits a penalized Cox type regression model to a multi-state model, where the penalty is a combination of Lasso penalty and Fused penalty. It implements L1 type penalization with the penalty applied to absolute transition-specific effects and pairwise difference between the corresponding transition effects.

Examples

Run this code
##
set.seed(123)
data(msdata_3state)
covs1 <- msdata_3state[,9:10]
flassomsm_pirls(msdata = msdata_3state,X=msdata_3state[,c(11:dim(msdata_3state)[[2]])],
p = length(covs1),lambda_lasso = 0.3,lambda_fused = 0.5,tol_lim = 1e-4,
max_iter = 10, trace = TRUE, MSM_profile = FALSE,use_parallel = TRUE)

# For 2 covariates and 3 number of transitions

# \donttest{
# Simulate msdata_4state instead of loading from disk
msdata_4state <- simdata(seed=123,n=1000,dist="weibull",cdist="exponential",
                 cparams=list(rate = 0.1),lambdas=c(0.1, 0.2, 0.3, 0.4),
                 gammas=c(1.5, 2, 2.5, 2.6),beta_list=list(c(-0.05,0.01,0.5,0.6),
                 c(-0.03, 0.02, 0.07, 0.08),c(-0.04, 0.03, 0.04, -0.03),
                 c(-0.05,0.05,0.6,0.8)),cov_means=c(0, 10, 2, 3),cov_sds=c(1,20,5,1.05),
                 trans_list=list(c(2, 3, 4, 5),c(3, 4, 5),c(4, 5), c(5), c()),
                 state_names=c("Tx", "Rec", "Death", "Reldeath", "srv"))

set.seed(123)
sub_msdata_4state <- msdata_4state[msdata_4state$id %in% sample(unique(msdata_4state$id), 10), ]
covs1 <- sub_msdata_4state[,9:10]
flassomsm_pirls(msdata = sub_msdata_4state,X=sub_msdata_4state[,c(13:32)],
              p = length(covs1),lambda_lasso = 0.5,lambda_fused = 0.6, tol_lim = 1e-4,max_iter = 10,
              trace = TRUE, MSM_profile = FALSE,use_parallel = TRUE)
# }
# For 2 covariates and 10 number of transitions
##

Run the code above in your browser using DataLab