Great job reverse engineering the damage and healing formulas! Do you have any insight into how the Doctor's attributes are determined? I haven't really done the math on it, but would love to know if it's the average of the companions' attribute scores or the total of them all, or something else.
I did experiment with different team compositions a little to check the Doctor's stats, and what I discovered was that it's based on the levels of the companions (not ranks or their specific attributes). So, for instance, a team of all level 40 characters yielded a Doctor with higher stats than one with a couple of level 30 characters (even rank 4 ones that started at rank 2). It seems to be an average of some sort, but beyond that I haven't yet tried determining exactly how it's calculated. I'll look into that some more.
The Doctors stats seem to be based on the arithmetic average of the levels of companions in the party (rounded down to the nearest integer), with minimum values (probably determined by the Doctor's rank) if that average is too low. The minimum values can be checked using a team with just the Doctor in it: for rank 4 Eleven I got 1084/606/275; and for rank 4 Ten I got 1111/598/270. So they're different for the different Doctors.
At rank 4, Eleven's stats first rose above the minimum with a team with average level 28. So yeah, I'd say the relevant number is max[L, floor(avg level of companions)], where L is probably determined by the Doctor's rank (and is 27 at rank 4).
The stats I got (if you want to check them) are:
avg level 0 (no companions), various values (but not all) between 0 and 27, 27: 1084/606/275 (I only verified the atk for the nonzero ones, though)
avg level 28: ?/695/? (only atk is readily available without looking up the companions' stats)
avg level 29: ?/799/?
avg level 39: 2647/1668/589
avg level 40: 2848/1830/631
Based on the atk attribute not changing when switching between different companions of the same level in a one-companion party, it's unlikely that it would be based on companions' attributes.
I don't know if there's an exact pattern to those values (as opposed to the values simply being arbitrarily defined in a table somewhere), but it isn't linear or geometric.