Ghosts might haunt houses out of anger. Since many people believe that a person becomes a ghost because that person died a violent death, he or she may have some resentment. When the ghost haunts a house, they usually do things to create fear or frustration with the people living in the house.
The ghost may feel that they have been wronged during their human life and they need to get revenge on the people who are now in the house where they used to live. Some ghosts seem to only haunt one house. They can’t move from house to house and therefore must remain in this house. It also seems that they feel trapped and can only stay in this house which angers them.