The office party is in full swing, you've knocked back a few glasses of bubbly and edged on to the sticky dancefloor where Fred from accounts is looking strangely attractive as he struts out some wild moves. Nearby, Ian from IT is boogieing like nobody's watching. What makes them so confident while your feet are shyly shifting from side to side? According to Dr Peter Lovatt, principal lecturer in psychology at the University of Hertfordshire, it's to do with age, gender and genetic makeup.

Lovatt – who is known around campus as Dr Dance – has just completed a major piece of research into dance, analysing 13,700 people's responses to an online video of him, a former professional dancer, strutting his stuff. Lovatt demonstrated various dance movements, then asked respondents to rate them. He also asked people to imagine they were dancing at a wedding or disco, and say how good they were compared with the average dancer.

Peter Lovatt, aka Dr Dance, struts his stuff to help you discover your dance style University of Hertfordshire

The research was part of his investigation into "dance confidence" (DC) – the factor that makes the difference between you sitting glued to the bar seat and actually going for a boogie – and how it changes with age and gender. "First things first if deep down you think you're a better dancer than most, you're not alone," Lovatt laughs. "The average DC level was significantly higher than expected, meaning most people thought they were better dancers than the average person of their own age and gender."

The findings also show a significant difference between how women and men develop DC. The highest level was recorded in girls under 16. "At this stage, dancing is for fun. They do it on their own, with friends or in formal dance classes, and do so to enjoy it," explains Lovatt. But once girls pass their 16th birthday, there is a big drop. "Teenagers are likely to start dancing publicly in front of members of the opposite sex, and as dance starts to play a part in the sexual selection process for the first time, that may contribute to a significant reduction in dance confidence."

From then until 35, however, women's DC levels increase steadily. "They are likely to be moving through the mate-selection and reproduction cycle, so they will be more confident in the behaviours which form part of this process, like recreational dancing," says Lovatt. But that pattern reverses after 55. "From then on, DC drops steadily and significantly. That's not surprising if perceptions of dance ability are related to fertility-based courtship displays, because this is a post-menopausal life stage."

It's a different story for boys, however. They did not show the pre-16 peak seen in the female data, instead increasing DC every year until middle age, then flattening before rising sharply at 65. "The significant increase in rates for older men could be because in partner situations women's DC has gone down, so men might be less intimidated by women's confidence. Also, separate research findings show that optimistic people are less likely to suffer from life-threatening conditions than pessimistic people. So it might be the case that our sample of older men includes those optimists who have outlived their pessimistic contemporaries."

But it's not just genetics that make your legs itch to hit the dancefloor. "People dance for social bonding and mate-selection purposes," Lovatt says. "It's also good for your health and fitness, and people dance to enjoy themselves. Some dance because they are told they have to, and it has been used to show strength and fearlessness, like the traditional Maori haka dance."

Lovatt says his own experience proves dance can provide confidence that spills into other areas of life. Suffering from profound reading difficulties at school, he left with no qualifications, and was unable to read until he was 23. "I taught myself to read while working as a dancer in theatres," he says. "I was surrounded by talent and thought it was ridiculous that I couldn't read, so I just sat down and, very slowly, learned."

Next, Lovatt studied A-levels, then a degree in psychology and English at Roehampton Institute, ultimately gaining a PhD and taking a senior researcher post at Cambridge University. Now, he combines dancing "nearly every day" with dance research at Hertfordshire University, where he teaches the psychology of performing arts.

There, in his onsite dance laboratory, Lovatt flags up more interesting research. "Beautiful women of high genetic quality with symmetrical features have been shown to innately select men with equally high-quality genetic features," he says, "even when they were only shown videos of the men dancing, and couldn't see the men's faces." Women of a lower genetic quality who watched the same videos, by contrast, "thought all the men were great", Lovatt explains.

He says there is good news for everyone from that research: "It means the best way to attract a compatible mate is to relax and just move naturally to the rhythm."

Lovatt also has some specific findings for men to make women fall at – rather than trip over – their feet this Christmas. "My research showed women find men who use medium-sized, complex movements to be the most attractive. If a woman is looking for an attractive and dominant man, she'll go for one doing very large, complex movements, but if she wants an attractive yet submissive man then she'll go for one doing smaller, complex movements." Simple, small movements are considered unattractive, submissive and feminine, apparently. But don't head straight for a dance studio to learn a new routine. "Dance lessons are a bit like plastic surgery," says Lovatt. "They mask the true expression of your genes."

• Peter Lovatt is carrying out more research into dance – take part in his latest survey at bit.ly/WhyDance. Find out more on his website DanceDrDance.com