Plotting methods for objects of class "bamlss" and "bamlss.results", which can be used for producing effect plots of model terms, trace plots of samples or residual plots. Note that effect plots of model terms with more than two covariates are not supported, for this purpose use function predict.bamlss.

# S3 method for bamlss
plot(x, model = NULL, term = NULL,
  which = "effects", parameters = FALSE,
  ask = dev.interactive(), spar = TRUE, ...)

# S3 method for bamlss.results
plot(x, model = NULL, term = NULL,
  ask = dev.interactive(), scale = 1, spar = TRUE, ...)

Arguments

x

An object of class "bamlss" or "bamlss.results".

model

Character or integer. For which model should the plots be created?

term

Character or integer. For which model term should a plot be created?

which

Character or integer, selects the type of plot: "effects" produces effect plots of smooth model terms, "samples" shows trace plots of samples, "hist-resid" shows a histogram of residuals (see also residuals.bamlss for the different available types), "qq-resid" shows a quantile-quantile plot of residuals, "scatter-resid" shows a scatter plot of residuals with fitted values for the distribution mean (if available in the family object), "max-acf" shows an acf plot of the maximum autocorrelation of all parameter samples.

parameters

For trace plots of parameters, should corresponding parameter values as returned from an optimizer function (e.g., opt_bfit) be added as horizontal lines?

ask

For multiple plots, the user is asked to show the next plot.

scale

If set to 1, effect plots all have the same scale on the y-axis. If set to 0 each effect plot has its own scale for the y-axis.

spar

Should graphical parameters be set?

...

Arguments to be passed to plot2d, plot3d, sliceplot, plotblock, plotmap and residuals.bamlss.

Examples

if (FALSE) ## Generate some data.
d <- GAMart()

## Model formula.
f <- list(
  num ~ s(x1) + s(x2) + s(x3) + te(lon,lat),
  sigma ~ s(x2) + te(lon,lat)
)

## Estimate model.
b <- bamlss(f, data = d)
#> Error in eval(expr, envir, enclos): object 'd' not found

## Effect plots
plot(b, ask = FALSE)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'plot': object 'b' not found
plot(b, model = "mu")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'plot': object 'b' not found
plot(b, model = "sigma", term = "te(lon,lat)")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'plot': object 'b' not found

## Trace plots.
plot(b, which = "samples")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'plot': object 'b' not found

## Residual plots.
plot(b, which = 3:4)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'plot': object 'b' not found