u.spells: DREAM unemployment spell encoding

Description Usage Arguments Value

Description

Computes the length, start, and end, of unemployment spells in a DREAM dataset. Unemployment is everything that is not employment. Employment is (by default) defined as 4 consecutive weeks without benefit and with an income the corresponding months.

Usage

1
2
u.spells(data, row, period = NULL, other.exit = c(651, 652),
  other.censor = c(997, 998, 999), emp.weeks = 4)

Arguments

data

A data.frame (or data.table) containing a DREAM dataset.

row

An integer valued row number (1 to nrow(data)).

period

A character vector of DREAM weeks, e.g. c("y_1701","y_1702","y_1703",...). If NULL then all DREAM benefit weeks in data is used. The default is NULL.

other.exit

An integer vector of DREAM benefit codes that identifies exit other than to employment. If NULL then no other exit. The default is DREAM benefit codes c(651,652).

other.censor

An integer vector of DREAM benefit codes that identifies right censoring other than censoring of observations. If NULL then no other censoring. The default is DREAM benefit codes c(997,998,999).

emp.weeks

An integer that defines the number of consecutive weeks without benefit and with an income the corresponding months needed for employment. The default is 4.

Value

A list with components:

lengths: An integer vector containing the length of each run.

start: A character vector of same length as lengths with start weeks. NA imply that the spell start prior to first week in period.

end: A character vector of same length as lengths with end weeks. NA imply that the spell end after last week in period.

right.censored: A logical vector (TRUE/FALSE) of same length as lengths which indicates whether the spell is right censored.


carstennielsen/DREAMtoolsR documentation built on May 13, 2019, 11:32 a.m.