4
$\begingroup$

I've got this data:

clear
input str32 record_id float(gender alcohol_consumption tobacco_consumption hypertension treatmentChoice anSize neurotromb)
"007128de18ce5cb1635b8f27c5435ff3" 1 1 1 3 2 1 0
"00abd7bdb6283dd0ac6b97271608a122" 2 3 4 2 . 4 0
"0142103f84693c6eda416dfc55f65de1" 2 2 2 1 . 2 0
"0153826d93a58d7e1837bb98a3c21ba8" 1 1 3 1 1 2 0
"01c729ac4601e36f245fd817d8977917" 1 3 4 3 . 1 0
"01c729ac4601e36f245fd817d8977917" 1 3 4 3 . 1 0
"01dd90093fbf201a1f357e22eaff6b6a" 2 1 1 2 . 1 0
"0208e14dcabc43dd2b57e2e8b117de4d" 2 1 1 2 . 1 0
"0210f575075e5def7ffa77530ce17ef0" 2 2 1 1 4 1 0
"022cc7a9397e81cf58cd9111f9d1db0d" 2 1 3 1 5 1 0
"02afd543116a22fc7430620727b20bb5" 1 3 4 2 . 5 0
"0303ef0bd5d256cca1c836e2b70415ac" 1 3 4 3 . 1 0
"0303ef0bd5d256cca1c836e2b70415ac" 1 3 4 3 . 1 0
"041b2b0cac589d6e3b65bb924803cf1a" 1 1 3 3 1 1 0
"0536317a2bbb936e85c3eb8294b076da" 1 1 1 1 . 1 0
"06161d4668f217937cac0ac033d8d199" 1 3 4 1 4 1 0
"065e151f8bcebb27fabf8b052fd70566" 1 1 1 1 3 1 0
"065e151f8bcebb27fabf8b052fd70566" 1 1 1 1 . 1 0
"065e151f8bcebb27fabf8b052fd70566" 1 1 1 1 . 1 0
"065e151f8bcebb27fabf8b052fd70566" 1 1 1 1 3 1 0
"07196414cd6bf89d94a33e149983d102" 1 1 1 2 4 2 0
"0721c38f8275dab504fc53aebcc005ce" 1 1 2 1 3 1 0
"0721c38f8275dab504fc53aebcc005ce" 1 1 2 1 1 2 0
"0721c38f8275dab504fc53aebcc005ce" 1 1 2 1 1 1 0
"0721c38f8275dab504fc53aebcc005ce" 1 1 2 1 . 1 0
"07bef516d53279a3f5e477d56d552a2b" 1 3 4 1 . 4 0
"08678829b7e0ee6a01b17974b4d19cfa" 1 1 1 1 3 . 0
"08bb6c65e63c499ea19ac24d5113dd94" 1 1 3 1 5 2 0
"08f036417500c332efd555c76c4654a0" 2 1 2 1 1 1 1
"090c54d021b4b21c7243cec01efbeb91" 1 1 3 2 3 1 0
"09166bb44e4c5cdb8f40d402f706816e" 1 1 3 2 . 1 0
"0930159addcdc35e7dc18812522d4377" 1 1 1 1 1 2 0
"096844af91d2e266767775b0bee9105e" 2 3 4 1 . 2 0
"09884af1bb9d59803de0c74d6df57c23" 1 1 3 1 . 1 0
"09e03748da35e9d799dc5d8ddf1909b5" 1 3 4 1 1 1 0
"0a4ce4a7941ff6d1f5c217bf5a9a3bf9" 1 3 2 2 1 2 0
"0a5db40dc58e97927b407c9210aab7ba" 2 3 4 1 4 2 0
"0a5db40dc58e97927b407c9210aab7ba" 2 3 4 1 4 1 0
"0a73c992955231650965ed87e3bd52f6" 2 3 4 1 . 1 0
"0a84ab77fff74c247a525dfde8ce988c" 2 2 1 2 5 2 0
"0a84ab77fff74c247a525dfde8ce988c" 2 2 1 2 1 1 0
"0a84ab77fff74c247a525dfde8ce988c" 2 2 1 2 . 1 0
"0af333ae400f75930125bb0585f0dcf5" 1 1 1 1 1 1 0
"0af73334d9d2166191f3385de48f15d2" 2 1 1 2 . 1 0
"0b341ac8f396a8cdb88b7c658f66f653" 1 3 4 1 3 1 0
"0b341ac8f396a8cdb88b7c658f66f653" 1 3 4 1 . 1 0
"0b35cf4beb830b361d7c164371f25149" 1 1 1 2 . 1 0
"0b35cf4beb830b361d7c164371f25149" 1 1 1 2 . 1 0
"0b3e110c9765e14a5c41fadcc3cfc300" . . . . . . .
"0b6681f0f441e69c26106ab344ac0733" 1 1 3 1 4 1 0
"0b8d8253a8415275dbc2619e039985bb" 1 1 1 1 4 5 0
"0b8d8253a8415275dbc2619e039985bb" 1 1 1 1 4 5 0
"0b8d8253a8415275dbc2619e039985bb" 1 1 1 1 1 1 0
"0b92c26375117bf42945c04d8d6573d4" 1 2 1 2 . 2 0
"0b92c26375117bf42945c04d8d6573d4" 1 2 1 2 . 1 0
"0ba961f437f43105c357403c920bdef1" 2 1 2 3 1 1 0
"0bb601fabe1fdfa794a5272408997a2f" 2 1 3 1 1 2 0
"0c75b36e91363d596dc46bd563c3f5ef" 1 1 2 1 . 1 0
"0d461328a3bae7164ce7d3a10f366812" 1 3 1 1 . 1 0
"0d4cc4eb459301a804cbef22914f44a3" 1 3 4 3 . 1 0
"0d4e29e11bb94e922112089f3fec61ef" 1 3 4 1 . 1 0
"0d4e29e11bb94e922112089f3fec61ef" 1 3 4 1 . 1 0
"0d513c74d667f55c8f4a9836c304149c" 2 3 4 1 . 2 0
"0da25de126bb3b3ee565eff8888004c2" 1 1 1 2 . 2 0
"0da25de126bb3b3ee565eff8888004c2" 1 1 1 2 . 1 0
"0db9ae1f2201577f431b7603d0819fa6" 2 1 3 2 . 1 0
"0dd8a681f6a5d4c888831a591e57a747" 1 1 3 . 5 4 0
"0e05d6958d878368b5fb831211fad6a1" 1 1 1 1 . 1 0
"0e3ff41e0e2b2cb5ec336fd0b04e5d44" 2 1 2 2 1 1 0
"0f61e560ab56b8fea1f2593d7d3b2718" 1 1 3 1 . 1 0
"0f61e560ab56b8fea1f2593d7d3b2718" 1 1 3 1 . 1 0
"0f69f1f998984d37f133185179d63c60" 2 1 3 2 3 3 0
"1037032886a93e66406a4c910d1ef747" 1 1 1 1 . 1 0
"1037032886a93e66406a4c910d1ef747" 1 1 1 1 . 1 0
"1044b81b354b420e85ae835ea07de2d6" 1 1 2 2 . 4 0
"10620fc488346291281212a404681386" 2 1 1 2 . 3 0
"1074389c469944edf026d193a55b1148" 1 1 3 3 3 2 0
"1090d5a678119b03cddab609289a4d3c" 1 1 2 2 1 1 0
"111eebb45cef2211a2a2ff0219095e6a" 1 2 1 1 . 1 0
"11ddcbc8de8ef56cbc578fc81b602ffc" 1 1 1 2 2 2 0
"11f22488513cf717c333786c789b0289" 1 1 3 2 3 1 0
"11f22488513cf717c333786c789b0289" 1 1 3 2 3 1 0
"121552b22cee2a1eb4360b4d2534cd39" 2 1 1 1 1 2 0
"1251d707c5dc9243dc45d04beb7c3493" . 1 1 1 . 1 0
"125689659bb3821fa81698dd72462773" 1 1 3 2 . 1 0
"127ba572433921c5bb408fc62eb9b5d7" 1 1 3 1 1 1 0
"129bea3f73e84e37d77d55fadfeb49dd" 1 1 1 2 3 2 0
"12e8dc6fb87822be26d6678cee9644f5" 1 2 2 3 5 1 0
"12f05a65f771c9675c2c5e9cdbfc33d1" 2 1 1 1 3 1 0
"12f05a65f771c9675c2c5e9cdbfc33d1" 2 1 1 1 3 1 0
"13d2bc86f1a19ed2959cd7354bc92d1d" 2 1 3 2 . 2 0
"13db5ede38e2ae1da17884c9a18df202" 1 1 2 1 3 1 0
"13f946e50df8ad74d7cf9fa05b4ad05b" 1 3 1 2 . 2 0
"146c4b8be7996a9789873fe55a47ab41" 2 1 3 1 1 1 0
"147fadd87da13a0271225d944d2a5e98" 1 1 2 2 4 1 0
"14a1dcfa015343bbefaac9a3a45769e5" 2 1 1 2 4 2 1
"14a1dcfa015343bbefaac9a3a45769e5" 2 1 1 2 . 1 1
"14d1377f74a63ffa29db2d99e7f6a1ce" 1 1 1 2 . 1 0
"150017d944a87b4c61f90034380c0659" 1 1 1 3 5 3 0
"150f6ca1ea453260eabf3472d3ebcad1" 1 1 3 2 4 1 0
"152dbaeb2dccc0b7bc78c83337974e17" 1 3 4 1 . 1 0
"160b6c842870ed5d75ccb791690a84e2" 1 3 4 3 . 1 0
"166ed54ce44b9fd14baff4c13720eb76" 2 2 3 2 1 2 0
"166ed54ce44b9fd14baff4c13720eb76" 2 2 3 2 1 1 0
"16c2a2c90b75135e9321d568967b5034" 1 1 1 1 . 1 0
"1715db73767478aeb9d6dc808fdad443" 1 1 2 2 . 1 0
"17949a61667c79f00dbcaa131a167a7d" 1 2 1 2 1 1 0
"17949a61667c79f00dbcaa131a167a7d" 1 2 1 2 . 1 0
"17bcd3b70b99586cc22894f4870fe0e9" 2 1 1 1 3 2 0
"17ef09ab32f88420a439642a7eedc590" 2 3 4 1 . 1 0
"17ef09ab32f88420a439642a7eedc590" 2 3 4 1 . 1 0
"17ef09ab32f88420a439642a7eedc590" 2 3 4 1 . 1 0
"1836e13c06440db40c7f0ea11bf48587" 1 3 3 1 . 1 0
"1849cda9ceae854c579d60b62352d10d" 1 1 1 2 4 2 0
"1859ae143d9e097d9660b96e847f188c" 2 1 2 1 . 4 0
"187b862bf9b846e7959b3856a22cbc5c" 1 1 1 2 3 2 0
"198d4802c4d49c78dd8236a9cdd13de5" 1 3 4 1 . 1 0
"1a041308d68afeb4667f8281128e1c0a" 1 1 3 2 1 3 0
"1a19bdc645ee2f61e6a870a348b3e6b8" 1 1 3 1 . 1 0
"1a3f6d3083a5b07cd2840b3dec1cfd58" 2 1 3 2 . 1 0
"1a5a193e385e033beb84df32d2154eb5" 1 1 3 2 1 1 0
"1a5d20bf7e66f51259136e1756fa9769" 1 1 1 2 1 1 0
"1a71805e55fa2503102139c85f639ae6" 2 1 1 2 4 2 0
"1a71805e55fa2503102139c85f639ae6" 2 1 1 2 . 1 0
"1afad9a463552e6c9b1680cb23682b2a" 2 1 2 2 . 1 0
"1b8cc13a25626f72e9c7d2c418d07b03" 1 1 3 2 . 1 0
"1b9db681f465d699bee160bcf504a3cf" 1 1 1 1 1 2 0
"1b9db681f465d699bee160bcf504a3cf" 1 1 1 1 1 2 0
"1bb0ecf8203fc4fadb6d6b8d7dc9f543" 2 1 3 2 . 1 0
"1bc9ce4ae6ce7743f7d584c5fd420c12" 2 1 3 1 . 1 0
"1c30679d3c120eaeb638bbcc0943bfcf" 2 3 4 2 5 1 0
"1c4635c702725f45cbd6d6944ab33ca1" 1 1 1 2 2 4 0
"1c4635c702725f45cbd6d6944ab33ca1" 1 1 1 2 5 1 0
"1c517ac859bdb6e78e741d1ba1723ec6" 1 1 2 3 1 2 0
"1c8997f0884bad9c6165d7a059835dcf" 1 1 1 2 . 1 0
"1c89f217a48f1bbb13f16289ba4da568" 1 3 1 2 3 1 0
"1cb74b679f4fafa091037047cfc1a84b" 1 1 1 1 3 1 0
"1cb934a7383eeed130cb233616094f34" 2 2 1 1 1 1 0
"1cbe9fadead834b5acf128746f10a741" 2 1 2 1 . 1 0
"1cd68d28672bb8102f86829b938dfe4d" 1 3 1 2 3 1 0
"1d854ae039abb5dc7ee1a9bb104376a8" 1 1 3 1 . 1 0
"1dc6cf6fb0a06209077411febc6e1c65" 1 1 3 1 3 1 0
"1e00442745c25082a64197b96065f755" 1 1 4 3 . 1 0
"1e0b6ac25d5dafb3a1f32e42e53d3e90" 1 3 1 2 . . .
"1e1425d670466e1a2c6c752d9227df17" 2 1 1 2 3 1 0
"1e6b62ddac39164f28eb019c36cf0b33" 1 1 1 1 . 1 0
"1ee1beebfd76df81746e57a13e258f38" 1 1 3 2 1 1 0
"1ee1beebfd76df81746e57a13e258f38" 1 1 3 2 1 1 0
"1ee1beebfd76df81746e57a13e258f38" 1 1 3 2 1 1 0
"1ee1beebfd76df81746e57a13e258f38" 1 1 3 2 5 1 0
"1ee1beebfd76df81746e57a13e258f38" 1 1 3 2 2 1 0
"1ef30e808a5dccfd6f59814069401536" 1 1 1 2 1 1 0
"1f710e0784066556585dc4cb255119a2" 1 1 2 2 1 2 0
"1f724b5ac268e6695f179a65544b762f" 1 1 2 3 1 1 0
"1f93d9334e868ddcfdf6612ecbea0085" 2 1 1 2 4 2 1
"2042abded277bac20d04e22642fc96ee" 1 1 1 1 . 1 0
"2049ad9e3e71e88d27df76be3ed842d7" 1 1 1 2 . 1 0
"209f55284471eadfa8ac90b203c9253e" 1 3 4 1 1 2 0
"20a242d4fa3cdcadfb70a96822f172d5" 2 2 4 1 3 2 0
"20c3937cf440254929b2c40ffd6de1a4" 1 1 1 2 . 1 0
"21595388405371d0808a044000bd97ae" 1 1 3 1 1 1 1
"215d8fa815973f4fbcd86377977900d8" 1 1 2 1 . 1 0
"21a34d93e3aed141889fd3d6690da932" 1 1 1 2 2 1 0
"222db47be5af3af3ffb2268a8af9462d" 1 3 4 3 . 1 0
"226f5e3fb8f5f886c74e396afd35193b" 1 3 4 3 . 1 0
"2284967e0cefc0e6b42e5b14dd5f3880" 2 1 1 1 . 3 0
"2284967e0cefc0e6b42e5b14dd5f3880" 2 1 1 1 . 1 0
"22ae00f9b4a7f89c4b7c671b7f16f15f" 1 1 1 2 1 1 0
"2311c659fe3e62f744439ddb85239d19" 1 3 4 1 . 1 0
"237a27babe7c480c32fd5d2e3e94b456" 1 3 3 2 . 1 0
"23b26e94718acf085c7f45a16da79e8e" 1 1 2 1 3 2 0
"23ce2e59a2135d2e8f8a39d31f91e69f" 1 3 4 3 . 1 0
"24186e69c5c1fc48f8fac5e28177ccb7" 1 1 2 1 2 3 0
"24227f50621eb4d0e30c8f0d1427f23b" 1 3 4 1 . 1 0
"2448682f873b74c56fc59aa091c93ef3" 1 1 2 2 2 1 1
"248c256573f7049e8ef5abd2e655e8c7" 2 1 2 2 . 1 0
"248d9600588fdd6ad070a2a185d942a3" 2 1 3 1 1 2 0
"24f880cfb32fb5773f087cf67446fe98" 1 2 1 2 3 3 1
"24f880cfb32fb5773f087cf67446fe98" 1 2 1 2 . 1 1
"24f880cfb32fb5773f087cf67446fe98" 1 2 1 2 . 1 1
"2535b1c616dd453abe2a0f4f87a4f92f" 2 1 2 2 4 2 0
"2541eacb78206253021c08335df72a7b" 1 1 1 1 4 1 0
"2586469433fed41601e8a3a60818def1" 1 1 1 1 1 2 0
"2586469433fed41601e8a3a60818def1" 1 1 1 1 5 2 0
"266f1f1517fb50bafca92fff39c259d5" 1 3 2 1 . 1 0
"266f1f1517fb50bafca92fff39c259d5" 1 3 2 1 . 1 0
"2675ea8b57788dff4680e0b70b6a1d69" 1 1 1 2 4 1 0
"2675ea8b57788dff4680e0b70b6a1d69" 1 1 1 2 4 1 0
"267c028ade7b0d58528c8fc130cfdc5c" 1 1 2 1 . 3 0
"267c028ade7b0d58528c8fc130cfdc5c" 1 1 2 1 . 1 0
"26b712f0a44f5fb88fe2d49d6209639a" 2 1 3 2 . 2 0
"26b712f0a44f5fb88fe2d49d6209639a" 2 1 3 2 . 2 0
"26d32f5acb669032bae56e14152044a6" 2 1 1 1 . 4 0
"272c5f2300564e427a953af2ec144cef" 1 1 1 1 3 1 0
"272c5f2300564e427a953af2ec144cef" 1 1 1 1 . 1 0
"272e24b67eef3f79f1a32ee7e0a3dab3" 1 1 2 1 . 2 0
"276c1bdad54d49ed343cd902554ae86f" 1 1 3 1 . 2 0
"27772e9942f7cfaa8648cc6495d7e30d" 2 1 2 1 4 1 0
"278099f521c671e45114b7056c362559" 1 1 3 1 3 1 1
"280e7ad644c45aa66e9b019e929d6617" 1 1 2 1 . 1 0
"282dc9e794504edbd5c2e9b6dc68cc9c" 1 1 3 1 . 1 0
"28a8d624e616dacc3a01d51b656353c8" 1 1 1 2 1 2 0
"28f483b35112c0aa73bb7d3761c3b5d2" 1 1 3 1 1 1 0
"29534fe6f18b75090b9d18f853ed7ec1" 1 3 4 1 3 5 0
"29534fe6f18b75090b9d18f853ed7ec1" 1 3 4 1 3 5 0
"29534fe6f18b75090b9d18f853ed7ec1" 1 3 4 1 3 1 0
"29534fe6f18b75090b9d18f853ed7ec1" 1 3 4 1 . 1 0
"29534fe6f18b75090b9d18f853ed7ec1" 1 3 4 1 . 1 0
"299ce3b994386acaaa633d5567dd327d" 1 1 1 2 5 2 0
"29c02008312d278f9f368ea51dd83adc" 1 1 1 1 3 1 0
"2aa102e00fa4efe3d786462f6275b30f" 1 3 4 2 . 1 0
"2afc1f12901992a1f973cde814615349" 1 1 4 3 . 2 0
"2afc1f12901992a1f973cde814615349" 1 1 4 3 . 1 0
"2c0ba4875d701718be0644d1212f304d" 2 1 1 2 . 1 0
"2d70a27e8bb674fbce35e01d024e9363" 1 1 1 2 . 2 0
"2d943b83a4f7fff4b7c098600b847605" 1 1 1 1 1 2 0
"2e2ecf6c92fde6ca5201a52440355d3d" 2 3 1 1 1 3 1
"2e3ae2a4725cb7addd6af1ea729c10b1" 2 1 1 2 2 2 0
"2e3ae2a4725cb7addd6af1ea729c10b1" 2 1 1 2 2 1 0
"2e73605ba74e9203381022be9438a0f6" 1 3 4 3 . 1 0
"2ed013748bf88df47c39d83bd48d8040" 1 1 4 1 3 1 0
"2eda6a9499d88bff6541548b03d5739b" 1 3 4 1 . 2 0
"2f3c2b5d92461ead44d7577b2ca2c67b" 1 1 1 2 2 2 0
"2f3c2b5d92461ead44d7577b2ca2c67b" 1 1 1 2 . 1 0
"303be56acb1c6514630175c0435677b3" 1 . 3 1 3 2 0
"309704682b2cf0aee0384945ba6965f6" 1 1 3 2 . 1 0
"3099225c525a6a7cf2f44c152cea72ac" 2 2 1 . . 1 0
"30b5ce9e13028219e1b1f4fc7a8f0fdd" 1 2 1 1 . 5 0
"30b5ce9e13028219e1b1f4fc7a8f0fdd" 1 2 1 1 . 5 0
"30bfb44ccfbe0289a85d0c803d815713" 2 3 4 3 . 1 0
"310a3b0d0c717ec85ab9695c29e89e69" 2 1 3 1 . 1 0
"310a3b0d0c717ec85ab9695c29e89e69" 2 1 3 1 3 2 0
"31ef2d94b9a69e3eed6aae83d1826967" 2 3 4 3 . 1 0
"32645986b0130f29ee32ee530f52373e" 2 3 4 3 . 1 0
"330ac3ddd9f1a2e4dae675569d804a10" 1 1 3 2 . 2 0
"331c4f53bbd697ee384424bc0cd2061e" 2 1 2 1 . 3 0
"336f5373cab13f2bf4d11fdfa97dcaec" 1 1 1 2 4 2 1
"336f5373cab13f2bf4d11fdfa97dcaec" 1 1 1 2 1 1 1
"33cb4c6171e5abfe3878743ab33e2091" 1 1 1 1 5 1 0
"33f8dd7e04c3e30b037686546d0dcfe0" 1 1 3 2 . 2 0
"3562e13a0d8d6b3d8fcd8686b4456686" 1 1 2 1 2 2 0
"36904fec81952b2c2f0fcbc7a49a0ad1" 1 3 1 1 . 1 0
"369b58e7d46dd6ca3092d11873a6326b" 2 3 4 1 . 2 0
"369b58e7d46dd6ca3092d11873a6326b" 2 3 4 1 . 2 0
"3717e8e95c688eb7e139255569d7a564" 1 3 4 1 3 1 0
"3717e8e95c688eb7e139255569d7a564" 1 3 4 1 4 1 0
"3717e8e95c688eb7e139255569d7a564" 1 3 4 1 3 1 0
"37272e1e6203f9e18104173acf626b4f" 1 1 3 2 . 1 0
"388bd462a0ccdf6c8cdf614ba5d97664" 1 1 1 2 3 1 0
"38b6fb9b5bf10e5c0e535ee1e8f47c07" 1 1 3 2 1 1 0
"38ecebab24128702fd657fc90623cc91" 1 1 1 2 . 1 0
"38ecebab24128702fd657fc90623cc91" 1 1 1 2 . 1 0
"397f116460482fbf828cb1b41ac795da" 1 3 4 1 . 1 .
"39aefa1784d6061766d4b90c98077f5c" 2 1 1 1 3 1 0
"39ba40af678e2083aa02e12580c1d991" 1 1 3 1 5 2 0
"39f148a18591def27b5821722ecadcf5" 2 1 2 1 . 1 0
"3a125ff4c88b02a5a443ef3434e0484d" 1 1 3 1 3 1 1
"3a2692cdc3fe6781570a259f89035375" 1 1 3 1 4 1 1
"3a4b53abe0d1ccd6f62b16de9e45f56c" 1 2 4 3 . 2 0
"3ab4a637fbaa039042e95e782d3e1700" 1 1 3 1 . 1 0
"3aca179e92e6b3e81b71e6548a2ad2d2" 1 1 2 1 3 3 0
"3aff1153dffdfa55321529d82b44cbd0" 1 3 4 3 . 2 0
"3b09abd94d2f9edac735ae4f4b961733" 1 1 2 2 1 2 0
"3b09abd94d2f9edac735ae4f4b961733" 1 1 2 2 1 1 0
"3b09abd94d2f9edac735ae4f4b961733" 1 1 2 2 1 1 0
"3b53a9e25aba0721501933dec37f349d" 1 1 1 2 2 2 0
"3b53a9e25aba0721501933dec37f349d" 1 1 1 2 5 2 0
"3b55aebe1b4b22e0c77168acc4b775dd" 1 3 4 1 . 5 0
"3cac880fc30873437bd7f9600163ff24" 1 1 3 2 3 2 0
"3e217b8668baf47a526e8b0359db2957" 1 1 2 . . . .
"3e2a66a64f5053dacc55ecde38373166" 1 3 4 3 . 1 0
"3ea05bfc65cce9aea1c1c3a49807d99f" 1 1 3 2 2 1 0
"3ed1d9aee8dcf8da0c17476411ee8ebe" 1 1 2 2 1 1 0
"3f741cdeeebb9bd085120fdc76cd14d4" 2 1 3 1 2 4 0
"3fe59b936db9606d3eca8d14cf507b9a" 2 1 3 2 1 2 0
"40425036bdc1695391897694ce60e596" 2 1 3 2 1 1 0
"40425036bdc1695391897694ce60e596" 2 1 3 2 1 1 0
"4067410b952d26be08fd11937a19d4d2" 1 1 1 2 . 1 0
"4067410b952d26be08fd11937a19d4d2" 1 1 1 2 . 1 0
"409961748f348e836b9862f163b23771" 1 1 3 2 1 1 0
"40a9249759e3ba846d324deb3a8dfd63" 1 1 3 1 4 1 0
"4157a7bd496c733d2422b74fd2125c68" 2 1 2 3 1 1 0
"41714f2016e47daadae150d67988e592" 1 1 1 1 2 1 0
"41c360569cbbb6833505539c3bf4a783" 1 1 3 2 3 1 0
"4200e79d457cfc002ede60ac27e1dc35" 1 1 3 1 . 1 0
"4204c8cafecbca050fe111aedcd732c9" 1 1 1 1 . 1 0
"420bf125eafd56e4693c07137a86528b" 1 1 3 2 3 1 1
"425575728f0c59ec4f7045535a7edaa2" 1 1 2 1 . 1 0
"42ea78204df0879be0026f86355cba07" 2 1 1 1 2 3 0
"431dba60771833b6cd55e01128c1e059" 1 1 3 1 4 1 0
"432e1f89405d805abf074330a2884f3d" 1 3 4 3 . 3 0
"4354adf8072da82b930147ded6948da5" 1 1 1 1 5 2 0
"4393f27b43e526d64b0ca2a69391d17e" 1 1 1 2 5 1 0
"4393f27b43e526d64b0ca2a69391d17e" 1 1 1 2 . 1 0
"4393f27b43e526d64b0ca2a69391d17e" 1 1 1 2 . 1 0
"43d4456ee1a6ed7a6d4fd1a0d4d19599" 1 1 1 2 1 2 0
"43d4456ee1a6ed7a6d4fd1a0d4d19599" 1 1 1 2 . 2 0
"43d4456ee1a6ed7a6d4fd1a0d4d19599" 1 1 1 2 1 1 0
"43d4456ee1a6ed7a6d4fd1a0d4d19599" 1 1 1 2 . 1 0
"4428c1037ec1ac0db3ed774e3b6e12f6" 1 2 1 1 . 3 0
end

