Alice Eldridge
2017-Jul-11 14:29 UTC
[R] Multivariate random forests in R - how to obtain variance explained for multiple responses in randomForestSRC package - or other package
Hello, I am wanting to use MRF to do multivariate regression. We are testing whether acoustic indices can predict structure (relative abundances) of vocalising avian community in UK and Ecuador. There are 26 acoustic indices, 65 UK species and 95 Ecuadorian species. I want to build a model for each ecozone (UK/ EC) using all species (relative abundance) as response matrix, and acoustic indices as predictors. I?d then like to know: - total variance explained & error - variable importance (stable rank at least) - proximity matrix The interface for package randomForestSRC looks hopeful. You can specify a MRF like this:> rfsrc(Multivar(y1, y2, ..., yd) ~ . , my.data, ?)So for a data matrix containing 1984 observations of 26 Acoustic indices and 65 species (UN. CG etc) - uk_ai_sp - It seems you can build a multivariate regression model like this:> uk_sp_ai.mrf <-rfsrc(Multivar(UN,CG,ZL,ML,MH,H.,PH,IP,RL,WK,CO,BZ,L,HG,LB,BO,TO.,SD,WP,CD,TD,CK,G.,GS,MG,J,JD,RN,RO,C.,GC,BT,GT,CT,MT,S.,SL,LT,CC,WW,BC,GW,LW,WH,RW,NH,TC,WR,SG,B.,ST,M.,SF,R,NG,DN,PW,MP,CH,GR,GO,BF,LN,Y,CB.) ~., data = uk_ai_sp, tree.err=TRUE, importance = "permute")The model report looks sensible:>uk_sp_ai.mrfSample size: 1984 Number of trees: 1000 Minimum terminal node size: 5 Average no. of terminal nodes: 506.754 No. of variables tried at each split: 9 Total no. of variables: 26 Total no. of responses: 65 User has requested response: UN Analysis: mRF-R Family: regr+ Splitting rule: mv.mse % variance explained: 72.46 Error rate: 0.02 But I can?t see how to request the output (% variance explained and error) for all 65 responses ? only one response at a time (here UN) If anyone has any experience of this package ? or how to achieve this in other packages I?d love to hear from you. Hopefully I am missing something obvious. Cheers, Alice --- Dr Alice Eldridge Research Fellow Sussex Humanities Lab, School of Media, Film and Music University of Sussex Falmer Brighton BN1 9RG alicee at sussex.ac.uk<mailto:alicee at sussex.ac.uk> +44 (0) 1273 87 7486 http://www.algorithmiclistening.org/ [[alternative HTML version deleted]]