time_series: Generate Time Series from Defined Analysis or Analyses

Description Usage Arguments Value Methods (by class) Examples

View source: R/time_series.R

Description

Creates time series data frame(s) from defined analysis/analyses (define_analyses()), device-event data frame (deviceevent()), and optionally, exposure data frame (exposure()). If analysis includes covariates or time in-vivo, creates the relevant supporting data frame.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
time_series(analysis, ...)

## S3 method for class 'list'
time_series(analysis, ...)

## S3 method for class 'mds_das'
time_series(analysis, ...)

## S3 method for class 'mds_da'
time_series(analysis, deviceevents, exposure = NULL, use_hierarchy = T, ...)

Arguments

analysis

A defined analysis object of class mds_da, list of class mds_das, or a list of objects each of class mds_da, usually created by define_analyses().

...

Further arguments for future work.

deviceevents

A device-event data frame of class mds_de, usually created by deviceevent(). This should be the same data frame used to generate analysis.

exposure

Optional exposure data frame of class mds_e, usually created by exposure(). This should be the same data frame used to generate analysis, if exposure data was used.

Default: NULL will not consider exposure data.

use_hierarchy

Deprecated - do not use. Logical value indicating whether device and event hierarchies should be used in counting contingency tables for disproportionality analysis.

Value

A standardized MD-PMS time series data frame of class mds_ts.

The data frame contains, by defined date levels, the following columns:

nA

Count of the device & event level of interest. If covariate analysis is indicated, this will be at the covariate & device level of interest.

nB

Optional. Count of the device & non-event, or if covariate analysis, covariate & non-device. nB will be missing if this is an 'All' level analysis.

nC

Optional. Count of the non-device & event, or if covariate analysis, non-covariate & device. nC will be missing if this is an 'All' level analysis.

nD

Optional. Count of the non-device & non-event, or if covariate analysis, non-covariate & non-device. nD will be missing if this is an 'All' level analysis.

ids

List of all keys from deviceevents constituting nA.

exposure

Optional. Count of exposures applicable to nA. This counts at the device and covariate levels but not at the event level. If a matching device and/or covariate level is not found, then exposure will be NA. The exception is an 'All' level analysis, which counts exposures across all levels.

ids_exposure

Optional. List of all exposure keys from exposure applicable to nA.

The mds_ts class attributes are as follows:

title

Short description of the analysis.

analysis

The analysis definition of class mds_da.

exposure

Boolean of whether exposure counts are present.

dpa

Boolean of whether 2x2 contingency table counts are present (presumably for disproportionality analysis or 'DPA').

dpa_detail

Optional. If dpa is TRUE, list object containing labels for the DPA contingency table.

covar_data

Optional. If analysis definition includes covariate level or time in-vivo, data.frame object containing the relevant data.

Methods (by class)

Examples

1
2
3
4
5
6
7
de <- deviceevent(maude, "date_received", "device_name", "event_type")
ex <- exposure(sales, "sales_month", "device_name", count="sales_volume")
da <- define_analyses(de, "device_name", exposure=ex)
# Time series on one analysis
time_series(da, de, ex)
# Time series on multiple analyses
time_series(da[1:3], de, ex)

mds documentation built on July 1, 2020, 10:38 p.m.