  Linear mixed effects models (LMMs) are a popular and powerful tool for
analyzing clustered or repeated observations for numeric outcomes. LMMs consist
of a fixed and a random component, specified in the model through their
respective design matrices. Checking if the two design matrices are correctly
specified is crucial since mis-specifying them can affect the validity and
efficiency of the analysis. We show how to use random processes defined as
cumulative sums of appropriately ordered model's residuals to test if the
functional form of the fitted LMM is correctly specified. We show how these
processes can be used to test goodness-of-fit of the functional form of the
entire model, or only its fixed and/or random component. Inspecting plots of
the proposed processes is shown to be highly informative about the potential
mis-specification of the functional form of the model, providing clues for
potential improvement of the model's fit. We show how the visual inspection can
be objectified by using a novel procedure for estimating $p$-values which can
be based on sign-flipping/bootstrap or simulations and show its validity by
using theoretical results and a large Monte Carlo simulation study. The
proposed methodology can be used with LMMs with multi-level or crossed random
effects.% and could also be extended to generalized LMMs.
