One of the issues of comparing wild vs tank living is that we can't ( or don't) recreate the natural diversities that fish live through during a typical lifetime which can have very strong health effects. For some fish, say Amazonian fish, they go through periods where they live in the flooded areas getting foods that they don't usually eat throughout the rest of the year. Then there are some that get nutrients from the soil they ingest which we cannot duplicate in a fish tank. Then again, you need to think about comparing only a wild fish being kept in a tank VS the wild. Most of today's fish are not wild and are genetically inferior to their wild counterparts and subject to an earlier demise.
HOWEVER, there is another facet you need to consider: in the wild, a dominant fish will exert themselves much more frequently against a number of rivals that are "coming up" while in a tank, we tend to intercede and remove the rivals. Once the wild dominant fish has been unseeded, they tend to go off and live for a very short amount of time vs in a tank where they are allowed the luxuries of still being cared for. Then again, in the wild, older animals tend to be killed off before they would naturally die whereas in a tank, old age is a common occurrence and expected by our fish keeping skills. This is why more zoo animals live longer when properly housed in a zoo than when left in the wild.
Then there is the food issue for fish. In the wild fish get a copious amount of live foods which gives them nutrients that a flake or prepared food just can not duplicate. So how can you compare tank living to wild living at all? At best, you can get an average with a huge +/- differential.
So you see, there is no real way of saying that in a tank will live better than in the wild ( or vice versa) because there are many variables and most of the fish are not close enough to wild to compare accurately.
So the best you can do is to do the best you can to keep your fish as healthy as possible by giving them the things they like and need in a natural setting while in an aquarium. Just remember, we now have fish in the hobby that have never seen the wild because they are totally man made. Consider this: how long would a Parrot Cichlid last when placed in the wild areas of the fish that were hybridized to create them. Chances are, not too long at all.
Hope this helps