itsadug: Interpreting Time Series, Autocorrelated Data Using GAMMs...

itsadugR Documentation

Interpreting Time Series, Autocorrelated Data Using GAMMs (itsadug)


Itsadug provides a set of functions that facilitate the evaluation, interpretation, and visualization of GAMM models that are implemented in the package mgcv.


  • vignette('inspect', package='itsadug') - summarizes different functions for visualizing the model.

  • vignette('test', package='itsadug') - summarizes different functions for significance testing.

  • vignette('acf', package='itsadug') - summarizes how to check and account for autocorrelation in the residuals.

Also available online on

Interpretation and visualization

Main functions that are provided in itsadug for interpretation and visualization of GAMM models:

  • pvisgam plots partial interaction surfaces; it also allows for visualizing 3-way or higher interactions.

  • fvisgam plots summed interaction surfaces, with the possibility to exclude random effects.

  • plot_smooth plots 1D model estimates, and has the possibility to exclude random effects.

  • plot_parametric plot group estimates.

  • inspect_random plots and optionally averages random smooths

  • plot_data plots the data

  • plot_topo plots EEG topographies

Testing for significance

  • compareML Performs Chisquare test on two models

  • plot_diff Calculates and visualizes the difference between two conditions within a model

  • plot_diff2 Calculates and visualizes the 2 dimensional difference between two conditions within a model

Evaluation of the model

  • check_resid plots four different plots to inspect the distribution of and structure in the residuals

  • plot_modelfit plots an overlay of the data and the modelfit for randomly selected trials

  • diagnostics produces plots of the distributions of residuals and predictors in the model

Checking and handling autocorrelation

  • acf_resid different ways to inspect autocorrelation in the residuals

  • start_event creates an AR.start column

  • resid_gam returns residuals corrected for the AR1 model


Further, there are some wrappers around the predict.gam function to facilitate the extraction of model predictions. These can be used for customized plots. See for an example in the vignette 'plotfunctions' (vignette('plotfunctions', package='itsadug')).

  • get_predictions for getting the estimates for given settings of some or all of the model predictors;

  • get_difference for extracting the difference between two conditions or two smooths or two surfaces.

  • get_modelterm for extracting the smooth term ( partial) estimates.

  • inspect_random and get_random for extracting random effects only.


  • Use infoMessages(FALSE) to suppress all information messages for the current session. This may be helpful when creating knitr or R markdown reports.

  • The vignettes are available via browseVignettes(). When working on a server via the command line, using ssh -X instead of ssh may make the HTML files available.

  • A list of all available functions is provided in help(package='itsadug').


Jacolien van Rij, Martijn Wieling, R.Harald Baayen, Hedderik van Rijn

Maintainer: Jacolien van Rij (

University of Groningen, The Netherlands

itsadug documentation built on June 17, 2022, 5:05 p.m.