Nothing
library("tram")
library("RobinCar")
set.seed(290875)
N <- 131
if (TESTONLY) {
REPL <- 1L
} else {
REPL <- 10000L
}
message("Number of replications:", REPL)
w <- gl(2, N)
eta <- 1
theta <- c(1, 4)
p <- cf <- matrix(0, ncol = 5, nrow = REPL)
colnames(p) <- colnames(cf) <- c("NAMI", "MI", "LTM", "WEIL", "LRCL")
### CL: 10.1093/biomet/asad045
for (i in 1:nrow(p)) {
print(i)
X <- rgamma(length(w), shape = eta, rate = eta)
lp <- c(0, tau)[w] + (lX <- log(X))
U <- runif(length(w))
Y <- exp((log(-log1p(- U)) - theta[1] - lp) / theta[2])
tryCatch({
summary(m <- Survreg(Y ~ w + lX))
p[i,"WEIL"] <- summary(m)$test$test$pvalues["w2"]
cf[i, "WEIL"] <- -coef(m)["w2"]
}, error = function(e) NULL)
tryCatch({
summary(m <- Coxph(Y ~ w + lX, log_first = TRUE))
p[i,"LTM"] <- summary(m)$test$test$pvalues["w2"]
cf[i, "LTM"] <- coef(m)["w2"]
}, error = function(e) NULL)
#layout(matrix(1:2, nrow = 1))
#plot(survfit(Surv(Y, rep(TRUE, length(Y))) ~ w),
# col = 1:2)
#plot(survfit(Surv(Y, rep(TRUE, length(Y))) ~ w),
# fun = "cloglog", col = 1:2)
tryCatch({
cf[i, "MI"] <- coef(mYw <- Coxph(Y ~ w, log_first = TRUE))
p[i, "MI"] <- summary(mYw)$p.value
}, error = function(e) NULL)
tryCatch({
mX <- BoxCox(X ~ 1, log_first = TRUE)
cf[i, "NAMI"] <- coef(mmYw <- Mmlt(mYw, mX))["Y.w2"]
p[i, "NAMI"] <- summary(mmYw)$test$test$pvalues["Y.w2"]
}, error = function(e) NULL)
d <- data.frame(Y = Y, cens = 1, w = unclass(w) - 1L, X = X)
tryCatch({
x <- robincar_covhr(d, treat = "w", response = "Y", event = "cens",
covariate = "X")
cf[i, "LRCL"] <- x$result$theta_CL
stat <- x$result$theta_CL/x$result$se_theta_CL
p[i, "LRCL"] <- 2 * pnorm(abs(stat), lower = FALSE)
}, error = function(e) NULL)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.