acc_loess: Smoothes and plots adjusted longitudinal measurements

Description Usage Arguments Details Value See Also

View source: R/acc_loess.R

Description

The following R implementation executes calculations for quality indicator Unexpected distribution wrt location (link). Local regression (LOESS) is a versatile statistical method to explore an averaged course of time series measurements (Cleveland, Devlin, and Grosse 1988). In context of epidemiological data, repeated measurements using the same measurement device or by the same examiner can be considered a time series. LOESS allows to explore changes in these measurements over time.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
acc_loess(
  resp_vars,
  group_vars,
  time_vars,
  co_vars = NULL,
  min_obs_in_subgroup,
  label_col = NULL,
  study_data,
  meta_data,
  resolution = 180,
  se_line = list(color = "red", linetype = 2),
  plot_data_time
)

Arguments

resp_vars

variable the name of the continuous measurement variable

group_vars

variable the name of the observer, device or reader variable

time_vars

variable a variable identifying the variable with the time of measurement

co_vars

variable list a vector of covariables, e.g. age and sex for adjustment. Can be NULL (default) for no adjustment.

min_obs_in_subgroup

integer from=0. optional argument if group_vars are used. This argument specifies the minimum number of observations that is required to include a subgroup (level) of the group variable named by group_vars in the analysis. Subgroups with less observations are excluded. The default is 30.

label_col

variable attribute the name of the column in the metadata with labels of variables

study_data

data.frame the data frame that contains the measurements

meta_data

data.frame the data frame that contains metadata attributes of study data

resolution

numeric how many timepoints have a standard error estimation

se_line

list standard error estimator line style, as arguments passed to ggplot2::geom_line()

plot_data_time

logical mark times with data values (caution, there may be many marks)

Details

If plot_data_time is not set, it will be selected based on the number of data points per group: If more than 4000 points would be plotted for at least one group, the > 4000 marks will not be plotted.

Limitations

The application of LOESS usually requires model fitting, i.e. the smoothness of a model is subject to a smoothing parameter (span). Particularly in the presence of interval-based missing data (USR_181), high variability of measurements combined with a low number of observations in one level of the group_vars the fit to the data may be distorted. Since our approach handles data without knowledge of such underlying characteristics, finding the best fit is complicated if computational costs should be minimal. The default of LOESS in R uses a span 0.75 which provides in most cases reasonable fits. The function above increases the fit to the data automatically if the minimum of observations in one level of the group_vars is higher than n=30.

Value

a list with:

See Also

Online Documentation


dataquieR documentation built on Feb. 26, 2021, 5:08 p.m.