0
$\begingroup$

I've got repeated measurements data on a continuous, time-varying exposure and a continuous outcome. The exposure was measured 1-3 times per patient, and the outcome was measured only once for all patients (at the last measurement of the exposure). I'm trying to determine if an association exists between my exposure and my outcome.

The data looks as follows:

data <- 
structure(list(id = c(23, 45, 48, 74, 80, 157, 159, 230, 269, 
272, 275, 283, 345, 353, 357, 425, 515, 594, 600, 636, 651, 830, 
902, 916, 945, 1002, 1065, 1069, 1117, 1129, 1226, 1283, 1294, 
1302, 1324, 1345, 1368, 1383, 1397, 1489, 1518, 1519, 1525, 1537, 
1560, 1567, 1631, 1632, 1642, 1656, 1768, 1784, 1812, 1923, 1934, 
1937, 1962, 1984, 1987, 1991, 2035, 2097, 2139, 2239, 2266, 2283, 
2311, 2329, 2333, 2446, 2511, 2617, 2640, 2669, 2689, 2717, 2803, 
2842, 3177, 3185, 3187, 3299, 3308, 3309, 3403, 3420, 3434, 3463, 
3474, 3477, 3480, 3483, 3490, 3515, 3519, 3534, 12002, 12002, 
12002, 17001, 17001, 17001, 17002, 17002, 17002, 42001, 42001, 
42001, 66001, 66001, 66001, 82002, 82002, 82002, 166002, 166002, 
166002, 177001, 177001, 177001, 177002, 177002, 177002, 231001, 
240001, 240001, 240001, 248002, 248002, 248002, 270001, 270001, 
270001, 270002, 270002, 270002, 287002, 287002, 287002, 298001, 
298001, 298001, 323001, 323001, 323001, 323002, 323002, 323002, 
352001, 352001, 352001, 370001, 370001, 370001, 370002, 370002, 
370002, 383002, 383002, 383002, 402002, 402002, 402002, 410001, 
419001, 419001, 419001, 426001, 426001, 426001, 426002, 426002, 
426002, 443002, 443002, 443002, 466001, 466001, 466001, 466002, 
466002, 466002, 469001, 469001, 469001, 469002, 469002, 469002, 
470001, 470001, 470001, 470002, 470002, 470002, 485001, 485001, 
485001, 485002, 485002, 485002, 489001, 489001, 489001, 489002, 
489002, 489002, 520002, 520002, 520002, 542001, 542001, 542001, 
567001, 567001, 567001, 567002, 567002, 567002, 789001, 871001, 
881002, 900001, 1263001, 1582001, 1609002, 1627001, 1655002, 
1736002, 1795002, 1878002, 1921001, 1993001, 2018002, 2112001, 
2692002, 2731001, 3094001, 3233001, 3242002, 3392001, 3502001, 
3767001, 3930001, 3953001, 4259001, 4281003, 4526002, 4584001, 
4638001, 4833001, 4887002, 4919001, 4969001, 5361001, 5573002, 
5677001, 5690001, 5837001, 5869001, 5897002, 6026001, 6072001, 
6095002, 6195002, 6761002, 6976001, 7069001, 7121001, 7477002, 
7546002, 7816001, 7884002, 8254002, 8339001, 8638001, 8961002, 
9389001, 9482001, 9542001, 9591002), date = structure(c(12724, 
12725, 12739, 12719, 12675, 12570, 12809, 12921, 12794, 12838, 
12402, 12691, 12773, 12733, 12697, 13090, 12822, 12878, 12899, 
12921, 12852, 12810, 12956, 12676, 12872, 12746, 12472, 12299, 
12957, 12571, 12795, 12829, 13012, 12886, 12661, 12649, 12710, 
12656, 12571, 12739, 12718, 12803, 12885, 13026, 12767, 12647, 
13034, 12754, 12922, 12690, 12801, 12703, 12887, 12556, 12571, 
13039, 12747, 12864, 12733, 12711, 12871, 12866, 12746, 12900, 
12892, 12703, 12704, 12759, 12837, 12703, 12731, 12857, 12731, 
12670, 12563, 12766, 12669, 13062, 12710, 12865, 12747, 12682, 
12759, 12711, 12873, 12677, 12936, 12830, 13032, 13041, 12738, 
12950, 12838, 12823, 12803, 12864, 8771, 10136, 12495, 8999, 
10787, 12444, 8999, 10787, 12444, 8929, 10786, 12495, 8922, 10708, 
12340, 9045, 10919, 12486, 8853, 10647, 12467, 8846, 10675, 12236, 
8846, 10675, 12236, 12864, 9015, 10870, 12423, 8833, 10597, 12522, 
8889, 10625, 12340, 8889, 10625, 12340, 8903, 10729, 12346, 9009, 
10779, 12381, 8904, 10743, 12494, 8904, 10743, 12494, 8728, 10233, 
11997, 8754, 10323, 12493, 8754, 10323, 12493, 8803, 10519, 12305, 
8924, 10759, 12438, 12724, 8929, 10899, 12383, 8929, 10773, 12388, 
8929, 10773, 12388, 8925, 10730, 12389, 8877, 10689, 12313, 8877, 
10689, 12313, 8905, 10729, 12340, 8905, 10729, 12340, 8910, 10738, 
12354, 8910, 10738, 12354, 8994, 10869, 12431, 8994, 10869, 12431, 
8874, 10667, 12285, 8874, 10667, 12285, 9014, 10771, 12369, 9106, 
10744, 12374, 8903, 10708, 12367, 8903, 10708, 12367, 12829, 
12880, 12341, 12726, 12920, 12724, 12767, 12661, 12661, 12318, 
12887, 13046, 12850, 12683, 12767, 12893, 12683, 12710, 12598, 
12577, 12341, 12787, 12914, 12794, 12880, 12676, 12738, 12668, 
13034, 12864, 12936, 12752, 13019, 13069, 12878, 12731, 12817, 
12676, 12914, 12809, 12746, 12816, 12668, 12942, 12299, 13039, 
12956, 12831, 12325, 12725, 12655, 12801, 12711, 13048, 12886, 
13025, 12851, 13040, 13012, 12725, 12731, 12796), class = "Date"), 
    outcome = c(1.88068567842246, 3.27048107059387, 0, 5.83438959576348, 
    3.03201598563124, 1.69285952057317, 4.63430171249434, 5.08172729420367, 
    2.61564247177706, 4.20236154634114, 3.12284938861346, 2.62169315544568, 
    5.05169406058382, 0, 0, 4.77703728487819, 0, 0, 0, 5.41943705161555, 
    0.982078472412158, 1.12525421961453, 4.78256294954529, 0, 
    2.77277620466385, 3.25478336320662, 2.33029753156058, 0, 
    3.39272828657078, 2.71469474382088, 0, 4.26622288893024, 
    0, 4.77657402749674, 4.08471501324626, 3.91981258770298, 
    3.04385554873572, 0, 2.57482352395197, 4.13196142579341, 
    3.2236643416, 2.3998025437094, 3.75861538279883, 3.03206420280138, 
    3.62564674669707, 3.02276361260502, 1.20207099703634, 3.95818113740923, 
    5.83189127489878, 0.712949807856125, 1.24242399070019, 3.96959355655008, 
    0, 0, 4.51407411434397, 0, 0, 0, 3.05936413379876, 2.45770672986135, 
    3.54365134945709, 0, 4.29872654415124, 0, 2.84537439196543, 
    2.31698097327778, 2.9819375625318, 2.02432515912117, 5.22585957056592, 
    4.17411030846844, 4.78279740828163, 5.96758416706743, 4.14288072588217, 
    2.0597489083341, 5.89105840491529, 3.68235823712367, 4.32768923802063, 
    0, 5.65178717953782, 2.95667954629029, 0.940007258491471, 
    3.97578622609797, 0, 2.61965605033961, 0, 2.44824266541641, 
    0, 0, 2.2236501049059, 4.92705076601978, 3.58928008889118, 
    4.62602128305554, 2.68150086586867, 4.29462881939023, 4.81881274548123, 
    5.96982969230767, 0, 0, 0, 4.76311366405405, 4.76311366405405, 
    4.76311366405405, 5.56098158602453, 5.56098158602453, 5.56098158602453, 
    4.1151107774059, 4.1151107774059, 4.1151107774059, 0, 0, 
    0, 5.33096363067988, 5.33096363067988, 5.33096363067988, 
    4.53338413148064, 4.53338413148064, 4.53338413148064, 3.77945115229832, 
    3.77945115229832, 3.77945115229832, 2.202654254369, 2.202654254369, 
    2.202654254369, 6.46769872610435, 3.06577126433397, 3.06577126433397, 
    3.06577126433397, 2.52556863150689, 2.52556863150689, 2.52556863150689, 
    4.6013227942592, 4.6013227942592, 4.6013227942592, 0, 0, 
    0, 4.90781229695415, 4.90781229695415, 4.90781229695415, 
    3.18366306911246, 3.18366306911246, 3.18366306911246, 5.1364746789354, 
    5.1364746789354, 5.1364746789354, 0, 0, 0, 0, 0, 0, 5.61607267200596, 
    5.61607267200596, 5.61607267200596, 2.82286587553079, 2.82286587553079, 
    2.82286587553079, 3.97784819844832, 3.97784819844832, 3.97784819844832, 
    0, 0, 0, 3.9936214254304, 5.87578149244724, 5.87578149244724, 
    5.87578149244724, 4.34346770249526, 4.34346770249526, 4.34346770249526, 
    2.83896149760404, 2.83896149760404, 2.83896149760404, 5.2440881877189, 
    5.2440881877189, 5.2440881877189, 4.69790432336967, 4.69790432336967, 
    4.69790432336967, 4.9563832409308, 4.9563832409308, 4.9563832409308, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 6.05794259240198, 6.05794259240198, 
    6.05794259240198, 6.01595713969569, 6.01595713969569, 6.01595713969569, 
    4.23461362236812, 4.23461362236812, 4.23461362236812, 4.28976056685565, 
    4.28976056685565, 4.28976056685565, 6.11094613939995, 6.11094613939995, 
    6.11094613939995, 6.4899371859578, 6.4899371859578, 6.4899371859578, 
    2.940853612044, 2.940853612044, 2.940853612044, 5.27622512007322, 
    5.27622512007322, 5.27622512007322, 3.09099699777977, 3.09099699777977, 
    3.09099699777977, 2.54733356806064, 3.4493524235492, 5.24495350897062, 
    5.69606947244904, 6.56342383957464, 3.26736118068352, 4.81881274548123, 
    0, 2.67020986811903, 5.06751959629697, 6.52751629965585, 
    5.82010963622721, 4.25113461298629, 0.324255052682621, 0.929404371019538, 
    0, 1.66732939084988, 3.29007958387453, 0, 2.39971180372477, 
    1.82487182067826, 5.37159570893985, 4.41119701197366, 5.72605916312055, 
    3.95239689956642, 5.85883845885748, 0, 0, 5.77465713003228, 
    4.18084330783872, 4.28713886564156, 0, 5.03634202643966, 
    5.82626850793597, 3.88553528259104, 3.24629642044419, 4.44549427011799, 
    4.70239671024907, 4.69741202688786, 6.27720348289192, 2.19355117196991, 
    4.38901466144151, 4.00115047524659, 5.27496685293979, 0, 
    2.0736749467855, 0, 5.75725056911743, 5.6884082275944, 1.85957386881191, 
    0, 1.03211629737975, 1.92161745648627, 5.23945338140085, 
    0, 5.96758416706743, 5.72997964588727, 5.22276373454688, 
    5.26454339294082, 0, 4.70313139416397, 0), exposure = c(1.87593674272667, 
    0.820971004720162, -0.768575216211098, 4.4471404717178, 2.20667086217747, 
    2.63192659669013, -6.61624852821302, -2.56078579841831, 3.79362757205555, 
    2.43112889475988, 1.03613755279581, 6.07356652385703, 1.05482287254524, 
    3.08999833027217, 3.05674114988702, -6.05661606490712, 3.45463374572936, 
    0.155524803065787, -0.335732406794617, -2.93315501414611, 
    0.938644394474783, 1.40641502376342, -1.74760301009301, 0, 
    1.00054787015477, 2.52538056442227, 1.12827245347131, -1.23455746903044, 
    3.21296622097115, -2.29861548143486, -1.47871500576911, 0.193888980311178, 
    -0.245230784380427, 1.32419718846018, -1.33193545446258, 
    3.15548350539826, 3.09481443823081, 0.590716275974881, 4.32651615168086, 
    2.32256407747995, 3.18445576781493, 1.80226189418835, -4.65308178722813, 
    -1.81322500041369, 3.27238030389908, -1.08617382604651, 2.13677713750841, 
    0.0770891638279281, 0.462619929704569, -0.65522494967447, 
    1.67999006494582, 0.571804294989961, 3.06747321297348, 7.64281230382925, 
    4.15027795259073, 4.43118317273337, -0.908955168166038, 2.50961934863268, 
    7.58181283862737, 2.55591816481545, 0.910164689347896, -2.52535977795996, 
    -3.78445807770961, 5.60748034622409, -0.943839097291012, 
    0.462618171869775, -0.0734868055723219, -2.12486612986395, 
    0.519095071498447, 2.31982670871922, -8.14627773972057, -7.07738771604569, 
    3.99876114608392, 2.02832153269471, 1.69452208909869, 3.76407802723592, 
    3.61067778343046, -1.14226294721041, 2.84213597899037, 4.53614008941878, 
    -0.165480777725676, 0.301500693389685, 0.801338306274682, 
    2.72308883408843, 3.78827165615665, 1.66134490475411, 1.02250776853951, 
    2.36113286640262, 1.54479404256605, -5.94651796979934, -0.672902878145165, 
    1.09548982116747, 0.200528704016339, 0.482442526268517, 0.563457414806473, 
    0.722594812748531, 9.60296117124764, -0.994730176886311, 
    1.97658582341959, -2.88393209632846, 1.93281474101405, -0.137767803258902, 
    -3.04755944931164, -0.0741482843883604, 3.74104916669763, 
    -9.16066054173927, 2.44333176130605, 0.186656309647614, -11.3881802721088, 
    0.929578540160847, 1.90472465581977, -2.66489128848679, 4.18133038889484, 
    7.76962348436503, -12.8047369638838, 1.9793989223337, 2.13898170794723, 
    6.01846997318633, 2.83444152454188, 1.500776021949, -12.5252906278934, 
    2.9954893384363, 0.359976346523432, -1.96492455012508, 9.14886155850011, 
    2.57887078691888, -0.0782662079620465, -4.59087481146305, 
    0, 2.06107630388781, -13.600819214299, 5.16216829698662, 
    -1.91602691496767, -9.75293547231064, 3.14026067817594, 2.63615730145013, 
    15.4127472527473, 2.33708968959248, -0.295269623000715, 4.02615603864354, 
    1.90482398956975, 1.22359349560813, 0, -2.42581223615556, 
    3.13676824843376, -6.94061757719715, 3.3354918247139, 2.0929273095737, 
    7.91869918699187, -0.839761349136098, 1.94550974752317, 14.001009265347, 
    -0.070436183660541, -5.17901453385324, -1.22518463026427, 
    -4.04854933909718, 4.33017190278601, 9.65642800490302, 3.8908000601549, 
    1.17420447178212, -5.19042205485292, 3.77501644273231, 2.5023177282175, 
    1.62550066755674, -13.4192997028849, 1.67283691462158, 1.2090367428004, 
    -11.463019144262, 3.02217277545453, 3.88157216983945, -4.92601583723484, 
    4.17879403608007, 1.74289203851507, 1.82078763708873, 2.01236589583875, 
    2.40974152744415, 1.90219514100461, -1.31104291175362, 3.64715084542671, 
    -1.42098506069094, 2.39154226063531, -1.48699263119326, 11.6705719458941, 
    2.42291393519386, -0.306381800795209, 4.21314987229134, 1.00482220335786, 
    0.157994796228888, -8.79564131121881, 4.34957352744161, -0.632718306822906, 
    -20.8165946148821, 5.67113330589076, 2.58661680200718, 2.16791310541311, 
    1.90358306188925, 2.27963051573845, 4.08077761018938, 1.54886850152905, 
    -1.85923715772533, -4.98566748566749, 3.86788989530311, -4.60110382401801, 
    -8.55511638120334, 2.2222785580287, 1.93705711733102, -5.81015321653495, 
    3.63597213535862, 4.47039477580414, -5.65294775941712, 0.999119685474064, 
    2.60655624489232, -4.70137726863174, 0.825937023008649, -0.898623463852087, 
    -10.913237193852, 5.1064995226693, -5.93227899571425, 1.03609673072832, 
    3.57276243830866, 0.589574102321978, -0.372415269790774, 
    -4.69763934196219, -0.479925892346808, 1.12557985240615, 
    3.38454007602449, 1.13728359696102, 17.2633817795108, 5.68304159608507, 
    -3.72432275468879, 0, 0.815752478773313, 0.953130259830746, 
    1.78036119031951, 2.05071819585458, -1.53454028562126, 2.53412951523715, 
    -1.10606404724052, 2.76129276129276, 4.86869121203977, 2.8018205760896, 
    5.47305801965955, 0.359239916201942, 1.9394544652485, 6.00304539082516, 
    -2.97976313403369, 5.08100783095686, 0.0831232967120498, 
    1.1216734018719, -0.178966477778023, 0.967129511947128, -1.96722257487449, 
    -4.24723756906077, 4.19564536340852, 1.71962172816045, 6.40839441671865, 
    2.46782203303942, -3.18261692209067, 3.87225019878081, -0.180319613738355, 
    3.35720891130727, -0.60276007178662, 2.5605418612563, -5.83732069002257, 
    1.91215349579876, -0.89432387312187, 0.282216315618674, -1.77719247252487, 
    3.49583454668749, 3.72813732730515, -2.50231219812969, 5.27243763242959, 
    1.96272160153979, -5.6354435067039, -2.26634748551771, -0.767811815157583, 
    0.718505071056618, 2.36725546137663, 2.03781431459141, -3.10729416568833
    ), age = c(61.9438740588638, 62.0150581793292, 64.7830253251198, 
    63.605749486653, 62.2833675564682, 62.299794661191, 61.8151950718686, 
    64.9472963723477, 61.7138945927447, 65.305954825462, 62.9404517453799, 
    64.1724845995893, 64.5886379192334, 65.2101300479124, 63.7700205338809, 
    65.4784394250513, 60.5557837097878, 63.1485284052019, 63.7754962354552, 
    79.8713210130048, 63.854893908282, 61.864476386037, 76.4024640657084, 
    61.8891170431211, 65.8973305954825, 62.2203969883641, 61.0212183436003, 
    60.5119780971937, 71.0581793292266, 73.5222450376454, 62.839151266256, 
    63.7289527720739, 64.3148528405202, 75.1348391512663, 64.4490075290897, 
    61.7138945927447, 61.2594113620808, 62.3162217659138, 64.7939767282683, 
    63.2826830937714, 60.2792607802875, 63.1895961670089, 63.6495550992471, 
    74.9295003422313, 64.3613963039014, 64.0465434633812, 61.1444216290212, 
    71.2416153319644, 81.0294318959617, 61.8754277891855, 64.4791238877481, 
    78.5215605749487, 64.6570841889117, 61.6481861738535, 74.9596167008898, 
    62.1026694045175, 62.8939082819986, 65.8918548939083, 64.1724845995893, 
    61.4729637234771, 63.3976728268309, 64.0383299110198, 66.8281998631075, 
    64.8186173853525, 70.507871321013, 64.0848733744011, 83.5811088295688, 
    60.6351813826146, 64.0492813141684, 75.2772073921971, 82.7186858316222, 
    64.9664613278576, 62.5790554414784, 63.5947980835045, 75.937029431896, 
    62.5927446954141, 75.9479808350445, 62.6009582477755, 63.7891854893908, 
    63.6741957563313, 69.9329226557153, 62.0506502395619, 60.7227926078029, 
    61.4893908281999, 60.9062286105407, 60.8843258042437, 61.864476386037, 
    60.9582477754962, 61.5112936344969, 61.5496235455168, 60.5420944558522, 
    61.3442847364819, 60.766598220397, 60.9308692676249, 61.6974674880219, 
    67.3456536618754, 84.8542094455852, 84.8542094455852, 84.8542094455852, 
    78.9596167008898, 78.9596167008898, 78.9596167008898, 77.5304585900068, 
    77.5304585900068, 77.5304585900068, 69.1225188227242, 69.1225188227242, 
    69.1225188227242, 68.0793976728268, 68.0793976728268, 68.0793976728268, 
    72.1396303901437, 72.1396303901437, 72.1396303901437, 92.3258042436687, 
    92.3258042436687, 92.3258042436687, 70.5571526351814, 70.5571526351814, 
    70.5571526351814, 69.0239561943874, 69.0239561943874, 69.0239561943874, 
    66.4147843942505, 77.2594113620808, 77.2594113620808, 77.2594113620808, 
    76.2655715263518, 76.2655715263518, 76.2655715263518, 73.3169062286105, 
    73.3169062286105, 73.3169062286105, 68.0355920602327, 68.0355920602327, 
    68.0355920602327, 81.3086926762491, 81.3086926762491, 81.3086926762491, 
    66.17659137577, 66.17659137577, 66.17659137577, 75.1266255989049, 
    75.1266255989049, 75.1266255989049, 68.8761122518823, 68.8761122518823, 
    68.8761122518823, 68.0465434633812, 68.0465434633812, 68.0465434633812, 
    77.5496235455168, 77.5496235455168, 77.5496235455168, 74.2477754962354, 
    74.2477754962354, 74.2477754962354, 76.5530458590007, 76.5530458590007, 
    76.5530458590007, 74.1711156741958, 74.1711156741958, 74.1711156741958, 
    66.4804928131417, 76.7967145790554, 76.7967145790554, 76.7967145790554, 
    73.9137577002053, 73.9137577002053, 73.9137577002053, 69.09787816564, 
    69.09787816564, 69.09787816564, 81.8097193702943, 81.8097193702943, 
    81.8097193702943, 69.9028062970568, 69.9028062970568, 69.9028062970568, 
    66.7953456536619, 66.7953456536619, 66.7953456536619, 74.3737166324435, 
    74.3737166324435, 74.3737166324435, 72.0246406570842, 72.0246406570842, 
    72.0246406570842, 69.1526351813826, 69.1526351813826, 69.1526351813826, 
    67.3456536618754, 67.3456536618754, 67.3456536618754, 76.4161533196441, 
    76.4161533196441, 76.4161533196441, 75.1321013004791, 75.1321013004791, 
    75.1321013004791, 69.7330595482546, 69.7330595482546, 69.7330595482546, 
    67.5811088295688, 67.5811088295688, 67.5811088295688, 85.9082819986311, 
    85.9082819986311, 85.9082819986311, 84.0219028062971, 84.0219028062971, 
    84.0219028062971, 73.8425735797399, 73.8425735797399, 73.8425735797399, 
    71.5537303216975, 71.5537303216975, 71.5537303216975, 71.4496919917865, 
    68.2299794661191, 66.1464750171116, 74.0944558521561, 87.088295687885, 
    65.7494866529774, 69.6947296372348, 67.3538672142368, 67.0417522245038, 
    65.7029431895962, 77.4674880219028, 75.2936344969199, 66.5325119780972, 
    66.8172484599589, 67.0143737166324, 68.0082135523614, 65.201916495551, 
    67.750855578371, 67.7399041752224, 65.864476386037, 66.0369609856263, 
    81.7494866529774, 72.1943874058864, 73.138945927447, 74.5954825462012, 
    66.92128678987, 68.4024640657084, 63.7590691307324, 82.798083504449, 
    69.0102669404517, 78.5242984257358, 74.0533880903491, 69.4045174537988, 
    80.1368925393566, 66.6666666666667, 68.0492813141684, 66.7132101300479, 
    69.0403832991102, 89.6810403832991, 67.7344284736482, 67.3648186173854, 
    66.9377138945927, 65.8179329226557, 77.678302532512, 64.2956878850103, 
    68.9500342231348, 66.6201232032854, 68.6954140999316, 83.4442162902122, 
    67.8028747433265, 67.2580424366872, 66.8747433264887, 68.062970568104, 
    66.7214236824093, 68.0246406570842, 66.9322381930185, 66.8856947296372, 
    85.0431211498973, 64.435318275154, 65.0677618069815, 67.1594798083504, 
    80.3011635865845)), row.names = c(NA, -280L), class = c("tbl_df", 
"tbl", "data.frame"))

