2
$\begingroup$

I have a response variable which is the number of days it takes for an insect to emerge from the pupal stage. I measured this daily, and most of the individuals emerged after about 20-21 days, with a tail of some individuals trailing as far off as 33 days. For ease of analysis, I have a variable called, "ClaustPer", which is this number of days minus 20. ClaustPer is not continuous (it can only have a narrow range of integer values), but it also has quite a number of "categories", if they can be called that.

I want to figure out whether MLH, which is the average heterozygosity of these individual insects (across a number of genes), is a significant predictor of the number of days it take for an insect to emerge from the pupal stage.

I'm currently using generalized linear models (GLMs), but I'm not sure whether that's appropriate and/or how to designate the link function, so I thought I would make this more a question of how best to figure out which type of analysis is best suited to a not-quite-categorical response variable.

I provide the data set below in R (note that there are missing data designated as NA and some individuals have been omitted prior to analysis):

data<-structure(list(ID = c(1, 2, 3, 4, 7, 9, 10, 12, 13, 14, 15, 16, 
17, 18, 20, 21, 22, 23, 24, 25, 27, 28, 29, 31, 34, 37, 38, 39, 
40, 41, 43, 44, 45, 46, 47, 48, 49, 52, 55, 56, 59, 60, 61, 62, 
63, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 
82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 98, 99, 100, 
102, 103, 104, 105, 107, 108, 109, 111, 113, 114, 115, 116, 117, 
118, 119, 121, 123, 124, 125, 126, 127, 128, 129, 130, 131, 133, 
135, 136, 137, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 
149, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 
163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 
177, 178, 179, 182, 183, 184, 185, 186, 187, 188, 189, 191, 192, 
194, 195, 197, 198, 199, 202, 204, 205, 206, 208, 209, 210, 211, 
212, 213, 214, 215, 216, 217, 218, 219, 222, 224, 226, 228, 229, 
232, 233, 234, 235, 236, 237, 238, 239, 241, 242, 244, 245, 247, 
248, 251, 254, 255, 259, 260, 261, 262, 266, 267, 268, 269, 270, 
271, 273, 275, 276, 278, 279, 280, 281, 282, 285, 286, 287, 289, 
291, 292, 295, 296, 297, 298, 299, 302, 303, 305, 306, 307, 309, 
310, 312, 313, 314, 315, 316, 318, 319, 320, 321, 322, 324, 325, 
327, 328, 329, 330, 333, 334, 335, 336, 337, 338, 339, 340, 341, 
343, 344, 345, 346, 347, 349, 350, 351, 352, 353, 354, 355, 356, 
357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 369, 371, 
372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 
385, 387, 388, 389, 391, 392, 393, 394, 395, 396, 397, 401, 402, 
403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 
416, 417, 418, 419, 420, 421, 422, 423, 426, 427, 430, 434, 437, 
438, 439, 440, 442, 443, 445, 447, 448, 449, 450, 451, 452, 453, 
454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 467, 468, 
469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 
482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 
495, 496, 497, 499, 500, 501, 502, 503, 505, 507, 508, 509, 510, 
511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 
524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 
537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 
550, 551, 552, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 
565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 
578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 
591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 603, 604, 
605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 
618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 630, 631, 
632, 633, 634, 635, 636, 637, 638, 639, 641, 642, 643, 644, 645, 
646, 647, 648, 649, 650, 651, 652), MLH = c(0.534090909090909, 
0.5, NA, 0.40506329113924, 0.298507462686567, 0.410958904109589, 
0.293103448275862, 0.442105263157895, 0.48, 0.554347826086957, 
0.453488372093023, 0.535353535353535, 0.443298969072165, 0.304878048780488, 
0.457446808510638, 0.455555555555556, 0.397849462365591, 0.494252873563218, 
0.48314606741573, 0.377777777777778, 0.457446808510638, 0.445652173913043, 
0.3, 0.412371134020619, 0.354838709677419, 0.464646464646465, 
0.474226804123711, 0.43010752688172, 0.46078431372549, 0.541666666666667, 
0.494623655913978, 0.446808510638298, 0.413793103448276, 0.462962962962963, 
0.426966292134831, 0.494736842105263, 0.522222222222222, 0.460674157303371, 
0.524390243902439, 0.506493506493506, 0.505747126436782, 0.395348837209302, 
0.419354838709677, 0.456521739130435, 0.469387755102041, 0.375, 
0.4125, 0.295454545454545, 0.436363636363636, 0.486486486486487, 
0.411111111111111, 0.338028169014085, 0.319587628865979, 0.368421052631579, 
0.422222222222222, 0.381443298969072, 0.479591836734694, 0.483870967741935, 
0.469387755102041, 0.397849462365591, 0.427083333333333, 0.340659340659341, 
0.44, 0.26027397260274, 0.408602150537634, 0.463917525773196, 
0.36734693877551, 0.5, 0.402061855670103, 0.454545454545455, 
0.382022471910112, 0.494736842105263, 0.458333333333333, 0.434343434343434, 
0.505154639175258, 0.397959183673469, 0.494949494949495, 0.484848484848485, 
0.460674157303371, 0.389473684210526, 0.571428571428571, 0.417582417582418, 
0.533980582524272, 0.538461538461538, 0.5, 0.52, 0.421686746987952, 
0.451923076923077, 0.51, 0.456310679611651, 0.422680412371134, 
0.427184466019417, 0.526315789473684, 0.480392156862745, 0.376344086021505, 
0.463414634146341, 0.455445544554455, 0.505154639175258, 0.520408163265306, 
0.442307692307692, 0.431372549019608, 0.46, 0.39, 0.464646464646465, 
0.427184466019417, 0.354430379746835, 0.505050505050505, 0.49, 
0.451923076923077, 0.416666666666667, 0.52, 0.389473684210526, 
0.355769230769231, 0.47, 0.407766990291262, 0.443298969072165, 
0.297872340425532, 0.386138613861386, 0.43298969072165, 0.44, 
0.391304347826087, 0.436170212765957, 0.46078431372549, 0.446808510638298, 
0.461538461538462, 0.42156862745098, 0.423076923076923, 0.529411764705882, 
0.445544554455446, 0.436893203883495, 0.504854368932039, 0.436893203883495, 
0.563106796116505, 0.38, 0.436170212765957, 0.336538461538462, 
0.490384615384615, 0.442307692307692, 0.46078431372549, 0.461538461538462, 
0.346153846153846, 0.447916666666667, 0.427083333333333, 0.343434343434343, 
0.387755102040816, 0.307692307692308, 0.442105263157895, 0.436170212765957, 
0.445544554455446, 0.480769230769231, 0.495145631067961, 0.42156862745098, 
0.402061855670103, 0.408163265306122, 0.382352941176471, 0.45, 
0.524752475247525, 0.423076923076923, 0.444444444444444, 0.456521739130435, 
0.422680412371134, 0.524271844660194, 0.42156862745098, 0.480769230769231, 
0.574257425742574, 0.445544554455446, 0.490384615384615, 0.407766990291262, 
0.509615384615385, 0.451923076923077, 0.344086021505376, 0.5, 
0.519230769230769, 0.519607843137255, 0.470588235294118, 0.407766990291262, 
0.466019417475728, 0.310679611650485, 0.231578947368421, 0.423076923076923, 
0.368932038834951, 0.489795918367347, 0.5, 0.455445544554455, 
0.475728155339806, 0.470588235294118, 0.378640776699029, 0.423529411764706, 
0.485148514851485, 0.529411764705882, 0.465346534653465, 0.474226804123711, 
0.47, 0.535353535353535, 0.446601941747573, 0.388349514563107, 
0.444444444444444, 0.509803921568627, 0.405940594059406, 0.459770114942529, 
0.42156862745098, 0.4375, 0.509803921568627, 0.438775510204082, 
0.450980392156863, 0.484848484848485, 0.391752577319588, 0.452631578947368, 
0.468085106382979, 0.406976744186047, 0.427184466019417, 0.538461538461538, 
0.461538461538462, 0.425742574257426, 0.505376344086022, 0.495049504950495, 
0.38, 0.488636363636364, 0.434782608695652, 0.531914893617021, 
0.419354838709677, 0.515463917525773, 0.410526315789474, 0.446808510638298, 
0.494623655913978, 0.430232558139535, 0.438775510204082, 0.394230769230769, 
0.403846153846154, 0.415841584158416, 0.455445544554455, 0.455445544554455, 
0.484848484848485, 0.379310344827586, 0.393939393939394, 0.504854368932039, 
0.378640776699029, 0.441176470588235, 0.408163265306122, 0.439024390243902, 
0.495145631067961, 0.432692307692308, 0.378640776699029, 0.468085106382979, 
0.5, 0.473684210526316, 0.479591836734694, 0.480392156862745, 
0.494949494949495, 0.365853658536585, 0.475728155339806, 0.333333333333333, 
0.333333333333333, 0.514563106796116, 0.464646464646465, 0.461538461538462, 
0.442307692307692, 0.494252873563218, 0.456310679611651, 0.54, 
0.441176470588235, 0.495145631067961, 0.355555555555556, 0.461538461538462, 
0.43, 0.407766990291262, 0.431372549019608, 0.427184466019417, 
0.466019417475728, 0.519607843137255, 0.366336633663366, 0.403846153846154, 
0.407766990291262, 0.405940594059406, 0.489583333333333, 0.567307692307692, 
0.398058252427184, 0.423076923076923, 0.480769230769231, 0.425742574257426, 
0.466019417475728, 0.528846153846154, 0.524271844660194, 0.414634146341463, 
0.384615384615385, 0.469879518072289, 0.465116279069767, 0.517647058823529, 
0.387096774193548, 0.448275862068966, 0.443181818181818, 0.41304347826087, 
0.449438202247191, 0.402439024390244, 0.463157894736842, 0.395061728395062, 
0.376344086021505, 0.479591836734694, 0.519607843137255, 0.529411764705882, 
0.538461538461538, 0.446601941747573, 0.398058252427184, 0.470588235294118, 
0.424242424242424, 0.461538461538462, 0.398058252427184, 0.520408163265306, 
0.408163265306122, 0.445544554455446, 0.474226804123711, 0.414141414141414, 
0.5, 0.505050505050505, 0.422680412371134, 0.425287356321839, 
0.404040404040404, 0.428571428571429, 0.514563106796116, 0.388349514563107, 
0.411764705882353, 0.396039603960396, 0.432692307692308, 0.383838383838384, 
0.5, 0.46875, 0.435643564356436, 0.478723404255319, 0.480769230769231, 
0.432692307692308, 0.509803921568627, 0.485436893203884, 0.461538461538462, 
0.451612903225806, 0.5, 0.47, 0.455445544554455, 0.397959183673469, 
0.49, 0.395833333333333, 0.4375, 0.473684210526316, 0.436170212765957, 
0.407766990291262, 0.440860215053763, 0.39, 0.384615384615385, 
0.574257425742574, 0.44, 0.397849462365591, 0.416666666666667, 
0.376470588235294, 0.471910112359551, 0.478723404255319, 0.406593406593407, 
0.425531914893617, 0.41, 0.484848484848485, 0.469387755102041, 
0.366666666666667, 0.457446808510638, 0.465346534653465, 0.408163265306122, 
0.454545454545455, 0.398058252427184, 0.466019417475728, 0.470588235294118, 
0.444444444444444, 0.469387755102041, 0.373737373737374, 0.402061855670103, 
0.45, 0.435643564356436, 0.431578947368421, 0.377551020408163, 
0.415841584158416, 0.411764705882353, 0.450549450549451, 0.441176470588235, 
0.450980392156863, 0.363636363636364, 0.414141414141414, 0.401960784313726, 
0.392156862745098, 0.490196078431373, 0.41747572815534, 0.435643564356436, 
0.372549019607843, 0.475728155339806, 0.46, 0.450980392156863, 
0.411764705882353, 0.509803921568627, 0.309278350515464, 0.564356435643564, 
0.474226804123711, 0.504854368932039, 0.466019417475728, 0.441176470588235, 
0.455445544554455, 0.419354838709677, 0.401960784313726, 0.466019417475728, 
0.46078431372549, 0.510204081632653, 0.494949494949495, 0.490196078431373, 
0.438775510204082, 0.431372549019608, 0.445544554455446, 0.484848484848485, 
0.524271844660194, 0.427184466019417, 0.441176470588235, 0.474747474747475, 
0.42156862745098, 0.46, 0.411764705882353, 0.392156862745098, 
0.495145631067961, 0.49, 0.407766990291262, 0.520408163265306, 
0.42, 0.445544554455446, 0.442105263157895, 0.463917525773196, 
0.386138613861386, 0.47, 0.485148514851485, 0.5, 0.529411764705882, 
0.333333333333333, 0.4, 0.514563106796116, 0.45360824742268, 
0.46, 0.490196078431373, 0.553398058252427, 0.544554455445545, 
0.465346534653465, 0.525252525252525, 0.404040404040404, 0.418367346938776, 
0.461538461538462, 0.368932038834951, 0.53125, 0.347826086956522, 
0.485148514851485, 0.475247524752475, 0.444444444444444, 0.434210526315789, 
0.424242424242424, 0.375, 0.447761194029851, 0.493975903614458, 
0.357894736842105, 0.385416666666667, 0.565217391304348, 0.43956043956044, 
0.348314606741573, 0.450549450549451, 0.358695652173913, 0.479166666666667, 
0.518072289156627, 0.408163265306122, 0.458823529411765, 0.407894736842105, 
0.520408163265306, 0.434782608695652, 0.323529411764706, 0.442105263157895, 
0.44047619047619, 0.373626373626374, 0.456521739130435, 0.411764705882353, 
0.443298969072165, 0.352941176470588, 0.383720930232558, 0.438356164383562, 
0.529411764705882, 0.387755102040816, 0.428571428571429, 0.443298969072165, 
0.383838383838384, 0.414141414141414, 0.393939393939394, 0.414141414141414, 
0.484848484848485, 0.438775510204082, 0.412371134020619, 0.306122448979592, 
0.494949494949495, 0.371134020618557, 0.438775510204082, 0.473684210526316, 
0.444444444444444, 0.418367346938776, 0.459183673469388, 0.510416666666667, 
0.285714285714286, 0.3125, 0.369565217391304, 0.375, 0.326923076923077, 
0.38961038961039, 0.210526315789474, 0.324675324675325, 0.344086021505376, 
0.360824742268041, 0.414141414141414, 0.5, 0.454545454545455, 
0.46875, 0.414141414141414, 0.387755102040816, 0.505154639175258, 
0.474226804123711, 0.363636363636364, 0.414141414141414, 0.454545454545455, 
0.418367346938776, 0.285714285714286, 0.438775510204082, 0.387755102040816, 
0.40625, 0.425531914893617, 0.515151515151515, 0.43010752688172, 
0.402173913043478, 0.336734693877551, 0.459183673469388, 0.479166666666667, 
0.296296296296296, 0.424242424242424, 0.505050505050505, 0.540816326530612, 
0.458333333333333), ClaustPer = c(NA, 1L, 2L, NA, 3L, 0L, 2L, 
0L, 1L, 0L, 0L, 0L, 1L, NA, 0L, 7L, 1L, 0L, 1L, 0L, 1L, 2L, 2L, 
NA, 2L, 3L, 2L, 2L, NA, 0L, 1L, NA, NA, 0L, 0L, 0L, 0L, 3L, 3L, 
3L, 1L, 0L, 2L, NA, 1L, 0L, 1L, 1L, 3L, 1L, 2L, 0L, 2L, 1L, 0L, 
6L, 0L, 0L, NA, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, NA, 0L, 0L, NA, 
NA, 0L, 0L, 0L, 0L, 0L, 1L, 0L, NA, 1L, 0L, 2L, 1L, 2L, 1L, 1L, 
2L, 1L, 1L, NA, 1L, NA, NA, 2L, 1L, 1L, NA, 0L, 2L, 3L, 1L, NA, 
1L, NA, 4L, NA, 0L, 1L, 1L, NA, 1L, 0L, 0L, 3L, 3L, 2L, NA, 1L, 
0L, 0L, 1L, 1L, 0L, 0L, 1L, 2L, 4L, 1L, 1L, 0L, 0L, NA, 0L, 2L, 
1L, 2L, 2L, 0L, 0L, 1L, 0L, 2L, 2L, 0L, 0L, NA, 2L, 2L, 4L, NA, 
0L, 1L, 3L, 0L, 2L, NA, 2L, 3L, 2L, 2L, 3L, 2L, NA, NA, NA, 3L, 
NA, 1L, 0L, 8L, 2L, 3L, 1L, NA, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 5L, 
0L, 0L, 0L, 0L, 0L, 1L, 1L, NA, 1L, 3L, 1L, 0L, 1L, 1L, 0L, 0L, 
NA, 2L, 2L, 2L, 3L, NA, 1L, NA, 2L, 1L, 13L, 2L, 1L, NA, 2L, 
1L, NA, 2L, 2L, 1L, NA, 4L, 0L, 1L, 1L, 1L, 3L, 2L, 1L, 4L, 4L, 
NA, 6L, NA, NA, 2L, 1L, 1L, NA, 2L, 0L, 2L, 1L, 6L, 2L, NA, 4L, 
NA, 1L, NA, NA, 0L, 5L, 3L, 2L, NA, 2L, NA, NA, 4L, NA, 3L, 1L, 
6L, 5L, NA, 0L, 1L, 0L, NA, 0L, 2L, 0L, 0L, 1L, 0L, NA, 2L, 1L, 
NA, 1L, 0L, 3L, 2L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA)), .Names = c("ID", "MLH", "ClaustPer"), class = "data.frame", row.names = c(1L, 
2L, 3L, 4L, 7L, 9L, 10L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 20L, 
21L, 22L, 23L, 24L, 25L, 27L, 28L, 29L, 31L, 34L, 37L, 38L, 39L, 
40L, 41L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 52L, 55L, 56L, 59L, 
60L, 61L, 62L, 63L, 65L, 66L, 67L, 68L, 69L, 71L, 72L, 73L, 74L, 
75L, 76L, 77L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 
89L, 90L, 92L, 93L, 94L, 95L, 98L, 99L, 100L, 102L, 103L, 104L, 
105L, 107L, 108L, 109L, 111L, 113L, 114L, 115L, 116L, 117L, 118L, 
119L, 121L, 123L, 124L, 125L, 126L, 127L, 128L, 129L, 130L, 131L, 
133L, 135L, 136L, 137L, 139L, 140L, 141L, 142L, 143L, 144L, 145L, 
146L, 147L, 148L, 149L, 151L, 152L, 153L, 154L, 155L, 156L, 157L, 
158L, 159L, 160L, 161L, 162L, 163L, 164L, 165L, 166L, 167L, 168L, 
169L, 170L, 171L, 172L, 173L, 174L, 175L, 177L, 178L, 179L, 182L, 
183L, 184L, 185L, 186L, 187L, 188L, 189L, 191L, 192L, 194L, 195L, 
197L, 198L, 199L, 202L, 204L, 205L, 206L, 208L, 209L, 210L, 211L, 
212L, 213L, 214L, 215L, 216L, 217L, 218L, 219L, 222L, 224L, 226L, 
228L, 229L, 234L, 235L, 236L, 237L, 238L, 239L, 240L, 241L, 243L, 
244L, 246L, 247L, 249L, 250L, 253L, 256L, 257L, 261L, 262L, 263L, 
264L, 268L, 269L, 270L, 271L, 272L, 273L, 275L, 277L, 278L, 280L, 
281L, 282L, 283L, 284L, 287L, 288L, 289L, 291L, 293L, 294L, 297L, 
298L, 299L, 300L, 301L, 304L, 305L, 307L, 308L, 309L, 311L, 312L, 
314L, 315L, 316L, 317L, 318L, 320L, 321L, 322L, 323L, 324L, 326L, 
327L, 329L, 330L, 331L, 332L, 335L, 336L, 337L, 338L, 339L, 340L, 
341L, 342L, 343L, 345L, 346L, 347L, 348L, 349L, 351L, 352L, 353L, 
354L, 355L, 356L, 357L, 358L, 359L, 360L, 361L, 362L, 363L, 364L, 
365L, 366L, 367L, 368L, 369L, 371L, 373L, 374L, 375L, 376L, 377L, 
378L, 379L, 380L, 381L, 382L, 383L, 384L, 385L, 386L, 387L, 389L, 
390L, 391L, 393L, 394L, 395L, 396L, 397L, 398L, 399L, 403L, 404L, 
405L, 406L, 407L, 408L, 409L, 410L, 411L, 412L, 413L, 414L, 415L, 
416L, 417L, 418L, 419L, 420L, 421L, 422L, 423L, 424L, 425L, 428L, 
429L, 432L, 436L, 439L, 440L, 441L, 442L, 444L, 445L, 447L, 449L, 
450L, 451L, 452L, 453L, 454L, 455L, 456L, 457L, 458L, 459L, 460L, 
461L, 462L, 463L, 464L, 465L, 466L, 469L, 470L, 471L, 472L, 473L, 
474L, 475L, 476L, 477L, 478L, 479L, 480L, 481L, 482L, 483L, 484L, 
485L, 486L, 487L, 488L, 489L, 490L, 491L, 492L, 493L, 494L, 495L, 
496L, 497L, 498L, 499L, 501L, 502L, 503L, 504L, 505L, 507L, 509L, 
510L, 511L, 512L, 513L, 514L, 515L, 516L, 517L, 518L, 519L, 520L, 
521L, 522L, 523L, 524L, 525L, 526L, 527L, 528L, 529L, 530L, 531L, 
532L, 533L, 534L, 535L, 536L, 537L, 538L, 539L, 540L, 541L, 542L, 
543L, 544L, 545L, 546L, 547L, 548L, 549L, 550L, 551L, 552L, 553L, 
554L, 557L, 558L, 559L, 560L, 561L, 562L, 563L, 564L, 565L, 566L, 
567L, 568L, 569L, 570L, 571L, 572L, 573L, 574L, 575L, 576L, 577L, 
578L, 579L, 580L, 581L, 582L, 583L, 584L, 585L, 586L, 587L, 588L, 
589L, 590L, 591L, 592L, 593L, 594L, 595L, 596L, 597L, 598L, 599L, 
600L, 601L, 602L, 603L, 605L, 606L, 607L, 608L, 609L, 610L, 611L, 
612L, 613L, 614L, 615L, 616L, 617L, 618L, 619L, 620L, 621L, 622L, 
623L, 624L, 625L, 626L, 627L, 628L, 629L, 630L, 632L, 633L, 634L, 
635L, 636L, 637L, 638L, 639L, 640L, 641L, 643L, 644L, 645L, 646L, 
647L, 648L, 649L, 650L, 651L, 652L, 653L, 654L))

