The Humor Research Lab at the Leeds School of Business at University of Colorado Boulder (and doesn't that sound like it was created by The Onion?) concocted an algorithm to rate America's funniest cities.

Humor researchers calculated factors like the number of working comics and comedy clubs per capita, funny local tweeters and visits to funny websites. They asked people to assess what they called their "need for levity."

Adrian Ward, a co-author of the study, says it's not all algorithms. "A city's sense of humor is a living, breathing thing created by everything from coffee shop conversations," he says, "to the laughter that erupts at comedy clubs."

Chicago ranked first, not surprisingly. It's home to great comic institutions like Second City, The Onion,Wait Wait ... Don't Tell Me!, and the Chicago City Council.

Boston is No. 2. Boston is a lot like Chicago, but smaller and better educated.

Washington, D.C., is fourth, perhaps because Americans like to watch the antics of official Washington the way they laugh at monkeys in a zoo who fling feces and scratch themselves.

Portland, Ore., is fifth; a nice nod to an engaging place. An unnamed Portlandian told researchers, "We enjoy Darth Vader wearing a kilt riding a unicycle playing the bagpipes."

Make that a line-caught, free-range, shade-grown unicycle in Portland.

New York is sixth. I bet it would be higher if they'd considered just Brooklyn, which, like Chicago, is it's own punch line. But it's too expensive to be funny in Manhattan.

Nothing deflates laughs like algorithms and analysis. But you might notice that all the cities atop this humor survey possess personality. You wouldn't confuse Chicago with Portland; or Portland with Atlanta, Los Angeles and San Francisco, which are also among the top 10. Each of those cities puts a stamp on the people who live there, and humor is an important part of character.

I spent a lot of time last summer with a loved one in the intensive care unit of a Chicago hospital. One middle of the night, I came downstairs to the 24-hour Starbucks. Everyone in line looked wet-eyed and anxious. Spending all night in a hospital didn't seem like a happy occasion for anyone.

A Motown hit came on. And when Martha and the Vandellas sang that summer's here and the time is right, all us strangers joined in to sing a line to make us smile: "They're dancin' in Chicaaago ..."

Copyright 2014 NPR. To see more, visit http://www.npr.org/.

Transcript

SCOTT SIMON, HOST:

Need a good laugh? Try Chicago. The Humor Research Lab at the Leeds School of Business at the University of Colorado, Boulder - and doesn't that sound like it was created by "The Onion"? - concocted an algorithm to rate America's funniest cities. Humor researchers calculated factors like the number of working comics and comedy clubs per capita, funny local Tweeters, and visits to humorous websites, perhaps like IRS.gov.

They asked people to assess what they called their need for levity. But Adrian Ward, a co-author of the study, says it's not all algorithms. A city's sense of humor is a living, breathing thing; created by everything from coffee shop conversations, he says, to the laughter that erupts at comedy clubs. Chicago ranked first, not surprisingly. It's home to great comic institutions like Second City, "The Onion," WAIT WAIT...DON'T TELL ME! and the Chicago City Council. Boston is No. 2. Boston is a lot like Chicago, but smaller and better educated.

Washington, D.C., is fourth, perhaps because Americans like to watch the antics of official Washington the way they laugh at monkeys in a zoo who fling feces and scratch themselves. Portland, Ore., is fifth - a nice nod to an engaging place. An unnamed Portlandian told researchers: We enjoy Darth Vader wearing a kilt, riding a unicycle, playing the bagpipes. Make that a line-caught, free-range, shade-grown unicycle in Portland.

New York is No. 6. I bet it would be higher if they'd consider just Brooklyn. Brooklyn, like Chicago, is it's own punch line, but it's too expensive to be funny in Manhattan.

Nothing deflates laughs like algorithms and analysis, but you might notice that all the cities atop this humor survey possess personality. You wouldn't confuse Chicago with Portland; or Portland with Atlanta, Los Angeles and San Francisco, which are also among the top 10. Each of those cities puts a stamp on the people who live there, and humor is an important part of character.

I spent a lot of time last summer with a loved one in the intensive care unit of a Chicago hospital. One middle of the night, I came downstairs to the all-night Starbucks. Everyone in line looked wet-eyed and anxious. Spending all night in a hospital didn't seem like a happy occasion for anyone. A Motown hit came on, and when the Vandellas sang that summer's here and the time is right, all us strangers joined in to sing a line to make us smile. They're dancing in Chicago...

(SOUNDBITE OF SONG, "DANCING IN THE STREET")

MARTHA AND THE VANDELLAS: (Singing) They're dancing in Chicago. Dancing in the street. Down in New Orleans. In the street. In New York City. Dancing in the street. All we need is music, sweet music. Sweet, sweet music. They'll be music everywhere. Music everywhere. They'll be swinging and swaying and records playing, dancing in the street. Oh, it doesn't matter what you wear just as long as you are there. So ... Transcript provided by NPR, Copyright NPR.