Multivariate regression tree with "mvpart" (in R) and plots for each leaf of the tree visualization

59 Views Asked by At

I want to perform an MVRT to understand how some abiotic factors affect the cover percentage of different benthic species. So, I used the 'mvpart' package in R version 3.2.5, as it is not possible to use it in newer versions of R. Here is the code used:

geral = read.csv("MVRT.csv", 
               sep = ";", dec = ".")
ambient=geral[,2:15] 
percent=geral[,16:93]
attach(percent)
attach(ambient)
library(mvpart)
fit3=mvpart(data.matrix(percent)~CHL + TSS + DaySST + HFLUX + PhRAD + EWIND + NWIND +  HWF,
           percent,xv="pick",xval=10, xvmult=500, pca=TRUE) 
summary(fit3)

I got the following output: enter image description here

So, my question is:

  1. How to make separate (and better) bar plots for each tree leaf?

  2. Also, I want to create a better tree with the MVPARTwrap, but it is not possible in R version 3.2.5. Is there any other way to do that? The code that I was going to use with MVPARTwrap:

install.packages("C:/Users/fabio/Downloads/MVPARTwrap_0.1-9.1.tar.gz", 
repos = NULL, type = "source")
require(MVPARTwrap)
hist(residuals(fit3), col="grey")
fit3$where
(group.mrt = levels(as.factor(fit3$where))) 
mrteste = MRT(fit3, percent = 10)
summary.MRT(mrteste)
plot(mrteste)

For the second question, I downloaded the MVPARTwrap package and tried to install it manually, but encountered this error message:

install.packages("C:/Users/fabio/Downloads/MVPARTwrap_0.1-9.1.tar.gz",

  • repos = NULL, type = "source") Installing package into ‘C:/Users/fabio/Documents/R/win-library/3.2’ (as ‘lib’ is unspecified) ERROR: dependencies 'Hmisc', 'vegan', 'fBasics', 'ade4' are not available for package 'MVPARTwrap'
  • removing 'C:/Users/fabio/Documents/R/win-library/3.2/MVPARTwrap' Warning in install.packages : running command '"C:/PROGRA~1/R/R-32~1.5/bin/x64/R" CMD INSTALL -l "C:\Users\fabio\Documents\R\win-library\3.2" "C:/Users/fabio/Downloads/MVPARTwrap_0.1-9.1.tar.gz"' had status 1 Warning in install.packages : installation of package ‘C:/Users/fabio/Downloads/MVPARTwrap_0.1-9.1.tar.gz’ had non-zero exit status
0

There are 0 best solutions below