In general, one can visit Sicily by public transportation. It will not be as efficient, over all, as having a car, but I did it for 18 days, and I am not unique.
However, I did not go to Marsala or Agrigento, so I cannot say anything about the Marsala-Agrigento-Ragusa transportation possibilities. I did use the train line through the interior, from Catania to Palermo.
I'd suggest using Rome2Rio.com to identify the bus companies serving routes you may need to take. Drill down through the Rome2Rio website to find a link to each company and go there to check schedules. I believe you'll find that buses work best for a lot of your travel segments, including Palermo to Trapani.
I think Messina is quite skippable as a tourist destination.
Do not take a night train to or from Sicily. The rails are in very bad shape; it's the jerkiest ride I've ever been on.
I have not been to Corleone.