you're talking about two different thigs here-fiber content and yarn weight
Fiber content is acrylic, wool, cotton, etc, what the actrual yarn is made up of.
Weight is how thick the strand of yarn is. The smallest is cobweb (like sewing thread, seriously) used for knitting faroe shawls (so small you could pull them through a wedding band, they are exquisite!) then fingering, then baby, then dk/sportweight, then worsted, then heavy worsted, then aran, the chunky, then bulky, on up to super bulky. Any fiber can be spun to make any weight yarn. You can (generally) substitute any worsted weight yarn for any other worsted weight. For a hat, definitely substitute easily and you'll probably get gauge right off. When it comes to garments, it gets a bit trickier becuase each fiber has it's own properties and drapes differently. So even if you sub a yarn the same weight, say you like a cotton but the pattern calls for a wool, your finished product will be different becuase even though the yarn weight is the same thickness, each fiber has VERY different properties and drape.
Does that help, or is it too much info, LOL?