public
Created

Model Selection and Multi-Model Inference

  • Download Gist
fishlakes.csv
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
"","X","Lake.ID","Name","treatment","shorline","sizehectars","elevation","UTM.zone","northing","easting","BUBO.breeding","BUBO.breeding2","PSRE.breeding.Y.N","RACA.y.n","veg.extent","X..of.transects.with.veg","bank.slope","silt.0.1.","silt.total","X10cm.area","vegetated.area","RACA.1K","lakes.1k","dist.ave","ls","raca.basin","fish.basin","lakes.basin","co.lakes.basin","ls2","woody","herbacious","unveg","total","woodyprop","herbprop","unvegprop","logveg","archerb","arcsilt"
"1",1,531,"Mill Creek",0,377.96,0.713,2008.9368,10,518882,4565085,"y",1,"n","y",0.691,0.682,0.308095216,0.6818,0.71212,111.5,261.17,3,4,0.5538,0.75,3,0,3,0,1,6082255.229,54367.17182,1399749.194,7536371.595,0.807053521,0.007213972,0.185732508,2.41692328905509,0.0850375574910141,1.00445938904933
"2",2,533,"East Boulder",1,1356.4,11.4,2034.8448,10,518069,4564441,"y",1,"y","y",2.28,0.292,0.092475736,0.376,0.3472,980.56,3092.59,5,10,0.8268,0.5,4,4,8,2,0.5,5699686.549,1302747.189,1470012.242,8472445.979,0.67273212,0.15376282,0.173505059,3.49032234724526,0.402941577234993,0.630113907491124
"3",3,534,"Mosquito",1,555.65,2.221,2017,10,520565,4564620,"y",1,"y","y",0.425,0.292,0.067204288,0.375,0.6806,289.4,236.15,0,2,0.52,0,0,0,1,0,0,5048929.965,89795.82505,188674.0617,5327399.852,0.947728743,0.016855469,0.035415788,2.37318794991272,0.13019612877964,0.970175389664562
"4",4,537,"Upper Boulder",1,530.48,2.009,1927,10,518185,4563757,"y",1,"y","y",1.17,0.875,0.068711911,0.875,0.9306,244.02,620.66,4,9,0.8312,0.444444444,4,4,8,2,0.5,5699686.549,1302747.189,1470012.242,8472445.979,0.67273212,0.15376282,0.173505059,2.7928537570834,0.402941577234993,1.30421113262519
"5",5,539,"Big Marshy",1,667.29,2.813,1911,10,519781,4563423,"y",1,"y","y",0.517,0.826,0.331579018,0.83333,0.5278,153.48,344.99,2,4,0.563,0.5,3,1,4,1,0.75,4163162.351,365814.0766,381401.5985,4910378.026,0.847829297,0.07449815,0.077672553,2.53780650664498,0.276451377067193,0.81321250666084
"6",6,543,"Little Marshy",1,339.29,0.661,1875,10,518185,4563757,"y",1,"y","y",0.27,0.875,0.233320289,1,1,61.07,91.61,3,4,0.5114,0.75,3,1,4,1,0.75,5699686.549,1302747.189,1470012.242,8472445.979,0.67273212,0.15376282,0.173505059,1.96194288314139,0.402941577234993,1.5707963267949
"7",7,544,"Middle Boulder",1,604.369,2.493,1984.8576,10,516709,4562826,"y",1,"n","y",2.48,0.636,0.08493805,0.6364,0.81818,197.79,1498.84,3,7,0.9013,0.428571429,1,2,5,0,0.2,9431012.702,1523636.031,939040.9555,11893689.69,0.792942556,0.128104572,0.078952872,3.17575527472565,0.366036145019016,1.13028330677218
"8",8,553,"Fox Creek",1,661.25,2.791,2003,10,512651,4562132,"n",0,"y","y",2.16,0.542,0.091902485,0.8333,0.90278,304.17,1428.3,3,4,0.7386,0.75,0,0,0,0,0,4236206.422,67803.93366,165571.6861,4469582.042,0.947785807,0.015170084,0.037044109,3.15481943619417,0.123480448832674,1.25370815685985
"9",9,554,"Telephone",1,534.796,1.493,2098.8528,10,516391,4562228,"y",1,"y","y",0.292,0.291,0.254833499,0.3333,0.29167,178.27,156.16,4,5,0.4198,0.8,2,1,4,0,0.5,9431012.702,1523636.031,939040.9555,11893689.69,0.792942556,0.128104572,0.078952872,2.19356980032262,0.366036145019016,0.57051411453301
"10",10,555,"Mavis",0,502.95,1.721,2048,10,513531,4562062,"n",0,"y","y",1.8,0.565,0.153416601,0.4782,0.6956,186.09,905.31,2,2,0.6144,1,1,0,1,0,1,4236206.422,67803.93366,165571.6861,4469582.042,0.947785807,0.015170084,0.037044109,2.95679731758781,0.123480448832674,0.986365736642058
"11",11,556,"West Boulder",0,552.5,2.053,2122.3224,10,515248,4562118,"y",1,"y","n",0.2,0.25,0.398011014,0.1667,0.1691,138.12,110.5,2,2,0.5504,1,3,1,4,1,0.75,9431012.702,1523636.031,939040.9555,11893689.69,0.792942556,0.128104572,0.078952872,2.04336227802113,0.366036145019016,0.42378953989023
"12",12,561,"Virginia",1,453.892,1.43,2008.0224,10,511931,4561555,"n",0,"n","y",1.2,0.708,0.136797022,0.9167,0.8472,151.3,544.67,0,1,0.4821,0,0,0,0,0,0,4236206.422,67803.93366,165571.6861,4469582.042,0.947785807,0.015170084,0.037044109,2.73613345532957,0.123480448832674,1.16919104136446
"13",13,563,"Tangle Blue",0,870.27,4.534,1751,10,521440,4561693,"y",1,"y","y",2.08,0.833,0.218926013,0.9583,0.8889,311.56,1810.16,0,0,0.5399,0,0,0,0,0,0,3753234.847,44885.39707,75559.57374,3873679.818,0.968906834,0.011587276,0.01950589,3.25771696384489,0.107853185609941,1.23097709539702
"14",14,573,"Twin 1",1,261.673,0.415,1967.1792,10,501982,4560450,"y",1,"y","y",4.43,0.857,0.043439116,1,1,314.01,1159.21,1,5,0.44,0.2,1,0,4,0,0.25,9712469.841,360952.0095,248307.4167,10321729.27,0.940973125,0.03497011,0.024056765,3.0641621189487,0.188110404256456,1.5707963267949
"15",15,574,"Fish",1,525.934,1.558,1821.18,10,503200,4560208,"y",1,"n","y",6.36,1,0.07240347,1,1,306.79,3344.94,1,2,1.0843,0.5,0,0,1,0,0,9712469.841,360952.0095,248307.4167,10321729.27,0.940973125,0.03497011,0.024056765,3.52438833199843,0.188110404256456,1.5707963267949
"16",16,576,"Long Gulch",0,1021.974,7.362,1952.5488,10,506779,4560018,"y",1,"n","n",0.9125,0.667,0.293120249,0.583,0.513,374.72,932.55,0,0,0.1676,0,0,0,0,0,0,5716789.474,233236.0196,110030.7652,6060056.259,0.943355842,0.038487435,0.018156723,2.96967212642384,0.197462879973287,0.798399628509846
"17",17,588,"Trail Gulch",0,983.875,6.777,1961.6928,10,505299,4558959,"y",1,"n","n",0.45,0.4583,0.316543667,0.54166,0.4167,323.86,442.74,0,0,0.6774,0,0,0,0,0,0,8347010.724,404047.8247,242744.5556,8993803.104,0.928084663,0.044925136,0.026990201,2.64614876072859,0.213575495220347,0.701707929764643
"18",18,593,"Granite",0,594.77,2.297,1964.7408,10,515026,4558535,"n",0,"n","n",0,0,0.347121369,0.79167,0.875,131.35,0,0,0,0.5445,0,0,0,0,0,0,18498420.42,271590.7421,23218.44076,18793229.6,0.984313011,0.01445152,0.001235468,0,0.12050592131947,1.20942920288819
"19",19,601,"Doe",0,543.717,1.672,2131.1616,10,516656,4557435,"y",1,"n","n",0,0,0.286799343,0.7917,0.69444,92.88,0,0,0,0.5531,0,0,0,0,0,0,3190128.038,381502.0769,47387.58457,3619017.7,0.881490035,0.105415919,0.013094046,0,0.330671452276355,0.985105959166056
"20",20,609,"Rush Creek",1,453.08,1.311,2013,10,503126,4555571,"y",1,"y","y",1.45,0.9583,0.13807655,1,0.97222,244.67,656.97,0,0,0,0,0,0,0,0,0,7946383.765,302516.9945,33472.87659,8282373.636,0.959433142,0.036525398,0.004041459,2.81754553830875,0.192299171321275,1.40334148647253
"21",21,611,"Stoddard",0,1349.484,12.69,1777.5936,10,520514,4555666,"n",0,"y","y",0.492,0.7917,0.21156318,0.333,0.5278,635.38,663.95,2,6,0.2882,0.333333333,2,1,6,1,0.333333333,19632617.35,67978.76418,564830.9595,20265427.07,0.968773926,0.003354421,0.027871653,2.82213537523894,0.0579497923899455,0.81321250666084
"22",22,612,"McDonald",1,714.23,2.77,1797,10,520526,4555169,"n",0,"y","y",2.54,0.8333,0.165445662,0.875,0.8611,521.39,1814.15,1,6,0.1235,0.166666667,1,1,6,0,0.166666667,19632617.35,67978.76418,564830.9595,20265427.07,0.968773926,0.003354421,0.027871653,3.25867319313149,0.0579497923899455,1.18888701447886
"23",23,666,"Sugar Pine",0,638.939,2.474,2005.2792,10,512280,4545701,"n",0,"n","n",0.192,0.0833,0.337661923,0.4583,0.5139,141.1,122.68,1,2,0.1666,0.5,1,0,2,0,0.5,7555078.376,113440.309,52741.99409,7721260.679,0.97847731,0.014691941,0.006830749,2.08877376731045,0.121509099295068,0.799299954433068
"24",24,681,"Boulder Lake, Big",1,654.43,2.642,1850,10,516147,4544203,"y",1,"y","y",0.895,0.571,0.094854622,0.857,0.9206,164.92,585.72,3,7,0.5311,0.428571429,0,1,2,0,0,8350347.637,0,152571.0462,8502918.683,0.982056626,0,0.017943374,2.76769005370415,NA,1.28514748977933
"25",25,682,"Conway",1,217.701,0.283,2078.736,10,512971,4543896,"n",0,"n","y",1.426,0.842,0.105423578,0.8421,0.8596,137.59,310.44,1,16,0.0902,0.0625,1,0,5,0,0.2,2076327.642,7606.052788,846148.431,2930082.125,0.708624384,0.00259585,0.288779766,2.49197767476417,0.050971553445267,1.18672327659261
"26",26,683,"Foster",0,680.13,2.662,2208.276,10,512130,4543849,"n",0,"n","y",0,0,0.183714243,0.125,0.4028,246.55,0,1,13,0.1753,0.076923077,2,0,8,0,0.25,2076327.642,7606.052788,846148.431,2930082.125,0.708624384,0.00259585,0.288779766,0,0.050971553445267,0.687575291481972
"27",27,684,"Lion",0,471.651,1.544,2132.3808,10,512738,4543894,"n",0,"n","y",0.129,0.5417,0.527896107,0.625,0.444,68.78,60.84,2,18,0.1694,0.111111111,0,0,0,0,0,2076327.642,7606.052788,846148.431,2930082.125,0.708624384,0.00259585,0.288779766,1.78418920538096,0.050971553445267,0.729280420208908
"28",28,686,"Little Boulder",0,531.091,1.897,1925.7264,10,517098,4543954,"n",0,"n","n",1.181,0.857,0.362842014,0.619,0.571,116.33,627.22,1,3,0.4532,0.333333333,0,0,0,0,0,8350347.637,0,152571.0462,8502918.683,0.982056626,0,0.017943374,2.79741989813167,NA,0.856638962154039
"29",29,688,"Union",1,666.691,1.49,1837.3344,10,509757,4543557,"n",0,"y","y",0.654,0.583,0.05,0.7083,0.8056,500,436.02,2,4,1.091,0.5,1,0,2,0,0.5,4919748.419,212619.5512,807694.3279,5940062.299,0.828231788,0.035794162,0.13597405,2.6395064105769,0.190340698379716,1.11418609301515
"30",30,700,"Lilypad",0,349.108,0.846,1915.3632,10,516110,4541932,"y",1,"n","n",1.65,0.789,0.076035504,1,1,246.21,576.03,1,6,0.25,0.166666667,1,0,6,0,0.166666667,5727944.441,54893.59787,565948.948,6348786.987,0.90221084,0.008646313,0.089142847,2.76044510233845,0.0931200737336209,1.5707963267949
"31",31,722,"Salmon",1,490.09,0.658,2179,10,506610,4538422,"y",1,"y","y",1.29,0.895,0.265192487,0.9474,0.8567,284.25,632.21,1,11,0.1394,0.090909091,1,0,7,0,0.142857143,6906710.501,45810.99035,2443042.424,9395563.915,0.735103349,0.004875811,0.26002084,2.80086136102345,0.0698838764161109,1.1825672632676
"32",32,727,"Twin 2",0,238.123,0.319,1549.908,10,515239,4538020,"n",0,"y","y",0.281,0.25,0.080434362,1,1,17.86,66.91,1,4,0.34,0.25,1,0,1,0,1,5531792.832,39381.26629,35177.95804,5606352.056,0.986700938,0.007024401,0.006274661,1.82549102987943,0.0839101322872417,1.5707963267949
"33",33,732,"El",1,1071.03,2.259,1990,10,498828,4536778,"y",1,"y","y",0.22,0.2,0.141795358,0.9,0.867,524.8,235.63,0,4,0.2779,0,2,2,4,0,0.5,5415736.971,61073.43835,20011021.59,25487832,0.212483234,0.00239618,0.785120586,2.37223058325011,0.0489703618786081,1.19749470193976
"34",34,760,"Luella",0,357,0.942,2110.1304,10,508239,4533457,"y",1,"y","y",0.025,0.0833,0.480850091,0.5417,0.36111,23.8,8.92,2,7,0.16,0.285714286,0,0,1,0,0,2679851.035,667032.256,2904220.614,6251103.905,0.428700446,0.106706314,0.46459324,0.950364854376123,0.332766831063272,0.644656970151775
"35",35,765,"Forbidden 1",0,453.246,0.773,1869.948,10,496236,4532552,"n",0,"y","n",2.38,0.6,0.162730513,0.6,0.63333,292.34,1078.73,6,10,0.5672,0.6,6,3,10,1,0.6,4633981.257,0,10146766.69,14780747.95,0.313514666,0,0.686485334,3.032912756839,NA,0.92036110274514
"36",36,767,"Forbidden 2",0,272.539,0.355,1875.1296,10,496065,4532439,"n",0,"n","y",0.141,0.3182,0.529263988,0.4545,0.363636,50.79,38.43,4,7,0.54,0.571428571,6,3,10,1,0.6,4633981.257,0,10146766.69,14780747.95,0.313514666,0,0.686485334,1.58467038446435,NA,0.647284470051139
"37",37,770,"Deer",0,440.21,1.314,2176,10,508977,4532528,"y",1,"n","n",0.48,0.625,0.369188018,0.875,0.75,127.66,211.3,1,4,0.3665,0.25,0,0,0,0,0,2679851.035,667032.256,2904220.614,6251103.905,0.428700446,0.106706314,0.46459324,2.32489949705231,0.332766831063272,1.0471975511966
"38",38,771,"Diamond",0,372.57,0.949,2200,10,507990,4532496,"n",0,"n","n",0.7,0.217,0.546235472,0.8696,0.8116,7.45,260.8,1,6,0.33,0.166666667,1,1,3,0,0.333333333,4235026.041,0,2696724.247,6931750.288,0.61096056,0,0.38903944,2.41630758705988,NA,1.12181206841725
"39",39,773,"Summit",0,738.19,3.636,2300.0208,10,508669,4531974,"n",0,"n","n",0,0,0.379639963,0,0,147.64,0,2,4,0.428,0.5,0,0,0,0,0,4235026.041,0,2696724.247,6931750.288,0.61096056,0,0.38903944,0,NA,NA
"40",40,26177,"South Fork 1",0,529.882,1.823,2041.5504,10,508345,4561374,"n",0,"n","n",0.191,0.45833,0.167922684,0.4583,0.5556,317.93,101.21,0,4,0,0,0,1,2,0,0,7868924.145,372358.9597,334835.4841,8576118.589,0.917539102,0.043418122,0.039042777,2.00522342485814,0.209908241391098,0.841113392151149
"41",41,26184,"U Boulder Pond 1",0,243.28,0.441,2072.64,10,518345,4563869,"n",0,"n","y",0.742,0.917,0.250498382,0.9167,0.8889,107.45,180.51,5,10,0.5,0.5,5,4,8,3,0.625,5699686.549,1302747.189,1470012.242,8472445.979,0.67273212,0.15376282,0.173505059,2.25650126621132,0.402941577234993,1.23097709539702
"42",42,26187,"M Boulder Pond 1",0,234.927,0.375,2133.6,10,517432,4562568,"n",0,"n","y",0.575,1,0.302735107,1,0.8056,35.24,135.08,2,5,0.482,0.4,2,2,5,1,0.4,9431012.702,1523636.031,939040.9555,11893689.69,0.792942556,0.128104572,0.078952872,2.13059105196337,0.366036145019016,1.11418609301515
lakes.df2.csv
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
"","destinatio","wild","fish","hike","escape","photo","climb","friends","relax","other","size","lake","stocked","management","ID","amps","fishyn","cows","herp.rich","fish.rich","rich","visitors","logsize"
"1","Adams",1,0,3,1,2,1,1,2,1,NA,"y","n","Amps",624,"BUBO, HYRE, RACA, THSP","n","n",4,0,4,4,NA
"2","alpine",6,4,11,7,7,2,5,9,4,5.23,"y","n","Amps",768,"RACA, THSP","y","n",1,1,2,12,0.718501688867274
"3","anna",6,3,13,10,6,1,7,9,2,1.573,"y","n",NA,781,"HYRE","y","n",0,1,1,13,0.196728722623287
"4","B_marshy",4,4,4,3,2,0,4,4,0,2.813,"y","n","Stocked Lake",539,"BUBO, HYRE, RACA, THSP","y","n",4,1,5,4,0.449169732165201
"5","BBD",1,0,2,1,1,0,0,1,1,NA,"y","n","Amps",26065,"AMMA, HYRE, RACA","n","n",2,0,2,2,NA
"6","bear basin",7,4,17,12,5,1,11,8,10,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,19,NA
"7","bear_wallow",1,0,1,1,0,0,0,0,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"8","bee_tree",0,0,3,3,2,0,3,1,3,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,3,NA
"9","big flat",0,0,2,2,0,0,0,0,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,2,NA
"10","bingham",1,0,1,1,1,0,1,0,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"11","black_basin",0,0,1,1,0,0,1,0,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"12","boulder",23,21,41,30,20,4,33,23,8,2.642,"y","n","Stocked Lake",681,"BUBO, HYRE, RACA, THSP","y","n",4,2,6,42,0.421932813278508
"13","boulder cr",7,5,15,13,8,0,9,13,3,0.451,"y","n","Amps",762,"HYRE, RACA, THSP","y","n",3,1,4,16,-0.345823458122039
"14","bowerman mdw",11,0,21,15,11,1,14,13,8,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,21,NA
"15","browns mdw",1,0,1,0,0,0,0,0,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"16","bullards basin",0,0,0,0,0,0,0,0,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"17","caribou",34,10,67,52,33,12,39,37,17,30.515,"y","n",NA,702,"BUBO, RACA","y","n",1,2,3,72,1.48451337429261
"18","caribou mt",1,0,1,1,0,0,0,0,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,2,NA
"19","CC",7,2,11,5,5,1,4,7,1,NA,"n","y",NA,NA,NA,NA,NA,0,0,0,12,NA
"20","CC falls",0,1,6,3,2,0,3,4,0,NA,"n","y",NA,NA,NA,NA,NA,0,0,0,6,NA
"21","CCL",30,14,49,43,21,2,33,35,11,6.702,"y","y","Stocked Lake",742,"THSP","y","n",1,3,4,51,0.826204423499253
"22","CCM",1,1,4,4,4,0,3,3,0,NA,"n","y",NA,NA,NA,NA,NA,0,0,0,4,NA
"23","ceasar pk",0,0,1,1,1,0,0,0,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"24","ceaser pk",1,0,1,1,1,1,1,1,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"25","cherry flat",2,1,2,1,0,0,2,1,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,3,NA
"26","china_garden",1,1,1,0,1,0,0,1,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"27","cold springs",2,0,2,2,2,0,2,2,2,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,2,NA
"28","conway",1,0,1,1,0,1,1,1,1,NA,"y","n","Amps",682,"BUBO, HYRE, RACA, THSP","y","n",3,0,3,1,NA
"29","deer",21,5,38,30,21,4,22,18,7,1.314,"y","y","Stocked Lake",770,"BUBO, HYRE, RACA, THSP","y","n",2,1,3,38,0.118595365223762
"30","deer_creek",1,0,2,2,1,0,2,2,0,NA,"n","n",NA,NA,NA,"y","n",0,0,0,2,NA
"31","deer_creek_camp",1,1,2,2,1,0,1,1,1,NA,"n","n",NA,NA,NA,"y","n",0,0,0,2,NA
"32","deer_flat",0,0,2,1,0,0,1,1,0,NA,"n","n",NA,NA,NA,"y","n",0,0,0,2,NA
"33","diamond",20,4,31,26,21,4,20,16,6,0.949,"y","y","Stocked Lake",771,"HYRE, THSP","y","n",0,1,1,31,-0.0227337875727074
"34","dorleska_mine",2,0,3,2,1,0,1,2,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,3,NA
"35","eagle pk",1,0,1,0,1,0,0,0,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"36","east_boulder",15,11,16,14,12,1,16,15,3,11.44,"y","n","Stocked Lake",533,"BUBO, HYRE, RACA, THSP","y","n",4,1,5,20,1.05842602445701
"37","east_weaver",0,1,1,0,0,0,0,0,0,0.22,"y","y",NA,852,"HYRE",NA,NA,1,1,2,1,-0.657577319177794
"38","echo",5,0,6,5,4,0,3,3,2,1.303,"y","n","Amps",786,"AMMA, HYRE, RACA, THSP","y","n",4,1,5,6,0.114944415712585
"39","El",5,0,7,7,5,0,6,6,4,2.259,"y","n","Amps",732,"BUBO, HYRE, RACA","y","n",3,1,4,7,0.353916230920363
"40","eleanor",1,0,4,2,2,0,3,1,0,NA,"y","n",NA,NA,NA,"n","n",0,0,0,4,NA
"41","emerald",34,17,46,30,30,2,22,27,12,9.695,"y","y","Stocked Lake",711,"THSP",NA,NA,1,1,2,46,0.986547813414724
"42","fish",0,0,1,0,0,0,0,0,1,NA,"y","n","Amps",574,"BUBO, RACA","y","y",2,0,2,1,NA
"43","forbidden",3,1,4,4,3,0,4,4,1,0.773,"y","n",NA,765,"HYRE, RACA","y","n",0,1,1,4,-0.111820506081675
"44","foster",3,2,6,6,3,3,4,5,1,2.662,"y","n","Stocked Lake",683,"HYRE, RACA","y","n",0,2,2,6,0.425208051138656
"45","foster's_cabin",2,0,3,2,0,0,3,3,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,3,NA
"46","found",3,2,3,3,2,0,3,1,0,NA,"y","n","Amps",690,"AMMA, HYRE, RACA, THSP","n","n",4,0,4,3,NA
"47","fox_creek",0,3,5,1,2,0,2,2,2,2.791,"y","n","Amps",553,"BUBO, HYRE, RACA, THSP","y","n",3,3,6,5,0.445759836488631
"48","gibson pk",0,0,1,1,1,0,0,0,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"49","gibson_mdw",0,1,1,0,1,0,0,0,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"50","granite",35,15,73,55,37,5,47,42,15,10.122,"y","y","Stocked Lake",759,"BUBO, THSP","y","n",2,1,3,75,1.00526633297277
"51","granite_cr",1,0,4,4,0,0,1,1,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,4,NA
"52","granite_pk",0,0,2,2,1,0,2,1,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,2,NA
"53","grizzly",9,6,19,14,11,3,11,8,5,16.747,"y","n","Stocked Lake",708,"RACA","y","n",1,1,2,19,1.22393702031998
"54","grizzly_mdw",1,2,2,2,2,0,1,1,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,2,NA
"55","hidden",15,8,25,17,11,4,16,13,9,NA,"y","n","Amps",551,"BUBO, HYRE, THSP","n","y",2,0,2,27,NA
"56","horseshoe",8,2,10,10,6,2,7,8,2,1.932,"y","n","Stocked Lake",726,"BUBO, HYRE, THSP","y","n",2,2,4,10,0.286007122079475
"57","kalmia",1,0,1,1,0,0,1,1,1,NA,"y","n",NA,729,"BUBO, RACA, THSP",NA,"n",2,0,2,1,NA
"58","l_boulder",5,1,8,4,4,2,4,5,1,1.897,"y","y","Stocked Lake",686,"BUBO, HYRE","y","n",0,1,1,9,0.278067330888663
"59","l_marshy",1,0,1,1,1,0,0,1,0,0.661,"y","n","Stocked Lake",543,"BUBO, HYRE, RACA, THSP",NA,NA,4,1,5,1,-0.17979854051436
"60","L_south_fork",0,0,1,1,0,0,0,1,1,3.383,"y","n",NA,704,"RACA",NA,NA,1,1,2,1,0.529301997787981
"61","landers",3,0,4,4,2,0,0,2,0,NA,"y","n","Stocked Lake",692,"BUBO","n","n",1,0,1,4,NA
"62","lion",2,3,7,5,4,3,5,5,1,1.544,"y","y","Stocked Lake",684,"RACA","y","n",0,1,1,7,0.188647295999717
"63","little_caribou",1,0,3,2,0,0,3,3,1,1.018,"y","n","Amps",685,"BUBO, HYRE, RACA","y","n",1,1,2,4,0.00774777800073995
"64","long_canyon",3,1,19,7,6,0,6,7,5,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,20,NA
"65","long_gulch",4,4,9,6,3,0,6,6,3,7.362,"y","n","Amps",576,"BUBO, RACA","y","y",1,2,3,10,0.866995813110648
"66","luella",16,3,24,20,14,3,16,11,6,0.942,"y","y","Stocked Lake",760,"BUBO, HYRE, RACA","y","n",2,1,3,24,-0.0259490972071227
"67","mavis",0,3,4,0,1,0,1,1,2,1.721,"y","n","Stocked Lake",555,"HYRE, RACA","y","n",1,1,2,4,0.23578087032756
"68","middle_boulder",5,1,7,5,3,1,5,5,0,2.493,"y","n","Amps",544,"BUBO, HYRE, RACA, THSP","y","y",4,1,5,7,0.396722278503773
"69","mill_creek",1,0,1,1,1,0,0,1,0,0.713,"y","n","Stocked Lake",531,"BUBO, RACA, THSP","y","y",2,1,3,1,-0.146910470148134
"70","mirror",4,0,6,5,3,2,4,3,1,5.629,"y","n",NA,719,"BUBO",NA,"n",0,1,1,6,0.750431248660202
"71","morris",1,1,3,2,1,0,1,1,0,1.819,"y","n","Amps",744,"BUBO, RACA",NA,"n",2,1,3,3,0.259832699063484
"72","morris mdw",13,0,16,14,6,0,14,15,6,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,17,NA
"73","mumford_mdw",12,1,16,16,11,2,15,10,4,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,16,NA
"74","north fork coffee creek",1,0,1,0,0,0,0,0,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"75","packers pk",0,0,0,1,1,0,0,1,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"76","papoose",6,3,11,10,6,1,6,9,1,10.955,"y","n","Stocked Lake",737,"RACA","y","n",0,2,2,12,1.03961238189672
"77","parker_cr",1,0,2,2,1,0,2,1,2,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,2,NA
"78","parker_mdw",0,1,3,2,1,1,1,1,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,3,NA
"79","PCT",6,0,17,7,6,0,3,3,5,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,18,NA
"80","PCT_through",3,0,17,7,5,0,3,3,8,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,19,NA
"81","poison_canyon",1,0,1,1,1,0,1,1,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"82","Preachers_pk",1,0,1,1,1,1,0,0,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"83","rattlesnake",1,1,2,1,1,0,1,2,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,2,NA
"84","saloon creek",0,0,0,0,0,0,0,0,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"85","salt_creek",1,1,1,1,1,1,1,1,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"86","sapphire",18,4,24,22,13,2,15,19,12,19.41,"y","n","Stocked Lake",716,"HYRE, THSP","y","n",2,2,4,24,1.28802553538836
"87","sawtooth_mt",1,0,1,1,1,0,1,1,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"88","sawtooth_ridge",4,1,6,2,4,0,3,3,2,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,7,NA
"89","schlomberg cabin",0,0,0,0,0,0,0,0,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"90","Scott summit",0,0,3,2,1,0,1,2,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,3,NA
"91","seven_up_pk",2,1,4,4,2,1,3,3,2,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,5,NA
"92","shimmy",1,0,1,1,1,0,1,1,1,NA,"y","n","Amps",713,"HYRE, RACA, THSP","n","n",3,0,3,1,NA
"93","siligo_mdw",6,0,7,7,4,0,3,3,2,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,7,NA
"94","siligo_pk",1,0,2,2,1,1,1,0,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,2,NA
"95","sinks",1,0,1,1,1,0,1,0,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"96","smith",1,2,4,3,1,1,1,1,0,7.866,"y","n","Amps",746,"RACA",NA,"n",0,2,2,4,0.895753942073728
"97","snowslide",1,0,2,1,2,0,1,1,1,3.545,"y","n","Amps",695,"BUBO","y","n",1,3,4,2,0.549616239519085
"98","south fork",9,2,16,15,11,2,11,13,4,NA,"y","n","Amps",567,"THSP","n","n",1,0,1,19,NA
"99","steavale mdw",0,0,1,1,0,0,0,1,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"100","stoddard",0,0,3,1,1,0,0,1,2,12.69,"y","n","Amps",611,"BUBO, HYRE, RACA, THSP",NA,NA,3,2,5,3,1.1034616220947
"101","stuart fork",5,4,10,9,1,0,5,6,4,NA,"n","y",NA,NA,NA,NA,NA,0,0,0,12,NA
"102","sugar_pine",0,1,1,1,1,1,0,1,0,2.474,"y","n","Stocked Lake",666,"THSP",NA,NA,1,2,3,1,0.393399695293102
"103","summit",17,4,29,24,15,3,18,15,7,3.636,"y","n","Stocked Lake",773,NA,"y","n",1,1,2,29,0.56062387454993
"104","sunrise pass",0,0,1,0,0,0,1,1,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"105","swift creek",3,5,14,6,4,0,9,6,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,15,NA
"106","tangle_blue",5,4,8,4,5,1,4,6,2,4.534,"y","n","Stocked Lake",563,"BUBO, HYRE, RACA, THSP",NA,NA,3,2,5,8,0.656481515790499
"107","Tapie",2,0,2,1,0,0,1,1,0,NA,"y","n","Amps",687,"AMMA, BUBO, HYRE, RACA","n","n",3,0,3,2,NA
"108","telephone",1,1,1,1,0,0,1,1,0,1.493,"y","n","Stocked Lake",554,"BUBO, HYRE, RACA, THSP","y","y",4,1,5,1,0.174059807725025
"109","thompson pk",2,0,5,5,3,4,3,3,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,5,NA
"110","thumb_rock",1,1,1,1,1,1,1,1,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"111","trail gulch",12,5,24,19,6,0,16,17,6,6.777,"y","n","Stocked Lake",588,"BUBO, HYRE, RACA, THSP","y","y",3,2,5,28,0.831037485640025
"112","tri forest pass",1,1,1,1,1,0,1,1,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"113","u_boulder",2,0,2,2,2,0,2,2,0,2.009,"y","n","Amps",537,"BUBO, HYRE, RACA, THSP","y","y",4,2,6,2,0.302979936748249
"114","union",7,2,8,6,4,1,5,6,2,1.49,"y","n","Stocked Lake",688,"BUBO, HYRE, RACA, THSP","y","n",3,2,5,8,0.173186268412274
"115","valley_loop",0,0,1,1,0,0,0,1,1,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
"116","virginia",0,3,4,0,1,0,1,1,2,1.43,"y","n","Stocked Lake",561,"BUBO, HYRE, RACA","y","n",2,2,4,4,0.155336037465062
"117","ward",7,5,12,12,6,2,7,9,2,2.385,"y","n","Stocked Lake",715,"BUBO, HYRE, THSP","y","n",3,2,5,12,0.377488383376133
"118","west_boulder",1,1,1,1,0,0,1,1,0,2.053,"y","n","Stocked Lake",556,"BUBO","y","y",1,2,3,1,0.312388949370592
"119","yellow_rose_mine",0,0,1,0,1,0,1,0,0,NA,"n","n",NA,NA,NA,NA,NA,0,0,0,1,NA
model selection DRUG .R
R
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
# Model selection and multi-model inference
# A not-particularly good introduction by Rosemary Hartman
# (yes, I am just doing this for the flying monkey)
 