A good thing to mention is that the outcome is not that prevalent, meaning a considerable portion of individuals in the dataset have an outcome of 0. I've tried to find an association between these measurements with mixed models, but the model won't converge and I'm not completely sure why that happens. I'm using the lme function from the nlme package in R.

model1 <- 
  data %>% 
  lme(fixed=outcome ~ exposure, 
      random=~1|id, 
      data=., 
      na.action="na.omit", 
      method="REML", 
      control=lmeControl(opt="optim"))

Any help?

Perhaps extra useful info: the exposure variable is defined as change in exposure level per year (so it already has a time element in it). I've defined it this way because then I can make inferences about the direction of change.

$\endgroup$
2
  • 1
    $\begingroup$ You say "the outcome was measured only once for all patients (at the last measurement of the exposure)," but it seems that you have inserted values of 0 for the missing outcome measurements. I suspect that's your problem in part. You have to choose whether to use the final outcome measurement of an individual for all corresponding data rows, to omit data rows without an outcome, or to use multiple imputation to deal with the missing data. Any of those might be an acceptable way to proceed, depending on how you think that exposure is related to outcome. $\endgroup$
    – EdM
    Apr 4, 2022 at 12:51
  • $\begingroup$ Hi @EdM, thanks for your reply. I haven't replaced those values with 0, there are a lot of individuals with an outcome of 0. Do you think this might be a cause of the problem? $\endgroup$
    – tcvdb1992
    Apr 5, 2022 at 8:07

