# NOT RUN {
# }
# NOT RUN {
##-----------------------------------------------------------------
## Multivariate Longitudinal Response
##-----------------------------------------------------------------
# Simulate data involves 3 response and 4 covariates
dta <- simLong(n = 100, N = 5, rho =.80, model = 1, q_x = 0,
q_y = 0,type = "corCompSym")$dtaL
# Boosting call: Raw values of covariates, B-spline for time,
# no shrinkage, no estimate of rho and phi
boost.grow <- BoostMLR(x = dta$features, tm = dta$time, id = dta$id,
y = dta$y, M = 100, VarFlag = FALSE)
# Plot training error
plotBoostMLR(boost.grow$Error_Rate,xlab = "m",ylab = "Training Error")
##-----------------------------------------------------------------
## Laboratory data
##-----------------------------------------------------------------
data(Laboratory_Data, package = "BoostMLR")
Var_Names <- colnames(Laboratory_Data)
x_Names <- setdiff(Var_Names, c("id","time","tbili_po","creat_po"))
dta_id <- Laboratory_Data[,"id"]
dta_time <- Laboratory_Data[,"time"]
dta_x <- Laboratory_Data[,x_Names]
dta_y <- Laboratory_Data[,c("tbili_po","creat_po")]
boost.grow <- BoostMLR(x = dta_x,tm = dta_time,id = dta_id,y = dta_y,
Time_Varying = TRUE,BS_Time = TRUE,
All_RawX = TRUE,M = 10, VarFlag = TRUE)
##-----------------------------------------------------------------
## Univariate Longitudinal Response
##-----------------------------------------------------------------
# Simulate data involves 1 response and 4 covariates
dta <- simLong(n = 100, N = 5, rho =.80, model = 2, q_x = 0,
q_y = 0,type = "corCompSym")$dtaL
# Boosting call: B-spline for time and covariates, shrinkage,
# estimate of rho and phi
boost.grow <- BoostMLR(x = dta$features, tm = dta$time, id = dta$id,
y = dta$y, M = 100, BS_Time = TRUE,
All_RawX = FALSE, Shrink = TRUE,VarFlag = TRUE)
# Plot training error
plotBoostMLR(boost.grow$Error_Rate,xlab = "m",ylab = "Training Error")
# Plot phi
plotBoostMLR(boost.grow$Phi,xlab = "m",ylab = "phi")
# Plot rho
plotBoostMLR(boost.grow$Rho,xlab = "m",ylab = "rho")
##-----------------------------------------------------------------
## Multivariate Longitudinal Response
##-----------------------------------------------------------------
# Simulate data involves 3 response and 4 covariates
dta <- simLong(n = 100, N = 5, rho =.80, model = 1, q_x = 0,
q_y = 0,type = "corCompSym")$dtaL
# Boosting call: Raw values of covariates, fixed parameter estimates
# instead of time varying, no shrinkage, no estimate of rho and phi
boost.grow <- BoostMLR(x = dta$features, tm = dta$time, id = dta$id,
y = dta$y, M = 100,Time_Varying = FALSE,VarFlag = FALSE)
# Print parameter estimates
boost.grow$Tm_Beta
##-----------------------------------------------------------------
## Multivariate Response from Cross-sectional Data: Estimated
## coefficient as a function of covariate
##-----------------------------------------------------------------
if (library("mlbench", logical.return = TRUE)) {
data("BostonHousing")
x <- BostonHousing[,c(1:7,9:12)]
tm <- BostonHousing[,8]
id <- 1:nrow(BostonHousing)
y <- BostonHousing[,13:14]
# Boosting call: Raw values of covariates, B-spline for covariate "dis",
# no shrinkage
boost.grow <- BoostMLR(x = x, tm = tm, id = id, y = y, M = 100,VarFlag = FALSE)
# Plot training error
plotBoostMLR(boost.grow$Error_Rate,xlab = "m",ylab = "Training Error",
legend_fraction_x = 0.2)
}
##-----------------------------------------------------------------
## Univariate Response from Cross-sectional Data: Fixed estimated
## coefficient
##-----------------------------------------------------------------
if (library("mlbench", logical.return = TRUE)) {
library(mlbench)
data("BostonHousing")
x <- BostonHousing[,1:13]
y <- BostonHousing[,14]
# Boosting call: Raw values of covariates
boost.grow <- BoostMLR(x = x, y = y, M = 100)
# Plot training error
plotBoostMLR(boost.grow$Error_Rate,xlab = "m",ylab = "Training Error",
legend_fraction_x = 0.2)
}
# }
Run the code above in your browser using DataLab