## S3 method for class 'default':
inclass(object, ...)
## S3 method for class 'formula':
inclass(formula, pFUN, data, subset, na.action, ...)
## S3 method for class 'flist':
inclass(object, pFUN, data, subset, na.action, ...)
formula
specified as x+y+z~a+b+c
is transformed into a list of formulas, where each vector x, y, z
is modelled with formula
a+b+c
. object
is of class
rpart
- regression or classification trees (see
rpart
); lm
- linear models (see
NA
s. Defaults to getOption("na.action")
nbaggs
for pFUN=bagging
, cr
or na.action=na.exclude
for
pFUN = lm
.flist
.inclass
, consisting of a list of prediction models for
each specified intermediate variable. If pFUN=bagging
, each element of the list (for each intermediate variable) consists of a list of nbagg
models corresponding to each bootstrap sample.pFUN
and a formula specified by formula
or flist
. A list of prediction models corresponding to each
intermediate is returned. For a detailed description on indirect
classification see Hand et al. (2001).rpart
, bagging
, lm
data(smoking)
# Set three groups of variables:
# 1) explanatory variables are: TarY, NicY, COY, Sex, Age
# 2) intermediate variables are: TVPS, BPNL, COHB
# 3) response (resp) is defined by:
resp <- function(data){
res <- t(t(data) > c(4438, 232.5, 58))
res <- as.factor(ifelse(apply(res, 1, sum) > 2, 1, 0))
res
}
response <- resp(smoking[ ,c("TVPS", "BPNL", "COHB")])
smoking <- cbind(smoking, response)
formula <- TVPS+BPNL+COHB~TarY+NicY+COY+Sex+Age
inclass(formula, pFUN = lm, data = smoking)
Run the code above in your browser using DataLab