# Prepare data
data(Week3_response)
Week3_response = data.frame(Week3_response)
surv_fam_shan_w3 = data.frame(cbind(as.numeric(Week3_response$T1Dweek),
as.numeric(Week3_response$T1D)))
colnames(surv_fam_shan_w3) = c("Survival", "Censor")
prog_fam_shan_w3 = data.frame(factor(Week3_response$Treatment_new))
colnames(prog_fam_shan_w3) = c("Treatment")
data(fam_shan_trim_w3)
names_fam_shan_trim_w3 =
c("Unknown", "Lachnospiraceae", "S24.7", "Lactobacillaceae", "Enterobacteriaceae", "Rikenellaceae")
fam_shan_trim_w3 = data.matrix(fam_shan_trim_w3[ ,2:82])
rownames(fam_shan_trim_w3) = names_fam_shan_trim_w3
# Using the function
lasso_fam_shan_w3 = Lasoelascox(Survival = surv_fam_shan_w3$Survival,
Censor = surv_fam_shan_w3$Censor,
Micro.mat = fam_shan_trim_w3,
Prognostic = prog_fam_shan_w3,
Plots = TRUE,
Standardize = TRUE,
Alpha = 1,
Fold = 4,
nlambda = 100,
Mean = TRUE)
# View the selected taxa
lasso_fam_shan_w3$Selected.mi
# Number of selected taxa
lasso_fam_shan_w3$n
# View the classification group of each subject
lasso_fam_shan_w3$Risk.Group
# View the survival analysis result
lasso_fam_shan_w3$SurvFit
Run the code above in your browser using DataLab