The Dunning-Kruger effect (DKE) is the finding that, across a wide range of tasks, poor performers greatly overestimate their ability, while top performers make more accurate self-assessments. The original account of the DKE involves the idea that metacognitive insight requires the same skills as task performance, so that unskilled people perform poorly and lack insight. However, typical global measures of self-assessment are prone to statistical and other biases that could explain the same pattern. We used psychophysical methods to examine metacognitive insight in simple movement and spatial memory tasks: pointing at a dot, or recalling its position after a short delay. We measured task skill in an initial block, and self-assessment in a second block, in which participants judged after every trial whether they had hit the target or not. Metacognitive calibration and sensitivity were indeed related to task skill, and partially mediated the DKE. In a second study, we again measured task skill in an initial block, but titrated task difficulty in the second block so that all participants performed the task with equivalent levels of success. Metacognitive measures were again related to skill, but the DKE pattern itself was eliminated. In a third study, we used statistical modelling to illuminate these findings, showing that differences in metacognitive calibration and sensitivity can contribute to the DKE, but are neither necessary nor sufficient for it. This general analysis explains and quantifies how metacognitive insight and other factors interact to determine this famous effect.