summary(data$ClaustPer)
    hist(data$ClaustPer)

summary(data$MLH)
    hist(data$MLH)
$\endgroup$
  • $\begingroup$ Your description of ClaustPer doesn't fit with the data. If the values vary from 20 to 33, and you have calculated 20 minus that, you are left with a negative number, but your values are positive. Please make your description match your data (or even better, post the original, unadulterated values, and then if you must, transform them in your code). $\endgroup$ – Glen_b Sep 5 '13 at 5:33
  • $\begingroup$ Also, ... it isn't a great idea to call your data data. (See here - require(fortunes); fortune("dog")) $\endgroup$ – Glen_b Sep 5 '13 at 5:48
  • $\begingroup$ And your title says you have a categorical predictor but MLH (which you state is the predictor in your 2nd paragraph) doesn't appear to be categorical. Indeed, your only categorical variable seems to be ID. The whole question seems confused. $\endgroup$ – Glen_b Sep 5 '13 at 5:56
  • $\begingroup$ Sorry! I hope that I edited the title and description to better reflect what I mean. $\endgroup$ – Atticus29 Sep 5 '13 at 13:18
6
$\begingroup$

If you're using MNH to predict CLaustPer, it sort of looks like you're predicting a count. However, it's not really a count. The process generating the number of days will not generate the chance of the next additional 'day' event independently of the number of events. You could instead think of it as a discretized survival time if you prefer.

