Sorry for the long delay in response. There are a couple of things you can do. First, get a vacume gauge and to check for vaccum independently from the gauge on the dash, as it can be malfunctioning. If you have low vaccum, the lititure that comes with the gauge will explain what's going on by reading the gauge. That's would be the first place I would start. Following that, and using the information learned from the vaccum gauge test I would want to find and fix any vaccum leaks, and test again until vaccum is accepable. If the vaccum gauge still indicates a problem after you've made sure there are no vaccum leaks, read the gauge and refer to the accompanying documentation that came with the guage to islolate the problem. Most likely if you have no leaks, and you read the gauge correctly, it will tell you what the problem may well be. A compression test of the engine will tell you the mechanical condition of the engine. As with the vaccum gauge, a compression gauge will have documentation on how to isolate a problem using the gauge.
All of the about is assuming that the engine has properly functioning emission (EGR not leaking into intake at idle), and engine controls, like good plugs, and wires, a clean MAF, and you've tested the TPS, and IAC.
When I start an engine diagnosis process, I start at the air filter (clean), MAF (clean), IAC (unplugged the engine dies), TPS (propper voltage closed and voltage scales smoothly to max reading), pull plugs and check/replace (and ohm out plug wires while I'm at it), and make sure all vaccum lines look good (old hard lines replaced), start engine and bring up to OT. Turn off the engine and connect jumper wire to perform a KOEO test to pull codes, and then a KOER and then a weak cylinder test. Knowing the parts I've already checked, any DTC will not be a mystery to fix. You can however still have a poor idle even with no DTC's and everything working properly. For this, the solution is to alway do an idle relearn proceedure. I noted on a previous post that for my car, I was only able to get rid of a rough idle after having done all of the above, by pulling the SPOUT connector, and starting the car without touching the gas peddle, depressing the brake peddle and putting the car in 'R' and waiting for the injectors to adjust their output. Then into netural, then 'D', back to netural, and to 'R' and to 'P', and then repeat it 3 more times with the car at OT and the radiator fan coming on and off several times in each gear. When I was done, the idle remains steady, with or without a load, and in every gear without fail ever since. I put the SPOUT connector back in, and I did not have to do another idle relearn proceedure as my idle was set at base timing, and infact it idled slightly faster at first, but settled back down to normal after a couple of seconds. Now the car idles like a charm, and no more shacking or changes with I shift in 'R' or 'D', or put my foot on the brake, or even when the radiator fan comes on at traffic lights. Amazing. Sorry for the long post. I hope it helps.