hier.part: Goodness of Fit Calculation and Hierarchical Partitioning
链接:hier.part包介绍
This function calculates goodness-of-fit measures for the full hierarchy of models using all combinations of N predictor variables using the function all.regs. The function takes the list of goodness-of-fit measures and, using the partition function, applies the hierarchical partitioning algorithm of Chevan and Sutherland (1991) to return a table listing each predictor, its independent contribution (I) and its conjoint contribution with all other variables (J), which cannot be ascribed separately to any one predictor.
注意:The distribution of joint effects shows the relative contribution of each variable to shared variability in the full model. Negative joint effects are possible for variables that act as 'suppressors' of other variables (Chevan and Sutherland 1991).
Earlier versions of the hier.part package (<1.0) produced a matrix and barplot of percentage distribution of effects as a percentage of the sum of all Is and Js, as shown in Hatt et al. (2004) and Walshet al. (2004). The current version plots the percentage distribution of independent effects only(目前的版本只显示独立影响的比例条形图). The sum of Is equals the goodness-of-fit measure for the full model less the goodness-of-fit value of the null model.
The distribution of joint effects shows the relative contribution of each variable to shared variability in the full model. Negative joint effects are possible for variables that act as ’suppressors’ of other variables (Chevan and Sutherland 1991). The partition routine will not run for more than 12 predictors, but data sets with more than this number of predictors are unlikely to identify ’important’ predictors.
使用
#linear regression of log(electrical conductivity) in
#streams against seven predictor variables
#describing catchment characteristics (from Hatt et al. 2004)
install.packages("hier.part") #安装包
library(hier.part) #加载包
data(urbanwq) #加载数据
env <- urbanwq[,2:8] #选择数据列,分离数据列的选择方法 env1 <- env[c(11,21,9,27,28,30)]
hier.part(urbanwq$lec, env, fam = "gaussian", gof = "Rsqu") #计算
结果
> hier.part(urbanwq$lec, env, fam = "gaussian", gof = "Rsqu")
$gfs
[1] 0.00000000 0.59047318 0.82682075 0.01098174 0.39635905 0.12282709 0.62445471 0.33033972 0.83410378
[10] 0.59758915 0.62061433 0.65284362 0.77159448 0.60702109 0.82683793 0.82691037 0.83582029 0.85403927
[19] 0.84727070 0.41798147 0.13980912 0.76026824 0.33080645 0.39744819 0.66503431 0.52650125 0.67608730
[28] 0.43330271 0.64633406 0.83447868 0.83411192 0.83965414 0.85551898 0.84727151 0.62061622 0.65949970
[37] 0.82672399 0.62672410 0.65445206 0.77226833 0.62512912 0.77811174 0.66312305 0.82026934 0.82691040
[46] 0.84141253 0.87751308 0.84785650 0.83932285 0.85513956 0.84985538 0.85490360 0.85107746 0.87685251
[55] 0.43348171 0.81801707 0.55827372 0.76851361 0.50536622 0.77107209 0.73969961 0.53654123 0.68316625
[64] 0.67713148 0.83451931 0.84541929 0.87865868 0.84793008 0.84176310 0.85633390 0.85010056 0.85662169
[73] 0.85116200 0.88236321 0.66297682 0.84039075 0.62908864 0.82701685 0.66414800 0.85116957 0.78348135
[82] 0.66312339 0.82956916 0.85200153 0.84338543 0.87900342 0.85317612 0.87755498 0.85162358 0.89200389
[91] 0.85535421 0.85816222 0.88318976 0.88611089 0.83628377 0.61132790 0.82521005 0.77285776 0.74013871
[100] 0.84631087 0.88052535 0.85779318 0.87866729 0.85162457 0.89525987 0.85679323 0.86058475 0.89708584
[109] 0.89557323 0.84575908 0.66461591 0.85137732 0.86367597 0.85322499 0.87916623 0.85818567 0.89224695
[118] 0.89515882 0.88779139 0.83642968 0.88093891 0.86223879 0.89900950 0.90101494 0.90231612 0.86447417
[127] 0.89516613 0.90324171
$IJ
I J Total
fimp 0.16018583 0.430287348 0.59047318
sconn 0.28970489 0.537115864 0.82682075
sdensep 0.02090086 -0.009919125 0.01098174
unsealden 0.09181298 0.304546072 0.39635905
fcarea 0.03609565 0.086731439 0.12282709
selev 0.21589289 0.408561821 0.62445471
amgeast 0.08864861 0.241691110 0.33033972
$I.perc
ind.exp.var
fimp 17.734548
sconn 32.073905
sdensep 2.313983
unsealden 10.164829
fcarea 3.996234
selev 23.902006
amgeast 9.814495
$params
$params$full.model
[1] "y ~ fimp + sconn + sdensep + unsealden + fcarea + selev + amgeast"
$params$family
[1] "gaussian"
$params$link
[1] "default"
$params$gof
[1] "Rsqu"
References
Chevan, A. and Sutherland, M. 1991 Hierarchical Partitioning. The American Statistician 45, 90–96. Hatt, B. E., Fletcher, T. D., Walsh, C. J. and Taylor, S. L. 2004 The influence of urban density and drainage infrastructure on the concentrations and loads of pollutants in small streams. Environmental Management 34, 112–124.
Mac Nally, R. 2000 Regression and model building in conservation biology, biogeography and ecology: the distinction between and reconciliation of ’predictive’ and ’explanatory’ models. Biodiversity and Conservation 9, 655–671.
Walsh, C. J., Papas, P. J., Crowther, D., Sim, P. T., and Yoo, J. 2004 Stormwater drainage pipes as a threat to a stream-dwelling amphipod of conservation significance, Austrogammarus australis, insouth-eastern Australia. Biodiversity and Conservation 13, 781–793.
此外:
小白鱼的生统笔记: 使用hier.part包做层次分割(HP)在广义线性模型中分解变量贡献及重要变量识别