Calculate runs test and plot profile plot. The output is a plot of runs profiles (with p-value to indicate level of correlation)
Source:R/plotRunsProfile.R
plotRunsProfile.Rd
Calculate runs test and plot profile plot. The output is a plot of runs profiles (with p-value to indicate level of correlation)
Arguments
- model
Fitted model object (glm or gam)
- varlist
Vector of covariate names (continous covariates only)
- label
Label printed at the end of the plot name to identify it when
save=TRUE
.- save
(
default=FALSE
). Logical stating whether plot should be saved into working directory.
Value
Runs profile plots are returned for residuals ordered by each covariate in varlist
, predicted value and index of observations (temporally).
The black line is the line of sequences of positive or negative residuals. The vertical lines are the change between a sequence of positive to negative residuals (or vice versa).
The p-values are from a runsTest
and indicate whether there is correlation in the residuals (p<0.05) or independence (p>0.05). The test statistic determines the type of correlation (positive/negative) and the result printed at the bottom of the figure.
Note: if the covariate is discrete in nature (like the example below), there will be a lot of overplotting of runs. Some jittering occurs at each discrete value (for covariates with <= 25 unique values).