Skip to content

Commit 733264f

Browse files
committed
clean R code
1 parent 94b5e2a commit 733264f

File tree

4 files changed

+10
-23
lines changed

4 files changed

+10
-23
lines changed

R/plotBrier.R

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,17 @@ plotBrier <- function(dat, datMCMC,
218218
}
219219

220220
list.models <- list(
221-
"Cox.clin" = pred.fitCox.clin,
222-
"Cox.X.mean" = pred.fitCox.X.mean,
223-
"Cox.X.median" = pred.fitCox.X.median,
224-
# "Cox.clin.X.median"=fitCox.clin.X.median,
225-
"Cox.clin.X.mean" = pred.fitCox.clin.X.mean,
226-
# "PTCM.clin" = predPTCM.prob,
221+
"Cox-X0" = pred.fitCox.clin,
222+
"Cox-Xmean" = pred.fitCox.X.mean,
223+
"Cox-Xmedian" = pred.fitCox.X.median,
224+
# "Cox-X0-Xmedian"=fitCox.clin.X.median,
225+
"Cox-X0Xmean" = pred.fitCox.clin.X.mean,
226+
# "PTCM-X0" = predPTCM.prob,
227227
# "GPTCM-BetaBin" = pred.prob2,
228228
"GPTCM" = pred.prob
229229
)
230230
if (PTCM) {
231-
list.models <- c(list.models, list("GPTCM-PTCM.clin" = predPTCM.prob))
231+
list.models <- c(list.models, list("PTCM-X0" = predPTCM.prob))
232232
}
233233
g <- riskRegression::Score(
234234
list.models,
@@ -242,10 +242,7 @@ plotBrier <- function(dat, datMCMC,
242242
data <- data[data$times <= time.star, ]
243243
}
244244
levels(data$model)[1] <- "Kaplan-Meier"
245-
# utils::globalVariables(c("times", "Brier", "model"))
246-
# NOTE: `aes_string()` was deprecated in ggplot2 3.0.0.
247245
g2 <- ggplot2::ggplot(data, aes(
248-
# x = "times", y = "Brier", group = "model", color = "model"
249246
x = .data$times, y = .data$Brier, group = .data$model, color = .data$model
250247
)) +
251248
xlab(xlab) +

R/plotCoeff.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,10 @@ plotCoeff <- function(dat,
5959
label.y = NULL,
6060
first.coef = NULL,
6161
y.axis.size = 8, ...) {
62-
# n <- dim(dat$X)[1]
62+
6363
p <- dim(dat$X)[2]
6464
L <- dim(dat$X)[3]
6565
thin <- datMCMC$input$thin
66-
# nIter <- datMCMC$input$nIter / thin
6766
burnin <- datMCMC$input$burnin / thin + 1
6867

6968
xlab0 <- xlab
@@ -78,8 +77,6 @@ plotCoeff <- function(dat,
7877
xlim.upper <- xlim[2]
7978
}
8079

81-
# legend0 <- ifelse(is.null(legend.labs), 0, 1)
82-
8380
if (estimator == "beta") {
8481
betas.mcmc <- datMCMC$output$betas[-c(1:burnin), ]
8582
betas.true <- dat$betas

R/plotMCMC.R

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,14 @@ plotMCMC <- function(dat, datMCMC, estimator = "xi") {
4141
oldpar <- par(no.readonly = TRUE)
4242
on.exit(par(oldpar))
4343

44-
# n <- dim(dat$X)[1]
4544
p <- dim(dat$X)[2]
4645
L <- dim(dat$X)[3]
47-
# nIter <- datMCMC$input$nIter
48-
# burnin <- datMCMC$input$burnin
49-
# p.idx <- 1:(p * L)
46+
47+
# set covariates' indexes for plotting
5048
p.idx <- 1:((p + 1) * L)
51-
# p.DirTrue.idx <- 1:((p + 1) * L)
5249
p.DirFalse.idx <- 1:((p + 1) * (L - 1))
5350
if (p > 10) {
54-
# p.idx <- rep(1:10, L) + p * rep(0:(L - 1), each = 10)
5551
p.idx <- rep(1:11, L) + (p + 1) * rep(0:(L - 1), each = 11)
56-
# p.DirTrue.idx <- rep(1:11, L) + (p + 1) * rep(0:(L - 1), each = 11)
5752
p.DirFalse.idx <- rep(1:11, L - 1) + (p + 1) * rep(0:(L - 2), each = 11)
5853
p <- 10
5954
}

R/predict.GPTCM.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ predict.GPTCM <- function(object, dat,
3939
type = "survival",
4040
times = NULL, ...) {
4141
n <- dim(dat$X)[1]
42-
# p <- dim(dat$X)[2]
4342
L <- dim(dat$X)[3]
4443

4544
if (is.null(newdata)) {
@@ -48,7 +47,6 @@ predict.GPTCM <- function(object, dat,
4847
survObj.new <- newdata$survObj
4948
}
5049

51-
# nIter <- object$input$nIter
5250
burnin <- object$input$burnin / object$input$thin
5351

5452
# survival predictions based on posterior mean

0 commit comments

Comments
 (0)