R中的高斯函数模型

时间:2018-03-21 20:21:45

标签: r function gaussian

我有两个珊瑚礁照片的藤壶密度和珊瑚覆盖数据集。我想知道藤壶密度是否有深度或珊瑚覆盖的图案。

我尝试过使用公式

的线性模型和负二项式
m2 <- glm.nb(dens.cm ~ depth + coral.cover+location+depth:location, data =data)

然而,在查看密度数据的深度分布后,我认为高斯函数可以更好地解释模式。

Density of barnacles per m2 by depth (m) and location

我正在寻找有关如何为R中的数据设计高斯模型的建议。任何建议都表示赞赏!

 > dput(dat)
structure(list(photo = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 
8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 
21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 
34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 
47L, 48L, 49L, 95L, 96L, 97L, 98L, 99L, 100L, 101L, 102L, 103L, 
104L, 105L, 106L, 107L, 108L, 109L, 110L, 111L, 112L, 113L, 50L, 
51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L, 
64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L, 76L, 
77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 89L, 
90L, 91L, 92L, 93L, 94L, 114L, 115L, 116L, 117L, 118L, 119L, 
120L, 121L, 122L, 123L, 124L, 125L, 126L, 127L, 128L, 129L, 130L, 
131L, 132L, 133L, 134L), .Label = c("101", "102", "103", "104", 
"105", "106", "107", "108", "201", "202", "203", "204", "205", 
"206", "207", "208", "209", "210", "211", "212", "301", "302", 
"303", "304", "305", "306", "307", "501", "502", "503", "504", 
"505", "506", "507", "508", "509", "510", "511", "512", "513", 
"601", "602", "603", "604", "605", "606", "607", "608", "609", 
"6157", "6173", "6177", "6178", "6181", "6182", "6199", "6201", 
"6202", "6203", "6210", "6211", "6214", "6222", "6237", "6241", 
"6245", "6256", "6260", "6261", "6296", "6297", "6299", "6302", 
"6304", "6308", "6309", "6311", "6312", "6313", "6314", "6315", 
"6320", "6322", "6323", "6324", "6325", "6326", "6327", "6328", 
"6329", "6424", "6426", "6428", "6431", "701", "702", "703", 
"704", "705", "706", "707", "708", "709", "801", "802", "803", 
"804", "805", "806", "807", "808", "809", "810", "D01", "D02", 
"D03", "D04", "D05", "D06", "D07", "D08", "D10", "D11", "D12", 
"D13", "D14", "D15", "D16", "D17", "D18", "D19", "D20", "D21", 
"D22"), class = "factor"), location = structure(c(1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L), .Label = c("fgb", "usvi"), class = "factor"), depth = c(19.5072, 
19.812, 21.5, 20.7264, 21.336, 19.5072, 19.812, 20.0312, 21.9456, 
23.4696, 23.4696, 24.0792, 23.1648, 23.4696, 21.336, 19.5072, 
20.1168, 20.7264, 21.0312, 21.0312, 21.9456, 20.4216, 19.5072, 
21.0312, 22.2504, 21.9456, 20.4216, 20.4216, 20.4216, 21.336, 
20.7264, 20.7264, 20.4216, 20.4216, 19.812, 20.1168, 20.1168, 
20.7264, 19.812, 21.9456, 22.86, 22.2504, 21.9456, 22.5552, 22.2504, 
21.0312, 21.336, 21.336, 21.6408, 23.4696, 23.7744, 21.9456, 
22.2504, 22.2504, 21.6408, 22.2504, 22.2504, 21.5, 23.1648, 22.5552, 
22.2504, 22.5552, 22.2504, 21.9456, 21.85, 22.2504, 24.0792, 
22.2504, 15, 15, 15, 15, 15, 15, 13, 13, 13, 13, 13, 13, 13, 
21, 21, 21, 21, 7, 7, 7, 32, 32, 32, 32, 32, 32, 32, 32, 32, 
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 38, 38, 38, 38, 
32.6992, 29.5656, 31.0896, 31.0896, 32.6136, 33.8328, 35.3568, 
35.3568, 31.0896, 37.7952, 29.5656, 31.0896, 31.0896, 32.6136, 
33.8328, 35.3568, 35.3568, 36.8808, 37.7952, 37.7952, 38.1), 
    dens.m = c(267.86719, 350.47852, 431.81125, 622.71004, 599.24271, 
    1420.18674, 193.38521, 161.44909, 910.49021, 110.35386, 479.12616, 
    408.42407, 315.60503, 74.8805, 104.48846, 137.99029, 469.71577, 
    356.37609, 950.49046, 272.49611, 528.00183, 269.93556, 480.50256, 
    118.2897, 185.00516, 438.49583, 276.08897, 227.43988, 86.33476, 
    185.46051, 84.80511, 451.02732, 400.5159, 163.67933, 90.92022, 
    137.38598, 202.10666, 159.44588, 197.77431, 453.77111, 101.17702, 
    134.19122, 122.93134, 429.97449, 430.17319, 1153.40396, 214.65884, 
    1342.54685, 578.08208, 578.44438, 252.6739, 2174.60653, 354.51124, 
    340.84014, 390.41988, 244.08631, 806.81267, 651.94004, 57.84774, 
    303.84401, 411.5247, 555.01574, 118.71732, 94.01832, 572.41467, 
    444.28938, 123.78678, 320.6036361, 0, 0, 49.41053235, 0, 
    125.6693464, 0, 93.84212658, 198.2007337, 327.6507767, 907.6881184, 
    0, 239.4739237, 0, 0, 443.5415909, 0, 51.88753895, 401.7879564, 
    0, 428.9613238, 0, 17.05628117, 0, 0, 0, 62.93519689, 0, 
    14.42007124, 0, 0, 0, 52.11494159, 0, 0, 0, 0, 0, 0, 0, 10.83275387, 
    141.8632389, 0, 0, 0, 0, 446.919281, 132.8611692, 143.198051, 
    33.05694578, 167.1561242, 51.78159277, 99.97872, 75.88997, 
    502.1027409, 354.7612359, 18.01753245, 59.73474983, 101.6708376, 
    192.2764503, 279.5383788, 138.1696187, 289.6458105, 166.5402349, 
    65.25117077, 649.1753683, 346.42269), coral.cover = c(28.52606, 
    11.05908, 31.28802, 28.91658, 3.54822, 12.18002, 16.72137, 
    1.92059, 23.42574, 64.22509, 37.25867, 48.04682, 58.10703, 
    36.08555, 45.99744, 67.4129, 41.21151, 53.32379, 14.54049, 
    40.63984, 57.09064, 42.2561, 39.77932, 23.7793, 35.67588, 
    28.4876, 35.53832, 21.61865, 35.1461, 14.45028, 45.70443, 
    52.544, 53.58537, 27.60442, 16.56497, 6.12609, 31.23248, 
    48.8958, 25.30934, 40.41436, 28.02014, 36.47627, 28.28651, 
    13.44436, 25.07424, 38.02122, 49.11345, 7.12683, 24.52069, 
    15.27754, 35.67601, 8.35171, 1.87428, 6.0433, 20.08231, 13.70174, 
    39.39322, 9.61437, 10.3376, 50.15105, 37.62041, 39.14767, 
    41.23067, 38.1632, 46.12196, 16.10196, 36.32152, 44.90422, 
    2.0575, 12.13155, 5.20272, 5.34756, 4.0912, 0.60427, 5.47876, 
    1.29702, 0.78458, 0.56643, 0.75587, 2.14695, 8.99664, 0.73209, 
    1.15917, 1.40533, 4.95436, 0.63981, 1.03059, 1.19857, 0.38732, 
    60.28733, 25.67675, 10.33979, 13.07546, 4.08467, 6.10119, 
    35.65439, 5.54589, 15.93534, 6.06176, 9.86548, 7.00005, 21.27449, 
    12.13181, 26.65331, 5.83493, 14.69534, 6.87034, 23.73075, 
    7.24837, 1.58201, 2.56882, 0.35245, 20.23897, 42.96672, 44.67648, 
    28.76856, 37.52041, 40.01538, 4.705, 29.9067, 30.06042, 7.45481, 
    14.35932, 8.60488, 16.68506, 23.30932, 14.51399, 33.59438, 
    38.95256, 43.35688, 2.65983, 9.84355, 37.1201, 50.76407)), .Names = c("photo", 
"location", "depth", "dens.m", "coral.cover"), class = "data.frame", row.names = c(NA, 
-134L))

0 个答案:

没有答案