Learn R Programming

mvtboost

Tree boosting for multivariate outcomes in R, built on gbm. Estimates a multivariate additive model of decision trees by iteratively selecting predictors that explain covariance in the outcomes.

This package can be installed directly from CRAN:

install.packages("mvtboost")
library(mvtboost)

The most recent version can be installed directly from github using the devtools package:

devtools::install_github("patr1ckm/mvtboost")

Example usage

data("mpg",package="ggplot2")
Y <- mpg[,c("cty","hwy")]      
X <- mpg[,c("manufacturer", "displacement", "year", 
          "cylinder", "transmission", "drive"", "class")]

out <- mvtb(Y=Y,X=X,           # data
        n.trees=1000,          # number of trees
        shrinkage=.01,         # shrinkage or learning rate
        interaction.depth=3)   # tree or interaction depth
?mvtb
        

Interpret the model

summary(out)                   # best trees, relative influences, and covex
mvtb.ri(out)                   # relative influences

yhat <- predict(out,newdata=X) # predictions

par(mfcol=c(1,2))              # model implied effects of displacement for cty and hwy
plot(out,1,predictor.no=2)
plot(out,2,predictor.no=2)

covex <- mvtb.covex(out)       # compute covariance explained in outcomes by predictors
mvtb.heat(covex)               # heat map of the clustered covariance explained matrix
mvtb.cluster(covex)            # clustered covariance explained 

mvtb.nonlin(out,Y=Y,X=X)       # indicators of predictors with nonlinear effects

Tune the model

out2 <- mvtb(Y=Y,X=X,
        n.trees=1000, 
        shrinkage=.01,
        interaction.depth=3,
        
        bag.fraction=.5,      # fit each tree to a sub sample of this fraction
        train.fraction=.5,    # only fit the model to this fraction of the data set
        cv.folds=3,           # number of cross-validation folds
        mc.cores=3)           # run the cross-validation in parallel (not tested on windows)

Vignettes

vignette("mvtboost_vignette")
vignette("mvtboost_wellbeing")

Copy Link

Version

Install

install.packages('mvtboost')

Monthly Downloads

46

Version

0.5.0

License

GPL (>= 2) | file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

December 5th, 2016

Functions in mvtboost (0.5.0)

colorRampPaletteAlpha

Add alpha and ramps between colors
addalpha

Add alpha
mvtb.perspec

Perspective plot for 2 predictors and 1 response.
mvtb.covex

Estimate the covariance explained matrix
mvtb.nonlin

Detect departures from linearity from a multivariate tree boosting model.
mvtb.cluster

Clustering the covariance explained or relative influence matrix
mvtb.ri

Computes the relative influence of each predictor for each outcome
mvtb.uncomp

Uncompress a compressed mvtb output object
mvtb.heat

Clustered heatmap of tables from mvtb
mvtb

Fitting a Multivariate Tree Boosting Model
print.mvtb

Simple default printing of the mvtb output object
plot.mvtb

Plots the model implied effect of 1 predictor for one outcome
mvtboost-package

\Sexpr[results=rd,stage=build]{tools:::Rd_package_title("#1")}mvtboostTree Boosting for Multivariate Outcomes
predict.mvtb

Predicted values
summary.mvtb

Computes a summary of the multivariate tree boosting model
wellbeing

Psychological well-being