1 Answer 1

1
$\begingroup$

Of your 200 unique id values, only 40 have more than 1 observation. I suspect that the preponderance of cases with only 1 observation is leading to your problem. In playing with your data, I found that the lmer() function in the lme4 package could at least return a result rather than stop with an error, but with warning messages relating to near unidentifiability (with REML=FALSE) or a Hessian with a negative eigenvalue (default REML=TRUE).

Think hard about the details of your hypothesis. Consider whether evaluating the mean, median, minimum, maximum, or last of the exposure values makes the most sense for the few cases with more than one value, particularly as the date values suggest a decade between the first exposure measurement and the last measurement that included the outcome value. Also, recognize that you have some extreme values in your exposure data, with an inter-quartile range of only 4 units (around a median of 0.57) but some as low as -20 and as high as +17. So a simple linear fit of outcome to exposure probably won't work well.

$\endgroup$
1
  • 3
    $\begingroup$ Measuring exposure as change rather than an absolute is likely to make the fit worse. And in some cases it makes sense to have multiple baselines in one univariate model rather than thinking of this as longitudinal. I.e., see if a landmark analysis works for you where all exposures are conditioned upon, with the time of the last exposure being the landmark, i.e., time 0 for consideration with the single follow-up measurement as Y. $\endgroup$ Apr 5, 2022 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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