I'm guessing your chain jumps off when you are either changing into gear 1, or your highest gear? This is a symptom that your high/low stop is not set correctly, so the rear mech is shifting the chain right off the end of the gears!
The rattling sound you describe sounds like your indexing is off, which is easily fixed.
This
YouTube video will probably help you.
Edit: One thing that I think that video doesn't highlight very well - If your bike is slow to change down a gear, you need to tension the cable as shown in the video.
If your bike is slow to change up a gear, then you need to loosen the cable by turning the barrel adjuster the opposite way.