partition: Hierarchical Partitioning from a List of Goodness of Fit...

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 from a list of goodness of fit measures

Usage

1
partition(gfs, pcan, var.names = NULL)

Arguments

gfs

an array as outputted by the function all.regs or a vector of goodness of fit measures from a hierarchy of regressions based on pcan variables in ascending order (as produced by function combos, but also including the null model as the first element)

pcan

the number of variables from which the hierarchy was constructed (maximum = 12)

var.names

an array of pcan variable names, if required

Details

This function applies the hierarchical partitioning algorithm of Chevan and Sutherland (1991) to return a simple table listing of each variable, its independent contribution (I) and its conjoint contribution with all other variables (J). The output is identical to the function hier.part, which takes the dependent and independent variable data as its input.

Note earlier versions of partition (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 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

J.perc

a data frame of J as a percentage of sum of all Js

Note

The function produces a minor rounding error for hierarchies constructed from more than 9 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 hierarchies 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.

See Also

all.regs, partition, rand.hp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
    #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]
    gofs <- all.regs(urbanwq$lec, env, fam = "gaussian",
    gof = "Rsqu", print.vars = TRUE)
    partition(gofs, pcan = 7, var.names = names(urbanwq[,2,8]))

    #hierarchical partitioning of logistic and linear regression
    #goodness of fit measures from Chevan and Sutherland (1991).

    data(chevan)
    partition(chevan$chisq, pcan = 4)
    partition(chevan$rsqu, pcan = 4)

Example output

Loading required package: gtools
regressions done: formatting results
$gfs
                                  variable.combination        gof
1                                                Theta 0.00000000
2                                                fimp  0.59047318
3                                               sconn  0.82682075
4                                             sdensep  0.01098174
5                                           unsealden  0.39635905
6                                              fcarea  0.12282709
7                                               selev  0.62445471
8                                             amgeast  0.33033972
9                                          fimp sconn  0.83410378
10                                       fimp sdensep  0.59758915
11                                     fimp unsealden  0.62061433
12                                        fimp fcarea  0.65284362
13                                         fimp selev  0.77159448
14                                       fimp amgeast  0.60702109
15                                      sconn sdensep  0.82683793
16                                    sconn unsealden  0.82691037
17                                       sconn fcarea  0.83582029
18                                        sconn selev  0.85403927
19                                      sconn amgeast  0.84727070
20                                  sdensep unsealden  0.41798147
21                                     sdensep fcarea  0.13980912
22                                      sdensep selev  0.76026824
23                                    sdensep amgeast  0.33080645
24                                   unsealden fcarea  0.39744819
25                                    unsealden selev  0.66503431
26                                  unsealden amgeast  0.52650125
27                                       fcarea selev  0.67608730
28                                     fcarea amgeast  0.43330271
29                                      selev amgeast  0.64633406
30                                 fimp sconn sdensep  0.83447868
31                               fimp sconn unsealden  0.83411192
32                                  fimp sconn fcarea  0.83965414
33                                   fimp sconn selev  0.85551898
34                                 fimp sconn amgeast  0.84727151
35                             fimp sdensep unsealden  0.62061622
36                                fimp sdensep fcarea  0.65949970
37                                 fimp sdensep selev  0.82672399
38                               fimp sdensep amgeast  0.62672410
39                              fimp unsealden fcarea  0.65445206
40                               fimp unsealden selev  0.77226833
41                             fimp unsealden amgeast  0.62512912
42                                  fimp fcarea selev  0.77811174
43                                fimp fcarea amgeast  0.66312305
44                                 fimp selev amgeast  0.82026934
45                            sconn sdensep unsealden  0.82691040
46                               sconn sdensep fcarea  0.84141253
47                                sconn sdensep selev  0.87751308
48                              sconn sdensep amgeast  0.84785650
49                             sconn unsealden fcarea  0.83932285
50                              sconn unsealden selev  0.85513956
51                            sconn unsealden amgeast  0.84985538
52                                 sconn fcarea selev  0.85490360
53                               sconn fcarea amgeast  0.85107746
54                                sconn selev amgeast  0.87685251
55                           sdensep unsealden fcarea  0.43348171
56                            sdensep unsealden selev  0.81801707
57                          sdensep unsealden amgeast  0.55827372
58                               sdensep fcarea selev  0.76851361
59                             sdensep fcarea amgeast  0.50536622
60                              sdensep selev amgeast  0.77107209
61                             unsealden fcarea selev  0.73969961
62                           unsealden fcarea amgeast  0.53654123
63                            unsealden selev amgeast  0.68316625
64                               fcarea selev amgeast  0.67713148
65                       fimp sconn sdensep unsealden  0.83451931
66                          fimp sconn sdensep fcarea  0.84541929
67                           fimp sconn sdensep selev  0.87865868
68                         fimp sconn sdensep amgeast  0.84793008
69                        fimp sconn unsealden fcarea  0.84176310
70                         fimp sconn unsealden selev  0.85633390
71                       fimp sconn unsealden amgeast  0.85010056
72                            fimp sconn fcarea selev  0.85662169
73                          fimp sconn fcarea amgeast  0.85116200
74                           fimp sconn selev amgeast  0.88236321
75                      fimp sdensep unsealden fcarea  0.66297682
76                       fimp sdensep unsealden selev  0.84039075
77                     fimp sdensep unsealden amgeast  0.62908864
78                          fimp sdensep fcarea selev  0.82701685
79                        fimp sdensep fcarea amgeast  0.66414800
80                         fimp sdensep selev amgeast  0.85116957
81                        fimp unsealden fcarea selev  0.78348135
82                      fimp unsealden fcarea amgeast  0.66312339
83                       fimp unsealden selev amgeast  0.82956916
84                          fimp fcarea selev amgeast  0.85200153
85                     sconn sdensep unsealden fcarea  0.84338543
86                      sconn sdensep unsealden selev  0.87900342
87                    sconn sdensep unsealden amgeast  0.85317612
88                         sconn sdensep fcarea selev  0.87755498
89                       sconn sdensep fcarea amgeast  0.85162358
90                        sconn sdensep selev amgeast  0.89200389
91                       sconn unsealden fcarea selev  0.85535421
92                     sconn unsealden fcarea amgeast  0.85816222
93                      sconn unsealden selev amgeast  0.88318976
94                         sconn fcarea selev amgeast  0.88611089
95                     sdensep unsealden fcarea selev  0.83628377
96                   sdensep unsealden fcarea amgeast  0.61132790
97                    sdensep unsealden selev amgeast  0.82521005
98                       sdensep fcarea selev amgeast  0.77285776
99                     unsealden fcarea selev amgeast  0.74013871
100               fimp sconn sdensep unsealden fcarea  0.84631087
101                fimp sconn sdensep unsealden selev  0.88052535
102              fimp sconn sdensep unsealden amgeast  0.85779318
103                   fimp sconn sdensep fcarea selev  0.87866729
104                 fimp sconn sdensep fcarea amgeast  0.85162457
105                  fimp sconn sdensep selev amgeast  0.89525987
106                 fimp sconn unsealden fcarea selev  0.85679323
107               fimp sconn unsealden fcarea amgeast  0.86058475
108                fimp sconn unsealden selev amgeast  0.89708584
109                   fimp sconn fcarea selev amgeast  0.89557323
110               fimp sdensep unsealden fcarea selev  0.84575908
111             fimp sdensep unsealden fcarea amgeast  0.66461591
112              fimp sdensep unsealden selev amgeast  0.85137732
113                 fimp sdensep fcarea selev amgeast  0.86367597
114               fimp unsealden fcarea selev amgeast  0.85322499
115              sconn sdensep unsealden fcarea selev  0.87916623
116            sconn sdensep unsealden fcarea amgeast  0.85818567
117             sconn sdensep unsealden selev amgeast  0.89224695
118                sconn sdensep fcarea selev amgeast  0.89515882
119              sconn unsealden fcarea selev amgeast  0.88779139
120            sdensep unsealden fcarea selev amgeast  0.83642968
121         fimp sconn sdensep unsealden fcarea selev  0.88093891
122       fimp sconn sdensep unsealden fcarea amgeast  0.86223879
123        fimp sconn sdensep unsealden selev amgeast  0.89900950
124           fimp sconn sdensep fcarea selev amgeast  0.90101494
125         fimp sconn unsealden fcarea selev amgeast  0.90231612
126       fimp sdensep unsealden fcarea selev amgeast  0.86447417
127      sconn sdensep unsealden fcarea selev amgeast  0.89516613
128 fimp sconn sdensep unsealden fcarea selev amgeast  0.90324171

$IJ
           I            J      Total
1 0.16018583  0.430287348 0.59047318
2 0.28970489  0.537115864 0.82682075
3 0.02090086 -0.009919125 0.01098174
4 0.09181298  0.304546072 0.39635905
5 0.03609565  0.086731439 0.12282709
6 0.21589289  0.408561821 0.62445471
7 0.08864861  0.241691110 0.33033972

$I.perc
          I
1 17.734548
2 32.073905
3  2.313983
4 10.164829
5  3.996234
6 23.902006
7  9.814495

$gfs
 [1] 207.5 191.6 113.8  68.5 185.5 104.4  58.6 173.3  27.7 104.8  53.4  20.2
[13]  97.0  46.3  19.3  13.6

$IJ
            I          J  Total
1   -9.891667  -6.008333  -15.9
2  -61.391667 -32.308333  -93.7
3 -109.591667 -29.408333 -139.0
4  -13.025000  -8.975000  -22.0

$I.perc
          I
1  5.101427
2 31.661509
3 56.519684
4  6.717380

$gfs
 [1] 0.000 0.010 0.060 0.086 0.014 0.065 0.090 0.022 0.107 0.065 0.094 0.110
[13] 0.070 0.097 0.111 0.114

$IJ
            I           J Total
1 0.005583333 0.004416667 0.010
2 0.036916667 0.023083333 0.060
3 0.063583333 0.022416667 0.086
4 0.007916667 0.006083333 0.014

$I.perc
          I
1  4.897661
2 32.383041
3 55.774854
4  6.944444

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