From 1851, census returns have a column to note whether a person was deaf, dumb, blind or lunatic but after 1871 there was a separate record of those who were lunatic, imbecile or idiot. When you are using census returns, it is always worth checking the parish workhouse, prisons, hospitals and asylums in the area where your ancestors lived to see whether a member of the family might be there.
Distinctions were made between the different types of mental state:
A lunatic had periods of sanity.
An imbecile was someone who had, later in life, become demented.
An idiot was mentally handicapped from birth.
A moron had a mental age of 8-12.
A cretin had mental retardation caused by thyroid deficiency.
The words have, over the years, lost their medical connotations and become terms of abuse, but they were originally used as a fairly precise definitions. They will help you to understand how members of your family were afflicted.