It shows patients (record_id, anonymized), aneurysm size (anSize), an adverse effect (neurotromb), treatment option (treatmentChoice) and some adjusting baseline variables.

I'm interested to know whether choice of treatment has an effect on the adverse effect neurotromb.

As we are arranging by aneurysms (patients can have more than 1 aneurysm) we run a mixed model, grouping by record_id.

This is my code in R:

glmer(neurotromb ~ factor(treatmentChoice) + gender + alcohol_consumption + tobacco_consumption + familial_predisposition + anSize + (1 | record_id), family=binomial)

However this returns the following output:

Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
 Family: binomial  ( logit )
Formula: neurotromb ~ factor(treatmentChoice) + gender + alcohol_consumption +  
    tobacco_consumption + familial_predisposition + anSize +      (1 | record_id)
      AIC       BIC    logLik  deviance  df.resid 
 244.7785  291.5070 -111.3893  222.7785       506 
Random effects:
 Groups    Name        Std.Dev.
 record_id (Intercept) 13.51   
Number of obs: 517, groups:  record_id, 427
Fixed Effects:
             (Intercept)  factor(treatmentChoice)2  factor(treatmentChoice)3  factor(treatmentChoice)4  
                -6.58794                  -1.63594                   0.02225                  -0.09801  
factor(treatmentChoice)5                    gender       alcohol_consumption       tobacco_consumption  
               -74.33215                  -5.34448                   0.33914                  -1.19420  
 familial_predisposition                    anSize  
                 1.93422                   0.14242  
