# NOT RUN {
#===================================================
# Loading the library and its dependencies
#===================================================
library("IRSF")
# }
# NOT RUN {
#===================================================
# IRSF package news
#===================================================
IRSF.news()
#================================================
# MVR package citation
#================================================
citation("IRSF")
#===================================================
# Loading of the Synthetic and Real datasets
# Use help for descriptions
#===================================================
data("MACS", package="IRSF")
?MACS
head(MACS)
#===================================================
# Synthetic dataset
# Continuous case:
# All variables xj, j in {1,...,p}, are iid
# from a multivariate uniform distribution
# with parmeters a=1, b=5, i.e. on [1, 5].
# rho = 0.50
# Regression model: X1 + X2 + X1X2
#===================================================
seed <- 1234567
set.seed(seed)
n <- 200
p <- 5
x <- matrix(data=runif(n=n*p, min=1, max=5),
nrow=n, ncol=p, byrow=FALSE,
dimnames=list(1:n, paste("X", 1:p, sep="")))
beta <- c(rep(1,2), rep(0,p-2), 1)
covar <- cbind(x, "X1X2"=x[,1]*x[,2])
eta <- covar %*% beta # regression function
seed <- 1234567
set.seed(seed)
lambda0 <- 1
lambda <- lambda0 * exp(eta - mean(eta)) # hazards function
tt <- rexp(n=n, rate=lambda) # true (uncensored) event times
tc <- runif(n=n, min=0, max=3.9) # true (censored) event times
stime <- pmin(tt, tc) # observed event times
status <- 1 * (tt <= tc) # observed event indicator
X <- data.frame(stime, status, x)
#===================================================
# Synthetic dataset
# Ranking of individual and noise variables by univariate
# Minimal Depth of a Maximal Subtree (MDMS)
# Serial mode
#===================================================
X.main.mdms <- rsf.main(X=X,
ntree=1000,
method="mdms",
splitrule="logrank",
importance="random",
B=1000,
ci=90,
parallel=FALSE,
conf=NULL,
verbose=TRUE,
seed=seed)
#===================================================
# Synthetic dataset
# Proportional Hazards Time-To-Event Regression Model
# saturated with first order terms only.
#===================================================
X.main.cph <- cph.main(X=X,
main.term=rownames(X.main.mdms))
#===================================================
# Real dataset
#===================================================
seed <- 1234567
data("MACS", package="IRSF")
X <- MACS[,c("TTX","EventX","Race","Group3",
"DEFB.CNV3","CCR2.SNP","CCR5.SNP2",
"CCR5.ORF","CXCL12.SNP2")]
#===================================================
# Real dataset
# Ranking of individual and noise variables by univariate
# Minimal Depth of a Maximal Subtree (MDMS)
# Parallel mode
#===================================================
MACS.main.mdms <- rsf.main(X=X,
ntree=1000,
method="mdms",
splitrule="logrank",
importance="random",
B=1000,
ci=80,
parallel=TRUE,
conf=conf,
verbose=TRUE,
seed=seed)
#===================================================
# Real dataset
# Proportional Hazards Time-To-Event Regression Model
# saturated with first order terms only.
#===================================================
MACS.main.cph <- cph.main(X=X,
main.term=rownames(MACS.main.mdms))
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab