A recent study (Speth & Speth, 2017) took a look at cognition across different stages of sleep (sleep onset, REM, and Non-REM) and found some interesting things. By taking samples of subjects' thought content at different time points over the night, they found the presence of self-reflective thought at sleep onset decreased through nonREM and REM sleep, whereas motor imagery was low at sleep onset and increased through nonREM and REM sleep.
The authors of course didn't take into account the greater degree of self-reflective cognition found in lucid dreaming, though accounting for lucidity wasn't a focus of the study. This also contrasts Bulkeley & Grave's (2018) recent publication that found lucid dreams had more references to cognitive processes than visual imagery.
Check out the Psychology Today article for a synopsis of what the Speth & Speth study found.
The topic of consciousness and cognition in sleep is fascinating not just in the realm of science but also in relation to sleep yoga--when you are "lucid" and aware in meditation during other stages of sleep besides during the vivid story-like dreams we typically associate with REM sleep.
What do you think about their study? And what you have noticed about your own sleep "thinking" during the night?--whether you were dreaming, falling asleep, or just having random mental activity while dozing... Drop me line. I'm curious to know your thoughts.