convergence code 0; 0 optimizer warnings; 2 lme4 warnings 
Warning messages:
1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  unable to evaluate scaled gradient
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge: degenerate  Hessian with 1 negative eigenvalues

I'm not entirely sure if the model can be used or not or if these are absolute errors? It runs fine if I dichotomize treatmentChoice into either one type of treatment or the other, but the treatmentChoice variable is nicely distributed so I wouldn't think I'd have to.

$\endgroup$
1
4
$\begingroup$

I'm not entirely sure if the model can be used or not or if these are absolute errors

The model has not converged to a solution, so you should not uses the output from this model.

This is probably related to the dataset having a large proportion of singleton clusters. A few things to try are:

  • try the other optimisers avalable in lme4
  • try setting nAGQ greater than 1
  • refit the model using a range of starting values
  • try using GLMMAdaptive, brms, glmmTMB and other packages

If all the above fails then you could split the dataset into two - one part for all the singleton clusters and fit it a linear model (with lm in R) on those, and the other part with a mixed model package.

$\endgroup$
3
  • $\begingroup$ How come the model gives an output if it has not converged to a solution? In other softwares I've used they refuse to give any sort of output. $\endgroup$
    – Paze
    Sep 4 '20 at 15:36
  • 1
    $\begingroup$ Unfortunately I am not the author of the package so I couldn't say, but the hint is in the message Model failed to converge. If you need to know more then I would suggest asking on the R-Sig-ME mailing list which is specifically for fitting mixed models in R. Questions about software are off-topic here. $\endgroup$ Sep 4 '20 at 16:06
  • $\begingroup$ Thank you. It ran with glmmTMB. $\endgroup$
    – Paze
    Sep 6 '20 at 17:27

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.