Most people are adamant: They would never do it. Ever. Never deliberately inflict pain on another person, just to obtain information. Ever artificially inflate the value of some financial product, just to take advantage of others’ ignorance. Certainly never, ever become a deadbeat and accept a government bailout.

They speak only for themselves, of course. As for others, well, turn on the news: shady bankers, savage interrogators and deadbeats are everywhere.

* * *

“Well, they gave me this award — the administration did — and I’d sworn I would never take anything from them. But of course there I was, up on stage accepting it.”

In recent years, social psychologists have begun to study what they call the holier-than-thou effect. They have long known that people tend to be overly optimistic about their own abilities and fortunes — to overestimate their standing in class, their discipline, their sincerity.

But this self-inflating bias may be even stronger when it comes to moral judgment, and it can greatly influence how people judge others’ actions, and ultimately their own. Culture, religious belief and experience all help shape a person’s sense of moral standing in relation to others, psychologists say, and new research is helping to clarify when such feelings of superiority are helpful and when they are self-defeating.

“The message in this work is not that you should rid yourself of moral indignation; sometimes that’s appropriate,” said David Dunning, a social psychologist at Cornell University in Ithaca, N.Y. “But the point is that many types of behavior are driven far more by the situation than by the force of personality. What someone else did in that situation is a very strong warning about what you yourself would do.”

One way to test whether people live up to their virtuous self-image is to set them up. In one study, for example, 251 Cornell students predicted how likely they would be to buy a daffodil at Daffodil Days, a four-day campus event to benefit the American Cancer Society. Sure enough, 83 percent predicted that they would buy at least one flower but that just 56 percent of their peers would.

Five weeks later, during the event, the researchers found that only 43 percent of the same students actually bought a daffodil. In other experiments, researchers have found that people similarly overestimate their willingness to do what’s morally right, whether to give to charity, vote or cooperate with a stranger. In the end, their less generous predictions about peers’ behavior tend to be dead-on accurate — for themselves as well as others in the study.

“The gap between how I think I’ll behave and how I actually behave is a function of how well I simulate the situation, and our simulations are guided by our intentions,” said Nicholas Epley, a psychologist at the University of Chicago and a co-author, with Dr. Dunning, in many of these experiments.

“The problem with these holier-than-thou assessments is not only that we overestimate how we would have behaved,” Dr. Epley said. “It’s also that we blame every crisis or scandal on failure of character — you know, if we just fire all the immoral Wall Street bankers and replace them with moral ones, we’ll solve the problem.”

* * *

One practice that can potentially temper feelings of moral superiority is religion. All major faiths emphasize the value of being humble and the perils of hubris. “In humility count others as better than yourself,” St. Paul advises in his letter to the Philippians.

Yet for some people, religion appears to amplify the instinct to feel like a moral beacon. In a 2002 study, researchers at Baylor University in Texas and Simpson University in California evaluated the religious commitment of 249 students, 80 percent of whom were members of a church.