Again, I point out that I know this isn't the only method to do these things, but this is one thing that always works for me.
Often when you knit a hat, you find that you will need to double up on the rim and sew elastic into it. I've noticed that especially with thicker yarn, the rim will look extremely chunky compared to the rest of the hat. This is how I minimize that effect for a lovely hat that won't stretch out and fly away in the next wind.
Edit: I should point out that with experimentation, I've found that this works best with lighter yarns, worsted or lighter. When done with chunkier yarns this can make the shape of a the hat a little...odd? Not sure how else to describe it but it's something to consider.
So this is how I do it:
Let's say for argument's sake, your pattern calls for you to knit 8 rows of K2 P2 rib, like this:
Then, begin the ribbing in reverse. So for example, if you did K2 P2, now do P2 K2 for the same amount of rows you did for the first section, like this:
Then you make the hat according to the rest of the pattern. Once you're done, FOLD the first part of the rim into the second and use either leftover yarn or thread with a tapestry needle to sew it together. You can place elastic inside too to make the hat a more snug fit.