I would consider a GLM for that. It's not clear to me that subtracting the minimum is necessarily the right thing to do (though in this case it may make your life easier).

My inclination would be to try a negative binomial model, since the discreteness seems too strong to treat it as continuous. A negative binomial may be flexible enough to model the mean and variance. [Nick Cox says in comments that a Poisson model adequately describes the data - it might be the case that it's so with these data but I wouldn't expect it in general.]

In any case, here's a smoothed scatterplot to help us investigate the relationship between the two variables. I also did it the other way around in case I misunderstood the intent (see my comments under the original question about the various ways the question/title are confusing). Neither variable seems to be much good at predicting the other.

scatterplot smooths

Code that generated the plots was something like:

 plot(ClaustPer~MLH,data=data,col="darkgreen")
 lines(with(data,loess.smooth(MLH,ClaustPer,span=1/2)),col="darkred")

 plot(MLH~ClaustPer,data=data,col="darkgreen")
 lines(with(data,loess.smooth(ClaustPer,MLH,span=1/2)),col="darkred")

(But then I edited the output to reduce margins and move the axis=labels.)

$\endgroup$
  • $\begingroup$ Thanks, @Glen_b. Do you have the syntax for these models? Also, because it's "count data" (is it count data?), did you use family=poisson? $\endgroup$ – Atticus29 Sep 5 '13 at 13:19
  • $\begingroup$ As @Glen_b implies your response variable ClaustPer is not categorical, but counted. Poisson regression on MH reveals a weak negative relationship. $\endgroup$ – Nick Cox Sep 5 '13 at 14:28
  • $\begingroup$ so, the syntax in R would be: $\endgroup$ – Atticus29 Sep 5 '13 at 14:51
  • 1
    $\begingroup$ Atticus29 "number of days" could be looked at as a count of days (though I don't think I could justify regarding it as coming from a Poisson process or anything; the probability of the next addition to the count is really unlikely to be independent of the current count) or as a continuous variable that has been discretized (which is probably a better way to describe it). Either way, it's effectively a ratio scale (40 days is twice as long as 20 days) that you've shifted - leaving it interval scale, not ordered categorical. ...(ctd) $\endgroup$ – Glen_b Sep 5 '13 at 22:47
  • 1
    $\begingroup$ (ctd)... I'd suggest a negative binomial would be reasonable first choice (see package MASS that comes with R, and I highly recommend the book), since there's no reason to suspect variance proportional to mean. [In comments you show code by enclosing in backquotes ` ... ` --- like so: here's some code ...] $\endgroup$ – Glen_b Sep 5 '13 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.