0

I know this is quite a basic question and I've checked some related posts on stackoverflow after looking for tutorials/articles explaining what I'm looking for, but so far I did not really get all my points answered.

I did field measurements of different ecological response variables and now have to identify the factors which have a significant influence. For example, I measured bait consumption by soil fauna. I did this on a total of 24 plots (2 regions * 2 elevation levels * 2 expositions (North/South) * 3 plot replicates). Apart from these factors (region/elevation/exposition), I measured some soil properties and extracted climate data from an already existing grid. To reduce the complexity of my soil and climate data, I've done a co-inertia analysis, telling me that soil & climate data do not seem to be significantly correlated. I thus did each a PCA for my soil and my climate data & extracted the first 2 dimensions.

Now, as the residuals of my bait consumption data are not normally distributed, I'm doing a GLM (for other analysis where ND is not violated, I'll do ANOVAs). However, I get myself kind of lost in the process of comparing different GLMs and choosing the most appropriate one.

I started off as follows:

baits.glm0 <- glm(consumption ~ 1, data = baits.stick.means, 
              family = poisson)
baits.glm1 <- glm(consumption ~ region + exposition + 
                  elevation_level, data = baits.stick.means, 
                  family = poisson)
anova(baits.glm0, baits.glm1, test = "Chisq")

This tells me that including above factors indeed helps in explaining consumption, right. But: how do I continue in adding the other factors (climate_pca1/climate_pca2, soil_pca1/soil_pca2)? I mean there are many different possibilities which factors I add first, which I leave out, do I allow for interactions between e.g. region and exposition, etc ... I can't simply construct different models and look at their AIC, since I get "Inf" for latter, due to the number of factor levels I assume.

So, how would the correct procedure/comparison method be in this case?

Data subset in case it is helpful:

structure(list(stick_number = c(219L, 284L, 62L, 254L, 233L, 
187L, 157L, 339L, 57L, 39L, 347L, 340L, 77L, 191L, 321L, 218L, 
82L, 153L, 334L, 230L, 194L, 358L, 336L, 78L, 121L, 210L, 224L, 
322L, 239L, 83L, 344L, 117L, 204L, 182L, 236L, 306L, 42L, 5L, 
112L, 92L, 225L, 32L, 50L, 328L, 359L, 151L, 71L, 30L, 162L, 
13L, 111L, 104L, 206L, 296L, 173L, 283L, 228L, 293L, 86L, 256L, 
186L, 241L, 264L, 222L, 287L, 143L, 342L, 158L, 266L, 68L, 118L, 
156L, 277L, 12L, 8L, 281L, 172L, 259L, 127L, 267L, 6L, 81L, 341L, 
327L, 51L, 53L, 31L, 60L, 89L, 308L, 352L, 134L, 64L, 310L, 67L, 
302L, 74L, 141L, 268L, 276L), plot_id = c("VSH3", "TSH1", "VNM2", 
"VNH2", "VNH1", "VSH1", "TNM2", "TNH2", "VNM1", "VSM3", "TNH3", 
"TNH2", "VNM3", "VSH1", "TNH1", "VSH3", "VNM3", "TNM2", "TNH2", 
"VNH1", "VSH1", "TNH3", "TNH2", "VNM3", "TSM3", "VSH2", "VSH3", 
"TNH1", "VNH1", "VNM3", "TNH2", "TSM2", "VSH2", "VSH1", "VNH1", 
"TSH3", "VSM3", "VSM1", "TSM2", "TSM1", "VSH3", "VSM3", "VNM1", 
"TNH1", "TNH3", "TNM2", "VNM2", "VSM2", "TNM2", "VSM1", "TSM2", 
"TSM1", "VSH2", "TSH2", "TNM3", "TSH1", "VNH1", "TSH2", "VNM3", 
"VNH3", "VSH1", "VNH2", "VNH3", "VSH3", "TSH2", "TNM1", "TNH2", 
"TNM2", "VNH3", "VNM2", "TSM2", "TNM2", "TSH1", "VSM1", "VSM1", 
"TSH1", "TNM3", "VNH3", "TSM3", "VNH3", "VSM1", "VNM3", "TNH2", 
"TNH1", "VNM1", "VNM1", "VSM3", "VNM1", "VNM3", "TSH3", "TNH3", 
"TSM3", "VNM2", "TSH3", "VNM2", "TSH3", "VNM2", "TNM1", "VNH3", 
"TSH1"), site = c("VSH", "TSH", "VNM", "VNH", "VNH", "VSH", "TNM", 
"TNH", "VNM", "VSM", "TNH", "TNH", "VNM", "VSH", "TNH", "VSH", 
"VNM", "TNM", "TNH", "VNH", "VSH", "TNH", "TNH", "VNM", "TSM", 
"VSH", "VSH", "TNH", "VNH", "VNM", "TNH", "TSM", "VSH", "VSH", 
"VNH", "TSH", "VSM", "VSM", "TSM", "TSM", "VSH", "VSM", "VNM", 
"TNH", "TNH", "TNM", "VNM", "VSM", "TNM", "VSM", "TSM", "TSM", 
"VSH", "TSH", "TNM", "TSH", "VNH", "TSH", "VNM", "VNH", "VSH", 
"VNH", "VNH", "VSH", "TSH", "TNM", "TNH", "TNM", "VNH", "VNM", 
"TSM", "TNM", "TSH", "VSM", "VSM", "TSH", "TNM", "VNH", "TSM", 
"VNH", "VSM", "VNM", "TNH", "TNH", "VNM", "VNM", "VSM", "VNM", 
"VNM", "TSH", "TNH", "TSM", "VNM", "TSH", "VNM", "TSH", "VNM", 
"TNM", "VNH", "TSH"), region = c("valais", "ticino", "valais", 
"valais", "valais", "valais", "ticino", "ticino", "valais", "valais", 
"ticino", "ticino", "valais", "valais", "ticino", "valais", "valais", 
"ticino", "ticino", "valais", "valais", "ticino", "ticino", "valais", 
"ticino", "valais", "valais", "ticino", "valais", "valais", "ticino", 
"ticino", "valais", "valais", "valais", "ticino", "valais", "valais", 
"ticino", "ticino", "valais", "valais", "valais", "ticino", "ticino", 
"ticino", "valais", "valais", "ticino", "valais", "ticino", "ticino", 
"valais", "ticino", "ticino", "ticino", "valais", "ticino", "valais", 
"valais", "valais", "valais", "valais", "valais", "ticino", "ticino", 
"ticino", "ticino", "valais", "valais", "ticino", "ticino", "ticino", 
"valais", "valais", "ticino", "ticino", "valais", "ticino", "valais", 
"valais", "valais", "ticino", "ticino", "valais", "valais", "valais", 
"valais", "valais", "ticino", "ticino", "ticino", "valais", "ticino", 
"valais", "ticino", "valais", "ticino", "valais", "ticino"), 
    exposition = c("south", "south", "north", "north", "north", 
    "south", "north", "north", "north", "south", "north", "north", 
    "north", "south", "north", "south", "north", "north", "north", 
    "north", "south", "north", "north", "north", "south", "south", 
    "south", "north", "north", "north", "north", "south", "south", 
    "south", "north", "south", "south", "south", "south", "south", 
    "south", "south", "north", "north", "north", "north", "north", 
    "south", "north", "south", "south", "south", "south", "south", 
    "north", "south", "north", "south", "north", "north", "south", 
    "north", "north", "south", "south", "north", "north", "north", 
    "north", "north", "south", "north", "south", "south", "south", 
    "south", "north", "north", "south", "north", "south", "north", 
    "north", "north", "north", "north", "south", "north", "north", 
    "south", "north", "south", "north", "south", "north", "south", 
    "north", "north", "north", "south"), elevation_level = c("high", 
    "high", "mid", "high", "high", "high", "mid", "high", "mid", 
    "mid", "high", "high", "mid", "high", "high", "high", "mid", 
    "mid", "high", "high", "high", "high", "high", "mid", "mid", 
    "high", "high", "high", "high", "mid", "high", "mid", "high", 
    "high", "high", "high", "mid", "mid", "mid", "mid", "high", 
    "mid", "mid", "high", "high", "mid", "mid", "mid", "mid", 
    "mid", "mid", "mid", "high", "high", "mid", "high", "high", 
    "high", "mid", "high", "high", "high", "high", "high", "high", 
    "mid", "high", "mid", "high", "mid", "mid", "mid", "high", 
    "mid", "mid", "high", "mid", "high", "mid", "high", "mid", 
    "mid", "high", "high", "mid", "mid", "mid", "mid", "mid", 
    "high", "high", "mid", "mid", "high", "mid", "high", "mid", 
    "mid", "high", "high"), climate_pca1 = c(-1.480220428, -1.828098745, 
    1.770907449, -1.209471355, -1.262109584, -1.575038041, 1.10552354, 
    -2.332118439, 1.922660686, 2.133086246, -2.251591285, -2.332118439, 
    1.843690586, -1.575038041, -2.593633876, -1.480220428, 1.843690586, 
    1.10552354, -2.332118439, -1.262109584, -1.575038041, -2.251591285, 
    -2.332118439, 1.843690586, 2.081946695, -1.354302896, -1.480220428, 
    -2.593633876, -1.262109584, 1.843690586, -2.332118439, 1.88376908, 
    -1.354302896, -1.575038041, -1.262109584, -2.026443343, 2.133086246, 
    2.129010846, 1.88376908, 1.744163466, -1.480220428, 2.133086246, 
    1.922660686, -2.593633876, -2.251591285, 1.10552354, 1.770907449, 
    2.333468357, 1.10552354, 2.129010846, 1.88376908, 1.744163466, 
    -1.354302896, -1.916565298, 1.208123392, -1.828098745, -1.262109584, 
    -1.916565298, 1.843690586, -1.027990027, -1.575038041, -1.209471355, 
    -1.027990027, -1.480220428, -1.916565298, 0.701232975, -2.332118439, 
    1.10552354, -1.027990027, 1.770907449, 1.88376908, 1.10552354, 
    -1.828098745, 2.129010846, 2.129010846, -1.828098745, 1.208123392, 
    -1.027990027, 2.081946695, -1.027990027, 2.129010846, 1.843690586, 
    -2.332118439, -2.593633876, 1.922660686, 1.922660686, 2.133086246, 
    1.922660686, 1.843690586, -2.026443343, -2.251591285, 2.081946695, 
    1.770907449, -2.026443343, 1.770907449, -2.026443343, 1.770907449, 
    0.701232975, -1.027990027, -1.828098745), climate_pca2 = c(-1.923853312, 
    -0.509591235, 0.295280113, 0.197102242, -0.42062989, -1.849214144, 
    2.728812267, 1.351144076, -0.274402516, -1.379004788, 0.77931106, 
    1.351144076, -0.273885517, -1.849214144, 2.40580586, -1.923853312, 
    -0.273885517, 2.728812267, 1.351144076, -0.42062989, -1.849214144, 
    0.77931106, 1.351144076, -0.273885517, -0.018829514, -1.687742087, 
    -1.923853312, 2.40580586, -0.42062989, -0.273885517, 1.351144076, 
    0.016797936, -1.687742087, -1.849214144, -0.42062989, -0.733165106, 
    -1.379004788, -1.358442237, 0.016797936, 0.059349245, -1.923853312, 
    -1.379004788, -0.274402516, 2.40580586, 0.77931106, 2.728812267, 
    0.295280113, -1.376450585, 2.728812267, -1.358442237, 0.016797936, 
    0.059349245, -1.687742087, -0.595492434, 2.621840242, -0.509591235, 
    -0.42062989, -0.595492434, -0.273885517, -0.670404999, -1.849214144, 
    0.197102242, -0.670404999, -1.923853312, -0.595492434, 2.615665322, 
    1.351144076, 2.728812267, -0.670404999, 0.295280113, 0.016797936, 
    2.728812267, -0.509591235, -1.358442237, -1.358442237, -0.509591235, 
    2.621840242, -0.670404999, -0.018829514, -0.670404999, -1.358442237, 
    -0.273885517, 1.351144076, 2.40580586, -0.274402516, -0.274402516, 
    -1.379004788, -0.274402516, -0.273885517, -0.733165106, 0.77931106, 
    -0.018829514, 0.295280113, -0.733165106, 0.295280113, -0.733165106, 
    0.295280113, 2.615665322, -0.670404999, -0.509591235), soil_pca1 = c(-5.56767863419797, 
    1.95393811095034, -0.260227094874325, -1.61085398656141, 
    -1.66958542579672, -0.397280823855903, 3.7169854524207, 1.84352513299293, 
    -0.6551280697025, -6.50320343705425, 2.00291533466174, 1.84352513299293, 
    -0.620445610945974, -0.397280823855903, 2.42091640839051, 
    -5.56767863419797, -0.620445610945974, 3.7169854524207, 1.84352513299293, 
    -1.66958542579672, -0.397280823855903, 2.00291533466174, 
    1.84352513299293, -0.620445610945974, 0.304033246117126, 
    -0.84551981325722, -5.56767863419797, 2.42091640839051, -1.66958542579672, 
    -0.620445610945974, 1.84352513299293, 0.859821441854325, 
    -0.84551981325722, -0.397280823855903, -1.66958542579672, 
    2.52191101044192, -6.50320343705425, -4.58332766496856, 0.859821441854325, 
    1.81674404592665, -5.56767863419797, -6.50320343705425, -0.6551280697025, 
    2.42091640839051, 2.00291533466174, 3.7169854524207, -0.260227094874325, 
    -3.61912580538706, 3.7169854524207, -4.58332766496856, 0.859821441854325, 
    1.81674404592665, -0.84551981325722, 2.72504002601633, 2.85277767098365, 
    1.95393811095034, -1.66958542579672, 2.72504002601633, -0.620445610945974, 
    -0.76015927833061, -0.397280823855903, -1.61085398656141, 
    -0.76015927833061, -5.56767863419797, 2.72504002601633, 4.07392776417628, 
    1.84352513299293, 3.7169854524207, -0.76015927833061, -0.260227094874325, 
    0.859821441854325, 3.7169854524207, 1.95393811095034, -4.58332766496856, 
    -4.58332766496856, 1.95393811095034, 2.85277767098365, -0.76015927833061, 
    0.304033246117126, -0.76015927833061, -4.58332766496856, 
    -0.620445610945974, 1.84352513299293, 2.42091640839051, -0.6551280697025, 
    -0.6551280697025, -6.50320343705425, -0.6551280697025, -0.620445610945974, 
    2.52191101044192, 2.00291533466174, 0.304033246117126, -0.260227094874325, 
    2.52191101044192, -0.260227094874325, 2.52191101044192, -0.260227094874325, 
    4.07392776417628, -0.76015927833061, 1.95393811095034), soil_pca2 = c(-1.20094768276013, 
    -0.81049387016335, 2.4943393252285, 1.57423563197107, 1.44861597315028, 
    2.2610844297929, -0.297648866553386, -2.38340996245776, 2.40878156685994, 
    -2.3823643056849, -2.6231255135526, -2.38340996245776, 2.23860580682454, 
    2.2610844297929, -1.9422384338934, -1.20094768276013, 2.23860580682454, 
    -0.297648866553386, -2.38340996245776, 1.44861597315028, 
    2.2610844297929, -2.6231255135526, -2.38340996245776, 2.23860580682454, 
    -0.828230153957865, 1.8842217721005, -1.20094768276013, -1.9422384338934, 
    1.44861597315028, 2.23860580682454, -2.38340996245776, 1.69610095222163, 
    1.8842217721005, 2.2610844297929, 1.44861597315028, 0.219212508989128, 
    -2.3823643056849, -0.56282968564021, 1.69610095222163, -0.404846537234961, 
    -1.20094768276013, -2.3823643056849, 2.40878156685994, -1.9422384338934, 
    -2.6231255135526, -0.297648866553386, 2.4943393252285, -2.50519920681956, 
    -0.297648866553386, -0.56282968564021, 1.69610095222163, 
    -0.404846537234961, 1.8842217721005, -0.561939092870071, 
    -1.23645258422661, -0.81049387016335, 1.44861597315028, -0.561939092870071, 
    2.23860580682454, 1.62581106228919, 2.2610844297929, 1.57423563197107, 
    1.62581106228919, -1.20094768276013, -0.561939092870071, 
    -0.111283133612885, -2.38340996245776, -0.297648866553386, 
    1.62581106228919, 2.4943393252285, 1.69610095222163, -0.297648866553386, 
    -0.81049387016335, -0.56282968564021, -0.56282968564021, 
    -0.81049387016335, -1.23645258422661, 1.62581106228919, -0.828230153957865, 
    1.62581106228919, -0.56282968564021, 2.23860580682454, -2.38340996245776, 
    -1.9422384338934, 2.40878156685994, 2.40878156685994, -2.3823643056849, 
    2.40878156685994, 2.23860580682454, 0.219212508989128, -2.6231255135526, 
    -0.828230153957865, 2.4943393252285, 0.219212508989128, 2.4943393252285, 
    0.219212508989128, 2.4943393252285, -0.111283133612885, 1.62581106228919, 
    -0.81049387016335), exposure_days = c(21, 19, 20, 20, 20, 
    21, 20, 20, 20, 19, 20, 20, 20, 21, 20, 21, 20, 20, 20, 20, 
    21, 20, 20, 20, 19, 21, 21, 20, 20, 20, 20, 19, 21, 21, 20, 
    19, 19, 19, 19, 19, 21, 19, 20, 20, 20, 20, 20, 19, 20, 19, 
    19, 19, 21, 19, 20, 19, 20, 19, 20, 20, 21, 20, 20, 21, 19, 
    20, 20, 20, 20, 20, 19, 20, 19, 19, 19, 19, 20, 20, 19, 20, 
    19, 20, 20, 20, 20, 20, 19, 20, 20, 19, 20, 19, 20, 19, 20, 
    19, 20, 20, 20, 19), consumption = c(0.065625, 0, 0.3125, 
    0.34375, 0.175, 0.184375, 0.453125, 0.0192307692307692, 0.271875, 
    0, 0.00625, 0, 0.896875, 0.25625, 0.3125, 0.021875, 0.265625, 
    0.46875, 0.0375, 0.421875, 0.121875, 0.159375, 0.181818181818182, 
    0.1875, 0.09375, 0.0625, 0.096875, 0.583333333333333, 0.0625, 
    0.140625, 0.1875, 0, 0.00625, 0.5875, 0.1625, 0.5625, 0.078125, 
    0, 0, 0, 0.015625, 0, 0.490625, 0.533333333333333, 0.246875, 
    0.546875, 0.3125, 0.209375, 0.225, 0, 0, 0.375, 0.08125, 
    0.265625, 0.178125, 0.2, 0.1, 0.109375, 0.590625, 0.065625, 
    0.0375, 0.1375, 0.115625, 0.13125, 0.53125, 0.4375, 0.21875, 
    0.171875, 0.06875, 0.1875, 0.0625, 0.65625, 0, 0, 0.00625, 
    0, 0.225, 0.153125, 0.171875, 0.10625, 0, 0.596875, 0.125, 
    0.190909090909091, 0.496875, 0.88125, 0.00625, 0.615625, 
    0.725, 0.5625, 0.146875, 0.046875, 0.31875, 0.1, 0.646875, 
    0.265625, 0.578125, 0.5, 0.075, 0.03125), cons_transf = c(0.25617376914899, 
    0, 0.559016994374947, 0.586301969977929, 0.418330013267038, 
    0.429389100932942, 0.673145600891813, 0.138675049056307, 
    0.521416340365355, 0, 0.0790569415042095, 0, 0.947034846243791, 
    0.506211418282915, 0.559016994374947, 0.14790199457749, 0.515388203202208, 
    0.684653196881458, 0.193649167310371, 0.649519052838329, 
    0.349106001094224, 0.399217985566783, 0.426401432711221, 
    0.433012701892219, 0.306186217847897, 0.25, 0.311247489949718, 
    0.763762615825973, 0.25, 0.375, 0.433012701892219, 0, 0.0790569415042095, 
    0.766485485837795, 0.403112887414928, 0.75, 0.279508497187474, 
    0, 0, 0, 0.125, 0, 0.700446286306095, 0.730296743340221, 
    0.496865172858795, 0.739509972887452, 0.559016994374947, 
    0.457575130443078, 0.474341649025257, 0, 0, 0.612372435695794, 
    0.285043856274785, 0.515388203202208, 0.422048575403353, 
    0.447213595499958, 0.316227766016838, 0.330718913883074, 
    0.76852130744697, 0.25617376914899, 0.193649167310371, 0.370809924354783, 
    0.340036762718386, 0.362284418654736, 0.728868986855663, 
    0.661437827766148, 0.467707173346743, 0.414578098794425, 
    0.262202212042538, 0.433012701892219, 0.25, 0.810092587300983, 
    0, 0, 0.0790569415042095, 0, 0.474341649025257, 0.391311896062463, 
    0.414578098794425, 0.325960120260132, 0, 0.772576857018122, 
    0.353553390593274, 0.436931448752651, 0.704893608993584, 
    0.938749167775929, 0.0790569415042095, 0.784617741323761, 
    0.85146931829632, 0.75, 0.383242742918897, 0.21650635094611, 
    0.564579489531811, 0.316227766016838, 0.804285397107271, 
    0.515388203202208, 0.760345316287277, 0.707106781186548, 
    0.273861278752583, 0.176776695296637), cons_transf2 = c(0.0635614814897446, 
    0, 0.271933715483642, 0.295464212893836, 0.161268147596122, 
    0.169215209288654, 0.373716409793584, 0.0190481949706944, 
    0.240492189648823, 0, 0.00623054975063616, 0, 0.640207795265726, 
    0.228131092825249, 0.271933715483642, 0.0216391751034812, 
    0.235566071312767, 0.384411698910332, 0.0368139731227164, 
    0.351976423157178, 0.115001392694507, 0.147881066813663, 
    0.167054084663166, 0.171850256926659, 0.0896121586896871, 
    0.0606246218164348, 0.0924652276720936, 0.45953232937844, 
    0.0606246218164348, 0.131576357788719, 0.171850256926659, 
    0, 0.00623054975063616, 0.46216045178471, 0.150572858479374, 
    0.44628710262842, 0.0752234212375875, 0, 0, 0, 0.0155041865359653, 
    0, 0.399195495094569, 0.42744401482694, 0.220640421096091, 
    0.436236766774918, 0.271933715483642, 0.19010369723601, 0.20294084399669, 
    0, 0, 0.318453731118535, 0.0781177792639521, 0.235566071312767, 
    0.163924191654239, 0.182321556793955, 0.0953101798043249, 
    0.103796793681644, 0.46412702075675, 0.0635614814897446, 
    0.0368139731227164, 0.128832871842968, 0.109414785985867, 
    0.123323216031999, 0.4260843953109, 0.362905493689368, 0.19782574332992, 
    0.158605030176639, 0.066489741268833, 0.171850256926659, 
    0.0606246218164348, 0.504556010752395, 0, 0, 0.00623054975063616, 
    0, 0.20294084399669, 0.142475648246755, 0.158605030176639, 
    0.100975917340002, 0, 0.468048594409932, 0.117783035656383, 
    0.174716957408735, 0.403379601617143, 0.631936449515049, 
    0.00623054975063616, 0.479721878714657, 0.545227050483323, 
    0.44628710262842, 0.137040852260798, 0.0458095360312942, 
    0.27668431824224, 0.0953101798043249, 0.49887955274759, 0.235566071312767, 
    0.456237433481588, 0.405465108108164, 0.0723206615796261, 
    0.0307716586667537), cons_transf3 = c(0.93841642228739, 1, 
    0.761904761904762, 0.744186046511628, 0.851063829787234, 
    0.844327176781003, 0.688172043010753, 0.981132075471698, 
    0.786240786240786, 1, 0.993788819875776, 1, 0.527182866556837, 
    0.796019900497512, 0.761904761904762, 0.978593272171254, 
    0.790123456790123, 0.680851063829787, 0.963855421686747, 
    0.703296703296703, 0.891364902506964, 0.862533692722372, 
    0.846153846153846, 0.842105263157895, 0.914285714285714, 
    0.941176470588235, 0.911680911680912, 0.631578947368421, 
    0.941176470588235, 0.876712328767123, 0.842105263157895, 
    1, 0.993788819875776, 0.62992125984252, 0.860215053763441, 
    0.64, 0.927536231884058, 1, 1, 1, 0.984615384615385, 1, 0.670859538784067, 
    0.652173913043478, 0.802005012531328, 0.646464646464647, 
    0.761904761904762, 0.82687338501292, 0.816326530612245, 1, 
    1, 0.727272727272727, 0.92485549132948, 0.790123456790123, 
    0.848806366047745, 0.833333333333333, 0.909090909090909, 
    0.901408450704225, 0.628683693516699, 0.93841642228739, 0.963855421686747, 
    0.879120879120879, 0.896358543417367, 0.883977900552486, 
    0.653061224489796, 0.695652173913043, 0.82051282051282, 0.853333333333333, 
    0.935672514619883, 0.842105263157895, 0.941176470588235, 
    0.60377358490566, 1, 1, 0.993788819875776, 1, 0.816326530612245, 
    0.867208672086721, 0.853333333333333, 0.903954802259887, 
    1, 0.626223091976517, 0.888888888888889, 0.83969465648855, 
    0.668058455114823, 0.53156146179402, 0.993788819875776, 0.618955512572534, 
    0.579710144927536, 0.64, 0.871934604904632, 0.955223880597015, 
    0.758293838862559, 0.909090909090909, 0.607210626185958, 
    0.790123456790123, 0.633663366336634, 0.666666666666667, 
    0.930232558139535, 0.96969696969697), cons_transf4 = c(0.403357161506136, 
    0, 0.678604404148727, 0.700509832663847, 0.559344471040698, 
    0.569159528740626, 0.768079206421462, 0.267916144918562, 
    0.647823092234906, 0, 0.184201574932019, 0, 0.964370624177648, 
    0.63516704638624, 0.678604404148727, 0.279672235520349, 0.642820397664559, 
    0.776808126488465, 0.334716475041085, 0.75, 0.495798120670194, 
    0.542175721312549, 0.566516334942705, 0.572357121276666, 
    0.454280148208035, 0.39685026299205, 0.459272637503557, 0.835549655827431, 
    0.39685026299205, 0.520020955762976, 0.572357121276666, 0, 
    0.184201574932019, 0.837534341801117, 0.545696441530553, 
    0.825481812223657, 0.427493986669174, 0, 0, 0, 0.25, 0, 0.788708566719032, 
    0.810960266076453, 0.627324676023275, 0.817766577547147, 
    0.678604404148727, 0.593801934515397, 0.60822019955734, 0, 
    0, 0.721124785153704, 0.433119552670451, 0.642820397664559, 
    0.562654278669283, 0.584803547642573, 0.464158883361278, 
    0.478232795693097, 0.839016706561048, 0.403357161506136, 
    0.334716475041085, 0.516140057728184, 0.487173790093664, 
    0.508198178407427, 0.809902950319371, 0.759147242968916, 
    0.602535566043808, 0.555995022642329, 0.409660635300323, 
    0.572357121276666, 0.39685026299205, 0.869006661221612, 0, 
    0, 0.184201574932019, 0, 0.60822019955734, 0.53499374028254, 
    0.555995022642329, 0.473634118592955, 0, 0.841965822923538, 
    0.5, 0.575805138911868, 0.792043526329418, 0.958737489687269, 
    0.184201574932019, 0.850691478848779, 0.898350889571526, 
    0.825481812223657, 0.527613573622537, 0.360562392576852, 
    0.683098604023617, 0.464158883361278, 0.864848670999924, 
    0.642820397664559, 0.833055462911488, 0.7937005259841, 0.421716332650875, 
    0.314980262473718)), row.names = c(NA, -100L), class = "data.frame")