# So, let's say you want to find out where things are
# and why they are there.
 
# But there are a lot of reasons someone might be somewhere
 
# Let's say these things are fishermen,
# And we aren't sure what the reasons are yet.
 
# Start by making some good guesses. Maybe they all go to the
# big lakes. Maybe they all go to the lakes that CDFW stocks with fish.
# Maybe they go to the lakes with lots of frogs (not likely, but hey, why not try?)
# Once you have all your guesses, you need to figure out which one is right.
# There are two basic methods to use (or two that I have been exploring)
 
# Method #1: The kitchen sink
 
# load package "glmulti"
library(glmulti)
 
# create a model that has all the predictor variables you would like to test
global.model <- glm(fish~ # number of fishermen
stocked+ # CDFW fish stocking y/n
cows+ # cattle grazing in area y/n
herp.rich+ # amphibian species richness
fish.rich+ # fish species richness
visitors+ # total number of visitors
logsize, # log of the area
data=lakes.df2) # data frame we got this from
 
# Now we will use the "glmulti" function to find the best model;
# this goes through every possible model and finds the best one.
fish.model <- glmulti(global.model, # use the model with built as a starting point
level = 1, # just look at main effects
crit="aicc") # use AICc because it works better than AIC for small sample sizes
 
summary(fish.model)
 
