This function re-estimates a GAMLj model adding a new plot. If no option is passed, extracts the plots present in the `gamlj*Results` object. If one plot is present, it is returned as a ggplot2 object, if more than one is present, a list of plots is returned. FALSE is returned if no plot is present or defined.

# S3 method for gamlj
plot(x, formula = NULL, ...)

Arguments

x

a gamlj results object of the class `gamlj`

formula

a right hand side formula specifying the effect to plot, of the form `~x`, `~x*z` or `~x*z*w`. It has prevalence on other options defining a plot.

...

all options accepted by a gamlj model function. Relevant for new plots are plot_x, plot_z and plot_by

Value

an object of class ggplot or a list of ggplot objects

Author

Marcello Gallucci

Examples

data(qsport)
gmod<-GAMLj3::gamlj_lm(
  formula = performance ~ hours,
  data = qsport)

plot(gmod,plot_x = 'hours')

plot(gmod,formula=~hours)
#> [[1]]

#>