Thoughts and actions can lead to emotions. If you can observe your thoughts processes, these processes can also be analysed. After that you can make predictions how emotions appear and you can establish some control over them.
A similar method is used in cognitive behavior therapy. This discipline investigates connections between thoughts, believes, and attitudes from one side, and emotions from another side. All of these also can be connected to other things like behavior.