time_series {mds} | R Documentation |
Generate Time Series from Defined Analysis or Analyses
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
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 |
... |
Further arguments for future work. |
deviceevents |
A device-event data frame of class |
exposure |
Optional exposure data frame of class Default: |
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
key
s fromdeviceevents
constitutingnA
.- 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, thenexposure
will beNA
. The exception is an'All'
level analysis, which counts exposures across all levels.- ids_exposure
Optional. List of all exposure keys from
exposure
applicable tonA
.
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
isTRUE
,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)
-
list
: Generate time series from a list -
mds_das
: Generate time series from a list of defined analyses -
mds_da
: Generate time series using defined analysis
Examples
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)