The above express the wish/desire of a third person(i.e., a person other than the speaker and the person spoken to).
~がっています is used with other i-adjectives and na-adjectives of emotions, and the senses as well, when the subject is in third person.
わたしはさびしいです(I'm lonely.) → あの人はさびしがっています(That person is lonely.)
わたしは残念です(I think it is a pity; I regret it; I feel sorry.) → あの人は残念がっています(That person thinks it is a pity; S/he regrets it; S/he feels sorry.)
兄は外国へ行たがっています。
My older brother wants to go abroad.
タンさんはさびしがっています。
[I think] Tan is lonely.
Lesson 14-1-3「ジョンさんは国へ帰りたいと言っています。」
John says he wants to go back to his country.
Lesson 14-2-2「あの子はおかしがほしいと言っています。」
That child says s/he wants some sweets.