options(width=100)

In step II, we use the masta.fit function to fit penalized proportional odds (PO) models to the labeled time-to-event data with features derived in step I. When fitting the penalized PO models, the non-parametric baseline function is approximated using B-splines.

library(MASTA)
# step I
system.time(obj <- masta.fpca(data_org))
# step II
system.time(fit <- masta.fit(obj))
bgbbest <- fit$bgbbest_FromChengInit_BFGS
colnames(bgbbest)[2] <- "MLE"
DF.wide <- data.frame(i = 1:nrow(bgbbest), bgbbest)
DF.wide

The output from the masta.fit function is a list with components:

library(ggplot2)
DF.long <- tidyr::gather(DF.wide, key = "type", value = "coef", bgbm.init:BIC.Orig)
ggplot(DF.long, aes(x = i, y = coef)) + 
  geom_bar(stat="identity") + 
  facet_wrap(~ type) + 
  theme_bw() + xlab("") + ylab("") 
fit


celehs/PETLER documentation built on Sept. 3, 2021, 8:21 a.m.