# That showed us the best model, now lets look at some of the others
weightable(fish.model)
 
# So this is the best model
f <- glm(fish~1+cows+herp.rich+visitors+logsize, data=lakes.df2)
summary(f)
 
# I hate trying to interpret models based on tables of coeficients.
# Let's look at some graphs
library(visreg)
visreg(f)
 
# But according to theory, models with AIC within two points of each other are basically
# equal. So what about the other models? Should we totally throw them out? Looking
# at the table of aicc weights, there is a pretty big jump between model 8 and model 9.
# So lets try averaging the top 8 models if we want to use this to make predictions,
# evaluate variable importance, etc.
 
library(MuMIn)
 
# run the top 8 models
f2 <- glm(fish ~ 1 + cows + herp.rich + fish.rich + visitors + logsize, data=lakes.df2)
f3 <- glm(fish ~ 1 + stocked + cows + herp.rich + visitors + logsize, data=lakes.df2)
f4 <- glm(fish ~ 1 + cows + visitors + logsize, data=lakes.df2)
f5 <- glm(fish ~ 1 + cows + fish.rich + visitors + logsize, data=lakes.df2)
f6 <- glm(fish ~ 1 + stocked + cows + visitors + logsize, data=lakes.df2)
f7 <- glm(fish ~ 1 + stocked + cows + herp.rich + fish.rich + visitors + logsize, data=lakes.df2)
f8 <- glm(fish ~ 1 + stocked + cows + fish.rich + visitors + logsize, data=lakes.df2)
 
