plotScatterAcd {ACDm}R Documentation

Scatter plot for ACD models

Description

Function to help scatter plot different variables of a fitted ACD model and superimposes a smoothed conditional mean using ggplot2. Can be used to investigate the possible need for non-linear models and issues with the diurnal adjustment.

Usage

plotScatterAcd(fitModel, x = "muHats", y = "residuals", xlag = 0, ylag = 0,
                           colour = NULL, xlim = NULL, ylim = NULL, alpha = 1/10,
                           smoothMethod = "auto")

Arguments

fitModel

a fitted model of class "acdFit"

x

the variable used on the x-axis. One of "muHats", "residuals", "durations", "adjDur", "dayTime", "time", or "index".

y

the variable used on the y-axis. One of "muHats", "residuals", "durations", "adjDur", "dayTime", "time", or "index".

xlag

number of lags used for the variable shown on the x-axis.

ylag

number of lags used for the variable shown on the y-axis.

colour

a possible third variable to be represented with a colour scale. One of "muHats", "residuals", "durations", "adjDur", "dayTime", or "time".

xlim

a vector of the limits of the x-axis to possibly zoom in on a certain region.

ylim

a vector of the limits of the y-axis to possibly zoom in on a certain region.

alpha

alpha parameter passed to ggplot2. For large data sets many data points will overlap. The alpha parameter can make the points transparent, making it easier to distinguish the density of different region. Takes the value between 1 (opaque) and 0 (completely transparent).

smoothMethod

value passed as smooth argument to ggplot2. See stat_smooth.

Author(s)

Markus Belfrage

Examples

## Not run: 

# The mean residuals are too small for small values of the estimated conditional 
# mean, suggesting a need for a different conditional mean model specification:
fitModel <- acdFit(adjDurData)
plotScatterAcd(fitModel, x = "muHats", y = "residuals")

## End(Not run)

[Package ACDm version 1.0.4.3 Index]