Generally, the idea is simply to adapt.
With a strong range, you give great implicit odds to your opponents (even if they are not aware of this), and therefore it makes sense to raise bigger to limit the long-term value of these implicit odds. The same is true for a weak range, when your opponents have low implicit odds against your range, you don't really need to cut the odds.
Now comes the range with which you expect to be called. In general, the weaker the calling range and the higher your raise should be. This is allways a bit difficult to talk about it because of course your sizing will affect the calling ranges. Therefore in respect to the calling range, the sizing is allways villain-dependent.
And finally, the position kicks in. When you are OOP, you might find yourself in EV- spots even if your range is stronger than your preflop caller's one. Your theoretical equity in the spot will be much higher than your "practical" equity (you don't care having 55% equity with 22 on AT6ss vs your opponent if he is aggressive and you are OOP). You therefore are willing to limit those EV- spots to spots where your handreading is easier, which means a narrower opponent's range. This is generally achieved by a bigger sizing preflop.
Another thing that might come with the position is the will to play poker. Postflop play is generally recommended IP, and you are OOP. The bigger your raise, the easier it will be to go for a preflop allin situation (if you want to) and the bigger the pots on the flop will be if you get some action preflpo. This means easier postflop play beacause the SPR will be lower. When you are IP, you generally prefer bigger SPR to let your postflop play having more worth than the hand's equities.
Now putting everything together:
UTG: you are OOP against most opponents susceptible to call your raise. You therefore generally want easy-to-play hands (which means a strong range). A big sizing is therefore recommended by all the previous comments.
BU: you are IP whatever comes. If you decide to play a lot of hands on this position, your range will be much weaker. You therefore expect to fold a lot against 3bets. The main advantage in playing IP is the fact that you will most likely be able to win a lot of money postflop thanks to it, you therefore prefer a big SPR, to keep the maximum of space for playing poker. However keep in mind that the smaller your sizing and the better the odds of your opponent for calling the raise. With a button minraise the BB has 3,5:1 odds to call, which is great. You have to be sure that you will be able to put the position to great use for a minraise to be more profitable than a 2,5bb or 3bb raise.
Blinds: you are OOP against everyone. I generally hate to play those positions and if the pot hasn't been raised so far I generally bet very big here (at least 5+limpersbb). Of course if no one got in the pot you are in blind war situation and this is different, even if you can analyze it with the previous ideas as well.
What I do as a basis is 4,5-5+limp in blinds, 4+limp UTG and MP, 3+limp CO and 2,5+limp BU. And I adapt the sizings to the opponents in play. Against fishes I will generally try to play for more money and raise a bit more. Against regs I generally don't change my basic sizings to avoid them from having a clear read on my range's strengh. However I'm not sure it's that easy to read it because the sizings seems to be constantly changing when I play lol. Against tight regulars on the BB when I'm on BU, I really like the minraise (with a larger range of course otherwise it doesn't make sense), it often brings them to play pots OOP in situation of both having a weak range, which they are generally not that used to (and I am). If you are not familiar with loose play (or heads-up play) stick to standard stealing ranges with 2,5bb or 3bb raises, they are already quite effective. And by the time they won't be effective anymore you will likely have got better enough to adapt your sizings and ranges by yourself 
Edit: I did not mention, I'm mostly talking about shorthanded cashgame. I have little experience in MTTs in which my basic preflop sizings are not really fixed and I'm not competent enough to talk about how to adapt them there. As for fullring cashgame, well I suppose what I said is still correct, but I think it is a mistake to raise too big from UTG or blinds, because there are a lot of opponents and the probability to encounter a much stronger hands rises, and might get these 5bb raises to have a lower EV than 4bb standards. I don't really know about it, just guessing.