all.regs: Goodness of Fit Measures for a Regression Hierarchy

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

View source: R/hier.part.R

Description

Calculates goodness of fit measures for regressions of a single dependent variable to all combinations of N independent variables

Usage

1
2
all.regs(y, xcan, family = "gaussian", gof = "RMSPE",
         print.vars = FALSE)

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

print.vars

if FALSE, the function returns a vector of goodness-of-fit measures. If TRUE, a data frame is returned with first column listing variable combinations and the second column listing goodness-of-fit measures.

Details

This function calculates goodness of fit measures for the entire hierarchy of models using all combinations of N dependent variables, and returns them as an ordered list ready for input into the function partition. This function requires the gtools package in the gregmisc bundle

Value

gfs

If print.vars is FALSE, a vector of goodness of fit measures for all combinations of independent varaiables in the hierarchy or, if print.vars is TRUE, 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

Author(s)

Chris Walsh [email protected].

References

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.

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

See Also

hier.part, 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]
    all.regs(urbanwq$lec, env, fam = "gaussian", gof = "Rsqu",
             print.vars = TRUE)

    #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]
    all.regs(amphipod$australis, env1, fam = "binomial",
             gof = "logLik", print.vars = TRUE)

Example output

Loading required package: gtools
regressions done: formatting results
                                  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
regressions done: formatting results
        variable.combination       gof
1                      Theta -36.68245
2                      fimp  -30.29727
3                     fconn  -25.58116
4                    densep  -36.31127
5                    unseal  -31.24099
6                fimp fconn  -25.53568
7               fimp densep  -28.91701
8               fimp unseal  -29.44569
9              fconn densep  -24.13048
10             fconn unseal  -25.02936
11            densep unseal  -31.21361
12        fimp fconn densep  -23.40491
13        fimp fconn unseal  -24.66242
14       fimp densep unseal  -28.49188
15      fconn densep unseal  -23.40579
16 fimp fconn densep unseal  -23.17074

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