UPDATED TO INCLUDE UNIT TESTER:
I went as close to 1000 min armies as possible to get a close to even money test. Gas costs vary, but the ratio is equal so it should show different value of immortals and stalkers. Multiple tests were done and remained pretty consistent.
These seem pretty accurate to what would happen in a battle where you both a+moved your armies at each other on a relatively open area. So each would benefit the same amount from Collosi behind them, or zealots in front of them, or whatever sentry micro you're rocking.
1000 mins hydra army vs 1000 min stalker or immortal
5 hydras remaining 0 stalkers
4 hydras left 0 immortals
1050 mins roach army vs 1000 min stalker or immortal
3 immortals left 0 roaches
9 roaches left 0 stalkers
525 mins roach, 500 mins hydra (mixed roach/hydra army) vs 1000 mins stalker or immortal
1-ish immortal left or 1 hydra left.
5 roaches 4 hydras remain 0 stalkers
So against a roach hydra army, it seems worth it to swap out Stalkers for Immortals even if its pure Hydra. Not accounting for mobility and such, so in a real situation, Stalkers are probably better in a pure hydra scenario, where they are only slightly worse than immortals. In a situation with ANY number of roaches, it seems worthwhile to swap out all or most of your stalker investment into immortals, if you can, without the threat of air. Basically, as few Stalkers as you can if you know your opponent is using any number of roaches.
Late game upgrades would have made the immortal even stronger since it benefits more per upgrade. Of note is that if its in an open area and all zealots can be hitting a unit from melee range, they are more cost-effective than immortals or stalkers.
So, in short, immortals are massively more effective versus a mixed roach/hydra army than stalkers are. This is probably meant to be the trade-off for shorter range, no air attack, slower, longer to build (can't warp in), etc. Its the more durable ground-only dragoon to the Stalkers flexible, fast, ground-to-air self. You trade off some flexibility and ease of use (since macroing up immortals to a battle is harder than stalkers) for a unit that does significantly better in a battle between ground armies.
If possible, mix immortals into your army in exchange for Stalkers if you feel you can do so. Obviously you want to always have some AA.
---------------------------
Sorry if this post is idiotic, but it's more of a quick question than a serious theory-craft. And yet I will type a lot. Verbose ftw
Two stalkers seem to me to be exactly the same as one immortal. Two stalkers is 20 (+8) and an immortal is 20(+30). These are on a 1.45 and a 1.44 cooldown, so the DPS difference should be pretty much on par with their damage difference. Two stalkers is 360 health/shields. An immortal is 200 health, but with 100 hardened shields. So ignoring hardened shields, you're trading 360 HP for 300, in exchange for +20 armored rather than +8. Hardened shields will, in many situations, make an immortal with hardened shields worth more than 360 HP, at 300. Both are 4 supply. Immortals gain +2(+2) per upgrade rather than +1.
It seems to me that against a pure-ground force that is heavy on units that don't ignore hardened shield (marauders, tanks, roaches), we should be laying down a second or even third Robo and just making TONS of immortals with any money we would have devoted to Stalkers. If there any chance of the immortal hitting something armored, it seems to be more cost-effective than Stalkers, with the caveat that it cant hit air.
I guess I'm already starting to see the arguments against my attempted point, though. 200/100 wasted on an extra Robotics facility. Crap 5 range and slow speed versus six range and high speed of stalkers means that it can get kited by Marauders and Stalkers very easily. The fact that hardened shields is only 100 of its shields means that 2x stalkers probably offers a bit more meat-shield against units that dont activate hardened shields. Assuming an EMP hits both stalkers or the immortal only, the Immortal still has more health as 200 HP > 180 from two stalkers, so it might be more efficient than Stalkers even against marauder/ghost.
If Starcraft II werent down id be in unit tester playing around with immortal efficiency compared to Stalkers in various situations, taking into account a small army size decrease in the immortal scenario to take into account the cost of teching.
It seems Protoss players are still having a lot of trouble with Marauders, and I wonder if laying down some more robo facilities and replacing your army's usual investment in stalkers with immortals would be worthwhile. Also, as late game PvZ gets better it seems mass roach (some hydra or corrupters or both) should do fairly well versus Stalker/Collosi (or zealot/whatever/Collosi)for cost. Perhaps us Toss players are going to need to be watching for a zerg player that remains heavy roach in late game and replace some of our stalker investment with immortals.
Thoughts?