Multiply the stat you want to raise by five. Add that to the stat you want to lower. (Remember this is all in hexadecimal).
For example, if I want to raise Defence and lower Sp. Attack, I would get: 0x1*0x5 + 0x3 = 0x8 = Impish (I checked Bulbapedia and I was right). This is how I did it when I created my Nature changing script (I allowed the user to pick which stats to raise/lower rather than the Nature's name).