I earned a psychology diploma back in 2001, I remember learning about brain wave frequencies. There’s four basic states characterised
by states of being awake and asleep.
Beta is the normal waking state. We are in the state most of the day.
Alpha is a relaxed state often seen in early stages of meditation and deep relaxation.
Theta is the dream state when REM occurs.
Delta is a very deep sleep state with very little brain wave activity.
Between waking up and falling asleep is a natural transition between the alpha state these states are known as hypnogogic and hypnopompic states.
Dream paralysis may be occurring during the hynogogic state just before the victim wakes up. I certain believe these are spiritual attacks howeve for a non Christian perspective you can read more on hypnogogic states here.