I'm working with a dataset that I have already analyzed using GLMs. I want to use a LMEM, for which I have a random effect (species name) with seven different values (levels). I think the model is coded correctly but I am getting a boundary (singular) fit
error. Is there anything I can do to fix it, or do I just not have enough data?
Here's the data and the model:
years <- c(1986, 1986, 1986, 1986, 1986, 1986, 1986, 1989, 1989, 1989,
1989, 1989, 1989, 1989, 1992, 1992, 1992, 1992, 1992, 1992, 1992,
1995, 1995, 1995, 1995, 1995, 1995, 1995, 1998, 1998, 1998, 1998,
1998, 1998, 1998, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2003,
2003, 2003, 2003, 2003, 2003, 2003, 2004, 2004, 2004, 2004, 2004,
2004, 2004, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2006, 2006,
2006, 2006, 2006, 2006, 2006, 2007, 2007, 2007, 2007, 2007, 2007,
2007, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2009, 2009, 2009,
2009, 2009, 2009, 2009, 2010, 2010, 2010, 2010, 2010, 2010, 2010,
2011, 2011, 2011, 2011, 2011, 2011, 2011, 2012, 2012, 2012, 2012,
2012, 2012, 2012, 2013, 2013, 2013, 2013, 2013, 2013, 2013, 2014,
2014, 2014, 2014, 2014, 2014, 2014, 2015, 2015, 2015, 2015, 2015,
2015, 2015, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2017, 2017,
2017, 2017, 2017, 2017, 2017, 2018, 2018, 2018, 2018, 2018, 2018,
2018)
names <- c("Sebastes_saxicola", "Doryteuthis_opalescens", "Sebastes_diploproa",
"Sebastes_goodei", "Porichthys_notatus", "Zalembius_rosaceus",
"Sebastes_jordani", "Sebastes_saxicola", "Doryteuthis_opalescens",
"Sebastes_diploproa", "Sebastes_goodei", "Porichthys_notatus",
"Zalembius_rosaceus", "Sebastes_jordani", "Sebastes_saxicola",
"Doryteuthis_opalescens", "Sebastes_diploproa", "Sebastes_goodei",
"Porichthys_notatus", "Zalembius_rosaceus", "Sebastes_jordani",
"Sebastes_saxicola", "Doryteuthis_opalescens", "Sebastes_diploproa",
"Sebastes_goodei", "Porichthys_notatus", "Zalembius_rosaceus",
"Sebastes_jordani", "Sebastes_saxicola", "Doryteuthis_opalescens",
"Sebastes_diploproa", "Sebastes_goodei", "Porichthys_notatus",
"Zalembius_rosaceus", "Sebastes_jordani", "Sebastes_saxicola",
"Doryteuthis_opalescens", "Sebastes_diploproa", "Sebastes_goodei",
"Porichthys_notatus", "Zalembius_rosaceus", "Sebastes_jordani",
"Sebastes_saxicola", "Doryteuthis_opalescens", "Sebastes_diploproa",
"Sebastes_goodei", "Porichthys_notatus", "Zalembius_rosaceus",
"Sebastes_jordani", "Sebastes_saxicola", "Doryteuthis_opalescens",
"Sebastes_diploproa", "Sebastes_goodei", "Porichthys_notatus",
"Zalembius_rosaceus", "Sebastes_jordani", "Sebastes_saxicola",
"Doryteuthis_opalescens", "Sebastes_diploproa", "Sebastes_goodei",
"Porichthys_notatus", "Zalembius_rosaceus", "Sebastes_jordani",
"Sebastes_saxicola", "Doryteuthis_opalescens", "Sebastes_diploproa",
"Sebastes_goodei", "Porichthys_notatus", "Zalembius_rosaceus",
"Sebastes_jordani", "Sebastes_saxicola", "Doryteuthis_opalescens",
"Sebastes_diploproa", "Sebastes_goodei", "Porichthys_notatus",
"Zalembius_rosaceus", "Sebastes_jordani", "Sebastes_saxicola",
"Doryteuthis_opalescens", "Sebastes_diploproa", "Sebastes_goodei",
"Porichthys_notatus", "Zalembius_rosaceus", "Sebastes_jordani",
"Sebastes_saxicola", "Doryteuthis_opalescens", "Sebastes_diploproa",
"Sebastes_goodei", "Porichthys_notatus", "Zalembius_rosaceus",
"Sebastes_jordani", "Sebastes_saxicola", "Doryteuthis_opalescens",
"Sebastes_diploproa", "Sebastes_goodei", "Porichthys_notatus",
"Zalembius_rosaceus", "Sebastes_jordani", "Sebastes_saxicola",
"Doryteuthis_opalescens", "Sebastes_diploproa", "Sebastes_goodei",
"Porichthys_notatus", "Zalembius_rosaceus", "Sebastes_jordani",
"Sebastes_saxicola", "Doryteuthis_opalescens", "Sebastes_diploproa",
"Sebastes_goodei", "Porichthys_notatus", "Zalembius_rosaceus",
"Sebastes_jordani", "Sebastes_saxicola", "Doryteuthis_opalescens",
"Sebastes_diploproa", "Sebastes_goodei", "Porichthys_notatus",
"Zalembius_rosaceus", "Sebastes_jordani", "Sebastes_saxicola",
"Doryteuthis_opalescens", "Sebastes_diploproa", "Sebastes_goodei",
"Porichthys_notatus", "Zalembius_rosaceus", "Sebastes_jordani",
"Sebastes_saxicola", "Doryteuthis_opalescens", "Sebastes_diploproa",
"Sebastes_goodei", "Porichthys_notatus", "Zalembius_rosaceus",
"Sebastes_jordani", "Sebastes_saxicola", "Doryteuthis_opalescens",
"Sebastes_diploproa", "Sebastes_goodei", "Porichthys_notatus",
"Zalembius_rosaceus", "Sebastes_jordani", "Sebastes_saxicola",
"Doryteuthis_opalescens", "Sebastes_diploproa", "Sebastes_goodei",
"Porichthys_notatus", "Zalembius_rosaceus", "Sebastes_jordani",
"Sebastes_saxicola", "Doryteuthis_opalescens", "Sebastes_diploproa",
"Sebastes_goodei", "Porichthys_notatus", "Zalembius_rosaceus",
"Sebastes_jordani")
response <- c(-39.8709138425359, 407.466044766274, -26.0915713958357, 0,
-33.6719711059685, 0, -75.6863067646427, -21.9157783599194, -151.998948311348,
-39.8709138425359, -10.06179432113, -35.4184614200923, -14.1646625572561,
-66.2145076813456, -55.3994283434849, 235.06475172214, 0, 0,
35.4184614200923, -13.7332842084411, -292.805294792311, 77.3152067034043,
-161.67128821082, -21.9157783599194, 0, -21.2537988628362, 0,
-57.5347191454757, -85.2542653789872, 105.299273169127, 16.8957295404421,
10.06179432113, 151.767857499762, 0, -176.052245616132, -27.9448569025965,
-205.222077414222, 31.8249932238048, -22.7948535194005, -130.514058636926,
-19.7517644973778, 0, -26.7387649152365, -545.1351812725, 13.0659694382084,
12.7330591982704, 0, 0, 57.6747747172749, 0, 233.586964761608,
-13.0659694382084, 10.06179432113, 33.6719711059685, 0, -29.609694096876,
-11.785457443975, 292.805294792311, 13.0659694382084, 13.1774796846939,
0, 0, -28.0650806203989, 59.2610492829533, -429.550172022961,
6.85559176507104, 80.2310721874446, 0, 0, 0, 87.4422465383645,
-179.66580426546, -6.85559176507104, -45.9356270477929, -33.6719711059685,
0, -33.6719711059685, 5.02004881947732, -19.7517644973778, 0,
-47.4729248243457, 0, 0, -21.2537988628362, 39.8709138425359,
0, 0, 47.4729248243457, 0, 0, 0, 6.85559176507104, 199.417568762838,
0, 60.8493916525051, 33.6719711059685, -50.4063040829841, 54.9257699688047,
0, 136.74487723065, 0, 211.433641470909, 0, 50.4063040829841,
57.6747747172749, 0, 153.695910264002, 0, -118.587122859412,
-33.6719711059685, -50.4063040829841, 69.6620540066187, 0, 0,
0, 69.2503531572081, 0, 50.4063040829841, 460.539534398771, 0,
151.674999601701, -13.0659694382084, -29.0720714480331, 0, 19.7517644973778,
-20.6784687684094, 0, 106.100110890285, -11.5403645477877, 129.459481981691,
161.008799829862, 0, 0, -6.85559176507104, -350.621629103483,
-15.2645798565397, -204.172684985661, -30.4947411929359, 0, 44.4063661800535,
6.85559176507104, 211.433641470909, -28.5654519133886, 103.785274452003,
102.449432090998, 13.7332842084411, 112.059209783315, 0, 61.3278964692331,
0, 16.3182111045651, -102.449432090998, 0, 68.1437140131759)
predictor <- c(-354.759533536541, -350.844199644346, -354.909624391903, -332.463093102947,
-354.578556990442, -348.128295505361, -352.380852547713, -284.956183762223,
-276.278296156058, -285.583378598068, -246.632667111976, -284.369982324025,
-281.50293550981, -279.287099693954, 357.026006231806, 361.676164668339,
355.37545887245, 337.638508847381, 358.163123655813, 312.345335892108,
361.784912067963, 187.518093014004, 58.8031971422286, 203.817561806077,
-121.166159270693, 174.367399906722, 354.60256303185, 93.6842990855323,
482.344032540366, 530.926281271939, 477.037402165887, 586.041572597991,
486.84011371456, 473.64047689885, 517.134094932764, -781.827414991825,
-693.604827421178, -793.77449102808, -548.797929732289, -772.400956426057,
-952.59954421626, -717.060747190405, 84.1367164745104, 74.7959474790284,
85.1883129489936, 54.8977134653799, 83.2687089625126, 93.0478925699144,
77.5324699084499, 199.66604803451, 122.035995593604, 208.332075341629,
-25.6356793146804, 192.473094627032, 264.177296139558, 144.663593171232,
86.5535304707839, 129.854847960425, 82.4416244358297, 222.590682638225,
90.1292081937877, 81.0212058045088, 116.415624498391, -201.796155827009,
-162.015921438247, -207.337885377721, -106.113738901105, -197.440069170519,
-280.219718566966, -172.324777682873, -329.96058693694, -340.42625208768,
-327.191123872975, -321.131859459463, -331.917003362771, -258.070974146438,
-339.350899733633, 101.381043154278, 74.5061140852908, 104.471322665692,
17.3227886896084, 98.8484538033733, 132.375734298744, 82.3307661426661,
-115.979764494729, -109.317010210641, -116.742890715473, -94.6774706047613,
-115.353943363071, -123.438781895225, -111.263104791549, 427.610641780512,
390.961287299743, 430.530777973955, 301.976501093313, 424.921699211867,
406.084930648777, 402.972702246893, -289.888476299943, -225.23973581933,
-297.71449630178, -121.481919455317, -283.514417063728, -363.56260374216,
-243.269552209364, 38.2358900411646, 42.6049315763746, 37.3700873452678,
38.4348202239919, 38.880090642233, 22.7718483607262, 41.8445751226488,
148.214237853802, 130.575205944386, 149.283884563868, 70.2958522577696,
147.144578947908, 132.645118780561, 136.900863329067, 17.4821742483571,
1.98763559309828, 21.0211036377086, 13.5666287066495, 14.9306825351089,
98.9057697600572, 4.27913398710575, 376.836130396981, 335.886955719777,
383.530200966922, 300.868788921385, 371.746278421832, 498.831988504765,
345.305983617788, 11.8787639881436, 24.2169762020922, 9.81236914600981,
35.5941919990055, 13.4381699677704, -29.2757031165856, 21.4070153110549,
-229.103849808719, -223.932153734025, -229.715460489683, -207.219597605736,
-228.618305637208, -241.692343331574, -225.506335745496, -117.870661429788,
-87.4139337795068, -122.033743598906, -45.9980167000583, -114.577381619082,
-171.00564521108, -95.3527873096314)
testdf <- data.frame(years, names, response, predictor)
testlme <- lmer(response ~ predictor + (1|names), data=testdf)