The goal of etree is to provide a friendly implementation of Energy Trees, a model for classification and regression with structured and mixed-type data. The package currently cover functions and graphs as structured covariates.
You can install the development version of etree from GitHub with:
# install.packages("devtools")
::install_github("ricgbl/etree") devtools
This is a basic example which shows how to fit an Energy Tree for regression using a toy dataset with four covariates of different types: numeric, nominal, functional, and in the form of graphs.
library(etree)
# Covariates
<- 100
nobs <- rnorm(nobs)
cov_num <- factor(rbinom(nobs, size = 1, prob = 0.5))
cov_nom <- lapply(1:nobs, function(j) igraph::sample_gnp(100, 0.2))
cov_gph <- fda.usc::rproc2fdata(nobs, seq(0, 1, len = 100), sigma = 1)
cov_fun <- list(cov_num, cov_nom, cov_gph, cov_fun)
cov_list
# Response variable
<- cov_num ^ 2
resp_reg
# Energy Tree fit
<- etree(response = resp_reg,
etree_fit covariates = cov_list)
#> Warning: executing %dopar% sequentially: no parallel backend registered
#> Warning in .create_newcov(covariates = covariates, response = response, : No
#> names available for covariates. Numbers are used instead.
Additional and more complex examples can be found in the package’s vignettes.