# average the models together
f.ave <- model.avg(f, f2, f3, f4, f5, f6, f7, f8)
summary(f.ave)
 
# Now we know the relative variable importance, all of the avereged coefficents,
# etc, and can use the "predict" funciton to predict how many fishermen will
# be at the next lake. Graphing these are more difficult, so we'll skip this for now.
# Ask me later if you really want to know.
 
# Model selection method #2: Use your brain
# We often can discard (or choose) some models a priori based on our knowlege of
# the system. It's usually better to do it this way if you have several hundered
# possible combination of variables, or want to put in some interaction terms.
# I used this method for my frog data.
 
# load package bbmle
library(bbmle)
 
# Decide on which set of models you want to use. This is hard. A statistician
# who knows a lot more than I do told me so. I spent a long time playing around
# with different transformations, predictor variables, and combinations
# before I came up with a set of hypotheses (models) that I was happy with.
 
m1 <- glm(treatment ~ 1+ logveg + bank.slope, family=binomial("logit"), data= fishlakes)
m2 <- glm(treatment ~ 1+ logveg + silt.total +bank.slope, family=binomial("logit"), data= fishlakes)
m3 <- glm(treatment ~ 1+ raca.basin + logveg + bank.slope, family=binomial("logit"), data= fishlakes)
m4 <- glm(treatment ~ 1+ BUBO.breeding + logveg + bank.slope, family=binomial("logit"), data= fishlakes)
m5 <- glm(treatment ~ 1+ BUBO.breeding + logveg + bank.slope + raca.basin, family=binomial("logit"), data= fishlakes)
m6 <- glm(treatment ~ 1+ raca.basin*BUBO.breeding, family=binomial("logit"), data= fishlakes)
m7 <- glm(treatment ~ 1+ herbacious + raca.basin + lakes.basin, family=binomial("logit"), data= fishlakes)
m8 <- glm(treatment ~ 1+ BUBO.breeding, family=binomial("logit"), data= fishlakes)
m9 <- glm(treatment ~ BUBO.breeding + herbacious + bank.slope + logveg, family=binomial("logit"), data= fishlakes)
m10 <- glm(treatment ~ BUBO.breeding*raca.basin + herbacious+ lakes.basin, family=binomial("logit"), data= fishlakes)
m11 <- glm(treatment ~ 1 + bank.slope + logveg + BUBO.breeding:raca.basin, family = binomial("logit"), data = fishlakes)
 
