acc_loess {dataquieR}  R Documentation 
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.
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 )
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

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 
plot_data_time 
logical mark times with data values (caution, there may be many marks) 
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 intervalbased 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
.
a list with:
SummaryPlotList
: list with two plots:
Loess_fits_facets
: ggplot2 LOESS plot provides panels for each
subject/object. The plot contains LOESSsmoothed curves
for each level of the group_vars. The red dashed lines represent the
confidence interval of a LOESS curve for the whole data.
Loess_fits_combined
: ggplot2 LOESS plot combines all curves into one
panel and is obtained by myloess$Loess_fits_combined
. Given a low
number of levels in the group_vars
this plot eases comparisons. However, if number increases this plot may
be too crowded and unclear.