In Puerto Rico, how do you tell whether it is better to trade or to ship a good?
It depends on several factors that ultimately boil down to What is the roles overall value?


Is it the early game? - In the early game, it is usually more important to gain coins than VP. The reason for this, is that you can exchange coins for buildings that will gain you more coins/VP over the course of the game than you would earn this turn by shipping and taking the VP. Until you have your coin generating buildings setup, usually consisting of a high value trade good/large market/factory, coins are usually of greater value. Some of the expansion building make this distinction moot (Black Market).
Do your opponents make more Coins/VP because of your choice? - Usually, in Puerto Rico, you want to make decisions that benefit you more than your opponents. If choosing Trader will benefit your opponents more, you might want to Captain instead (or select some other role). The few times you might select a role that doesn't seem to immediately help you relative to your opponents, is when you are denying them access to the cash necessary to buy some building (Guild Hall pops up a lot here), or denying them shipping on a large boat (they have lots of corn and you take a large boat and possibly tie up all the boats from emptying).
Does the role have a coin on it - I will many times take a role card that has a coin, because all I need is that extra coin to buy a building I want during the next building phase.