In the winter you need to keep the heat from escaping, and in the summer, the heat from entering. If you insulated just under the roof at the top if the attic, you would be heating the attic area in the winter. That's because the outside insulated wall would be at the roof and not at the ceiling. If you had central air conditioning, the same would be true in the summer when you'd be forced to cool the whole attic.
Another important factor in attic insulation is ventilation. The attic area above the insulation needs to be kept cold in the winter to prevent ice dams from forming on the roof and to keep moisture from condensing on the insulation and on the roof framing. This is achieved by ventilating the attic. In the summer months, a well-ventilated attic and the actual roof above it, will stay cooler by allowing excess heat to escape through vents thereby keeping the living space below cooler.