I do not have numbers but I am quite sure that in most cases the samurais killed themselves either when ordered to do so by the superiors or expected the superiors to order so.
In fact the samurais in Japan enjoyed one privilege that the lower classes did not: they had the right to "honorably" commit suicide instead of being dishonorably executed. So instead of just execute a samurai, his superior would order him to kill himself.
If he refused to do so, then the soldiers of the superior would come, capture the samurai and execute him.
The family of a samurai who was executed forcefully would be stripped of privileges and possessions. So often the superior just sent a letter to the samurai from which it was clear that he wanted him to commit suicide. The letter could be kept secret. The samurai then committed suicide as if it was voluntary. But he knew that if he did not do so, he would be killed anyway and his family suffer.