Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

start.Lexis

Time series and other methods for Lexis objects


Description

Extract the entry time, exit time, status or duration of follow-up from a Lexis object. Classify states.

Usage

entry( x, time.scale = NULL, by.id=FALSE )
      exit( x, time.scale = NULL, by.id=FALSE )
    status( x, at="exit"        , by.id=FALSE )
       dur( x,                    by.id=FALSE )
 transient( x )
 absorbing( x )
 preceding( x, states )
    before( x, states )
succeeding( x, states )
     after( x, states )

Arguments

x

an object of class Lexis.

time.scale

a string or integer indicating the time scale. If omitted, all times scales are used.

by.id

Logical, if TRUE, only one record per unique value of lex.id is returned; either the first, the last, or for dur, the sum of lex.dur. If TRUE, the returned object have the lex.id as (row)names attribute.

at

string indicating the time point(s) at which status is to be measured. Possible values are "exit" or "entry".

states

Character vector of states.

Value

The entry and exit functions return a vector of entry times and exit times, respectively, on the requested time scale. If multiple time scales are requested, a matrix is returned.

The status function returns a vector giving the status at "at" (either 'entry' or 'exit') and dur returns a vector with the lengths of the follow-up intervals.

entry, exit, status and dur return vectors of length nrow(x) if by.id=FALSE; if by.id=TRUE a vector of length length(unique(lex.id)).

The functions transient and absorbing return character vectors of the transient, resp. absorbing states in x. These are necessariy disjoint but the union may be a proper subset of levels(x), since the latter may have levels that are never assumed by either lex.Cst or lex.Xst.

preceding returns a character vector with names of the states of the Lexis object x from which one of the states in states can be reached directly - the preceding states. before is just a synonym for preceding.

succeeding returns a character vector with names of the states of the Lexis object x that can be reached directly from one of the states in states. after is just a synonym for succeeding.

Author(s)

Martyn Plummer & Bendix Carstensen

See Also


Epi

Statistical Analysis in Epidemiology

v2.44
GPL-2
Authors
Bendix Carstensen [aut, cre], Martyn Plummer [aut], Esa Laara [ctb], Michael Hills [ctb]
Initial release
2021-02-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.