tm: Computes sleep stages transition matrix from selected stages.

Description Usage Arguments Value Examples

Description

A sleep stages transition matrix contains the probabilities of next stage transition for a given stage.

Usage

1
tm(e, l = c("AWA", "N1", "N2", "N3", "REM"))

Arguments

e

Events dataframe. Dataframe must have begin (POSIXt), end (POSIXt) and event (character) columns.

l

Stages labels. Defaults to c("AWA", "N1", "N2", "N3", "REM")

Value

A matrix.

Examples

1
2
3
4
e <- data.frame(begin = as.POSIXlt(seq(from = 0, to = 30*10, by = 30),origin = "1970-01-01"))
e$end <- as.POSIXlt(seq(from = 30, to = 30*11, by = 30), origin = "1970-01-01")
e$event = c("AWA","N1","N2","N3","N3","REM","N2","REM","N2","REM","AWA")
tm(e)

boupetch/rmdf documentation built on June 26, 2019, 2:25 p.m.