Appendix methods
We collected data on larval social behaviour from Brown (1981) in binary, categorical and continuous formats. Brown provides the clutch size range of each Heliconiini species, which we used as a proxy for our categorical and continuous data on larval gregariousness. Categorical social behaviour was recorded as four levels (solitary, G1, G2, G3), as explained in the main methods. We calculated the median clutch size from the ranges given in Brown (1981), these median clutch sizes were then used for the continuous data. We performed additional transition rate analyses on these categorical and continuous data.
Before testing for evolutionary relationships between larval social behaviour and various host plant traits, we performed a count on the host data to reveal how many different larval species use each plant as a host. Using these count data, we omitted hosts used by fewer than four separate larvae to create a more robust test for larval social behaviour against individual host species. We also used these count data to determine which hosts are used more frequently by larvae (Table A5).