# Now let's rank them via AICc
AICctab(m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11, base=T, weights=T, nobs=length(fishlakes))
 
# Model m11 comes out ahead by quite a bit, but we'll average the top two models, just to show
# you how its done.
 
m.ave <- model.avg(m4, m11)
summary(m.ave)
 
#OK, there is a predictive model, but how good is it?
# Let's try cross-validation first. If this was a single model, we could try using
# the cv.glm function from the "boot" library like this:
 
library("boot")
cost <- function(r, pi = 0) mean(abs(r-pi) > 0.5) ## cost function necessary for binomial data
m11.cv <- cv.glm(data=fishlakes, m11, cost, K=42) # use leave-one-out cross validation (can use K-fold cross validation for larger data sets)
 
# Now lets see what our error rate was:
m11.cv$delta
# That's not too bad.
 
# IF we want to check the error rate of an averaged model, you need to get more creative.
# I've written some code to do this for averaged models that only have two component models.
# It shouldn't be too hard to adapt this for more models.
 
# function for leave one out cross validation of averaged models
 
Cross <- function(model1, model2, data, cost) {
library(MuMIn)
nobs <- nrow(data)
model.ave <- model.avg(model1, model2)
values <- matrix(NA, nrow=nobs, ncol=5)
values[,1] <- data$treatment
values[,2] <- predict(model.ave, type="response")
CV=0
for (i in 1:nobs) {
data2 <- data[-i,] # leave out one observasion
model12 <- glm(model1$formula, family=model1$family, data=data2)
model22 <- glm(model2$formula, family=model2$family, data=data2)
model.ave2 <- model.avg(model12, model22)
values[i,3] <- predict(model.ave2, newdata=data[i,], type="response")
values[i,4] <- round(values[i,3])
if (values[i,4]==values[i,1]) (values[i,5]=1) else values[i,5]=0
}
cv = mean(abs(values[,3]-values[,1])>0.5)
return(cv)
}
 
 
# Use the function on the component models
Cross(m11, m4, fishlakes, cost)
# That looks reasonable
 
# Another method to test model accurace is Area Under the Reciever Operater Curve (AUC)
# This is baisically a plot of true presences versus false presences in a
# presence-absense model.
 
# Load the library "pROC"
library(pROC)
 
# Make your reciever-operater curve
m.roc <-roc(fishlakes$treatment, predict(m.ave, backtransform=TRUE))
plot(m.roc)
# Looks like a pretty good fit. Not too bad for the small size of the data set.
 
# And that's all I got. Hopefully you will find it helpful. Let me know if there is anything
# else I have forgotton or done wrong. ~ Rosemary rosehartman@gmail.com

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.