Smooth hypnograms epoch, simulating human scorers behaviour.

smooth_hypnogram(hypnogram, event = "N2", neighbors = "REM", count = 2)

Arguments

hypnogram

A hypnogram dataframe.

event

Central stage label.

neighbors

Extremities stages labels.

count

Number of consecutive central stages.

Value

A hypnogram dataframe.

References

Liang, Sheng-Fu, Chin-En Kuo, Yu-Han Hu, Yu-Hsiang Pan, and Yung-Hung Wang. "Automatic stage scoring of single-channel sleep EEG by using multiscale entropy and autoregressive models." IEEE Transactions on Instrumentation and Measurement 61, no. 6 (2012): 1649-1657.

Examples

hypnogram <- data.frame(begin = as.POSIXlt(
c(1536967800,1536967830,1536967860),origin = "1970-01-01"))
hypnogram$end <- as.POSIXlt(c(1536967830,1536967860,1536967890), 
origin = "1970-01-01")
hypnogram$event = c("REM","N2","REM")
smooth_hypnogram(hypnogram, "N2","REM",1)
#>                 begin                 end event
#> 1 2018-09-14 23:30:00 2018-09-14 23:30:30   REM
#> 2 2018-09-14 23:30:30 2018-09-14 23:31:00   REM
#> 3 2018-09-14 23:31:00 2018-09-14 23:31:30   REM