Learn R Programming

deal (version 1.1-2)

timeslice: Prepare time series data for analysis with Deal

Description

Prepare a dataframe with dynamic and non-dynamic variables for analysis as timeslice networks.

Usage

timeslice(df, tvar, id = 0, time = 0, dropid = TRUE)

Arguments

df
Dataframe
tvar
The indices (column numbers) of the timevarying variables in df.
id
If on column in df defines individuals, this is the column index. Otherwise this should be 0.
time
The column in df that corresponds to time. If no such variable is present, this should be 0.
dropid
If TRUE the column number id is dropped in the returned dataframes.

Value

  • A list with two components
  • bigdfA dataframe like df but with one extra column per timevarying variable.
  • smalldfA dataframe like df but with only one replicate per id of the non-timevarying variables.

Details

Repeated measurements of a variable $x$ on the same individual is assumed to follow a first order Markov process. A new column $x_{t-1}$ in the dataframe is created where the time-lagged variable occurs. The original variable is renamed to $x_t$ and the two variables are then nodes in the network. In the function network the argument tvar is the column indices of both $x_t$ and $x_{t-1}$ (and similarly for other time-varying variables). This will tag the nodes in the network. The dataframe supplied to all functions used in the analysis should be bigdf output from timeslice. This is used as data for the time-varying nodes. The additional argument smalldf should be smalldf supplied also by timeslice. This is used as data for non-timevarying nodes.

References

Further information about Deal can be found at: http://www.math.auc.dk/novo/deal.

See Also

network