1 Answers1

-1

to check multiple models and find the best one by AIC criterion you can use stepAIC() function from MASS package.

This function adds and subtracts variables from the model until it finds an optimal solution (taking into account AIC). In each step the fuction refits the model with one variable omitted or added.

What you can do is to build your model on all variables and let the function find the 'best' one:

regression<-glm(dependent_variable ~ ., df, family = "poisson")
model.stepwise.regression<-stepAIC(regression, direction = "both")
  • Thanks for the hint, I haven't come across this function! However, I'm not sure how well this function works for my example here, I don't get useful AIC scores as they all are too large (i.e., it shows "Inf").

    (Output in next comment)

    –  Mar 01 '22 at 11:54
  • stepwise.model <- stepAIC(baits.full.glm, direction ="both", trace = TRUE)

    Start: AIC=Inf consumption ~ region + exposition + elevation_level + climate_pca1 + climate_pca2 + soil_pca1 + soil_pca2

                  Df Deviance AIC
    

    68.155 Inf

    • region 1 73.195 Inf
    • exposition 1 68.257 Inf
    • elevation_level 1 70.157 Inf
    • climate_pca1 1 69.356 Inf
    • climate_pca2 1 68.908 Inf
    • soil_pca1 1 73.382 Inf
    • soil_pca2 1 69.512 Inf
    –  Mar 01 '22 at 11:55
  • As has been discussed often on this site, model "selection" in your context is not a good idea. Spend your time on translating the subject matter understanding into model specification and stick with the model you specified. That is the model that will yield accurate standard errors, confidence intervals, and p-values in the frequentist world. Model "selection" will destroy them whether based on AIC or p-values. – Frank Harrell Aug 16 '23 at 11:14