Commas are used to offset interjections from the rest of the sentence. "Yes," "indeed," "absolutely" are examples of interjections.
What Are Interjections?
Interjections are included in a sentence (usually at the start) to express a sentiment such as surprise, disgust, joy, excitement, or enthusiasm. For example:
Yes, I've won.
Indeed, you have.
Well, the rain has played its part in the outcome of this match.
Yes, she will apologize.
Absolutely, a fifth of all the students live in the village.
A Comma or an Exclamation Mark?
When an interjection at the start of a sentence is followed by a comma, the interjection is given a mild force. To give an interjection at the start of a sentence more force, you can use an exclamation mark. This makes the interjection more impactful. For example:
No! It's not yours.
(The interjection is more impactful with an exclamation mark.)
When an interjection is followed by an exclamation mark, it is common for the sentence to be an exclamatory sentence, i.e., one that ends with an exclamation mark. For example:
No! It's not yours!
Yes! I've won!
An interjection at the start of a sentence can also be followed by a period (full stop). A period gives a mild interjection and a slight pause. Here is an infographic that summarizes these points and shows more interjections: