hier.part: Goodness of Fit Calculation and Hierarchical Partitioning

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/hier.part.R

Description

Partitions variance in a multivariate dataset

Usage

1
2
hier.part(y, xcan, family = "gaussian", gof = "RMSPE",
          barplot = TRUE)

Arguments

y

a vector containing the dependent variables

xcan

a dataframe containing the n independent variables

family

family argument of glm

gof

Goodness-of-fit measure. Currently "RMSPE", Root-mean-square 'prediction' error, "logLik", Log-Likelihood or "Rsqu", R-squared

barplot

If TRUE, a barplot of I and J for each variable is plotted expressed as percentage of total explained variance.

Details

This function calculates goodness of fit measures for the entire hierarchy of models using all combinations of N independent variables using the function all.regs. It 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 simple table listing each variable, its independent contribution (I) and its conjoint contribution with all other variables (J).

Note earlier versions of hier.part (<1.0) produced a matrix and barplot of percentage distribution of effects as a percentage of the sum of all Is and Js, as portrayed in Hatt et al. (2004) and Walsh et al. (2004). This version plots the percentage distribution of independent effects only. The sum of Is equals the goodness of fit measure of the full model minus the goodness of fit measure 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).

At this stage, the partition routine will not run for more than 12 independent variables. This function requires the gtools package in the gregmisc bundle.

Value

a list containing

gfs

a data frame or vector listing all combinations of independent variables in the first column in ascending order, and the corresponding goodness of fit measure for the model using those variables

IJ

a data frame of I, the independent and J the joint contribution for each independent variable

I.perc

a data frame of I as a percentage of total explained variance

Note

The function produces a minor rounding error for analyses with more than than 9 independent variables. To check if this error affects the inference from an analysis, run the analysis several times with the variables entered in a different order. There are no known problems for analyses with 9 or fewer variables.

Author(s)

Chris Walsh [email protected] using c and fortran code written by Ralph Mac Nally [email protected].

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, in south-eastern Australia. Biodiversity and Conservation 13, 781–793.

See Also

all.regs, partition, rand.hp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
    #linear regression of log(electrical conductivity) in 
    #streams against seven independent variables 
    #describing catchment characteristics (from
    #Hatt et al. 2004)

    data(urbanwq)
    env <- urbanwq[,2:8]
    hier.part(urbanwq$lec, env, fam = "gaussian", gof = "Rsqu")

    #logistic regression of an amphipod species occurrence in
    #streams against four independent variables describing
    #catchment characteristics (from Walsh et al. 2004).

    data(amphipod)
    env1 <- amphipod[,2:5]
    hier.part(amphipod$australis, env1, fam = "binomial",
              gof = "logLik")

Example output

Loading required package: gtools
$gfs
  [1] 0.00000000 0.59047318 0.82682075 0.01098174 0.39635905 0.12282709
  [7] 0.62445471 0.33033972 0.83410378 0.59758915 0.62061433 0.65284362
 [13] 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
 [25] 0.66503431 0.52650125 0.67608730 0.43330271 0.64633406 0.83447868
 [31] 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
 [43] 0.66312305 0.82026934 0.82691040 0.84141253 0.87751308 0.84785650
 [49] 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
 [61] 0.73969961 0.53654123 0.68316625 0.67713148 0.83451931 0.84541929
 [67] 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
 [79] 0.66414800 0.85116957 0.78348135 0.66312339 0.82956916 0.85200153
 [85] 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
 [97] 0.82521005 0.77285776 0.74013871 0.84631087 0.88052535 0.85779318
[103] 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
[115] 0.87916623 0.85818567 0.89224695 0.89515882 0.88779139 0.83642968
[121] 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
                  I
fimp      17.734548
sconn     32.073905
sdensep    2.313983
unsealden 10.164829
fcarea     3.996234
selev     23.902006
amgeast    9.814495

$gfs
 [1] -36.68245 -30.29727 -25.58116 -36.31127 -31.24099 -25.53568 -28.91701
 [8] -29.44569 -24.13048 -25.02936 -31.21361 -23.40491 -24.66242 -28.49188
[15] -23.40579 -23.17074

$IJ
              I          J      Total
fimp   2.742498  3.6426854  6.3851833
fconn  7.543709  3.5575841 11.1012927
densep 1.096251 -0.7250743  0.3711766
unseal 2.129250  3.3122091  5.4414589

$I.perc
               I
fimp   20.297197
fconn  55.830906
densep  8.113341
unseal 15.758555

hier.part documentation built on May 29, 2017, 7:12 p.m.