library(FDboost)
options("mboost_indexmin")
require(refund))
## simulate some data from a historical model
## the interaction effect is in this case not necessary
n <- 100
nygrid <- 35
data1 <- pffrSim(scenario = c("int", "ff"), limits = function(s,t){ s <= t },
n = n, nygrid = nygrid)
data1$X1 <- scale(data1$X1, scale = FALSE) ## center functional covariate
dataList <- as.list(data1)
dataList$tvals <- attr(data1, "yindex")
## create the hmatrix-object
X1h <- with(dataList, hmatrix(time = rep(tvals, each = n), id = rep(1:n, nygrid),
x = X1, argvals = attr(data1, "xindex"),
timeLab = "tvals", idLab = "wideIndex",
xLab = "myX", argvalsLab = "svals"))
dataList$X1h <- I(X1h)
dataList$svals <- attr(data1, "xindex")
#################################
options("mboost_indexmin" = 10000)
## do the model fit with main effect of bhistx() and interaction of bhistx() and bolsc()
mod <- FDboost(Y ~ bhistx(x = X1h, df = 5, knots = 5),
timeformula = ~ bbs(tvals, knots = 10), data = dataList)
coef_mod <- coef(mod)
###################################
options("mboost_indexmin" = 10)
## do the model fit with main effect of bhistx() and interaction of bhistx() and bolsc()
mod2 <- FDboost(Y ~ bhistx(x = X1h, df = 5, knots = 5),
timeformula = ~ bbs(tvals, knots = 10), data = dataList)
### breaks within predict
coef_mod2 <- coef(mod2)
If internally an index is used for model fitting for a model containing
bhistx()some methods, e.g.,coef(), no longer work: