View source: R/plotRunsProfile.R
plotRunsProfile | R Documentation |
Calculate runs test and plot profile plot. The output is a plot of runs profiles (with p-value to indicate level of correlation)
plotRunsProfile(model, varlist, label = "", save = FALSE)
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 |
( |
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).
# load data
data(ns.data.re)
model<-gamMRSea(birds ~ observationhour + as.factor(floodebb) + as.factor(impact),
family='quasipoisson', data=ns.data.re)
plotRunsProfile(model, varlist=c('observationhour'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.