.Deprecated("plot_smooth", msg="'plot_gamsd' is deprecated and will be removed, use 'plot_smooths()'. (Plotting with the difference smooth is not supported yet.)\n")
.Deprecated("plot_smooth", msg="'plot_gamsd' is deprecated and will be removed, use 'plot_smooths()' and 'plot_difference'.\n")
#' It plots the difference smooth from a \link[mgcv]{gam} or \link[mgcv]{bam}.
#' Significant differences are marked with red areas.
#'
#' @inheritParams get_gam_predictions
#' @param time_series An unquoted expression indicating the model term that defines the time series.
#' @param difference A named list with the levels to compute the difference of.
#' @param conditions A named list specifying the levels to plot from the model terms not among \code{time_series} or \code{difference}. Notice the difference with \link[tidymv]{plot_smooths}, which uses \link[rlang]{quos}.
@@ -4,6 +4,6 @@ This is the repository of the `R` package `tidymv`. This package provides functi
##Installation
To install the package, use `devtools::install_github("stefanocoretta/tidymv@v1.4.0", build_vignettes = TRUE)`. To learn how to use the package, do `vignette("plot-smooths", package = "tidymv")` after the installation.
To install the package, use `devtools::install_github("stefanocoretta/tidymv@v1.5.0", build_vignettes = TRUE)`. To learn how to use the package, do `vignette("plot-smooths", package = "tidymv")` after the installation.
If you wish to install the development version, use `devtools::install_github("stefanocoretta/tidymv", build_vignettes = TRUE)`.
To illustrate how to use `plot_gamsd()`, let's first prepare some dummy data with a factor variable and run `gam()` on this data. The `gam` model includes a reference smooth `s(x2)`, a by-factor difference smooth `s(x2, by = fac)`, and a smooth `s(x0)`.
To illustrate how to use `plot_smooths()`, let's first prepare some dummy data with a factor variable and run `gam()` on this data. The `gam` model includes a reference smooth `s(x2)`, a by-factor difference smooth `s(x2, by = fac)`, and a smooth `s(x0)`.
```{r gam}
@@ -50,6 +52,23 @@ plot_smooths(
theme(legend.position="top")
```
##Plotting a single smooth
It is also possible to plot a single smooth.
```{r gam-2}
model_2<- gam(
y~
s(x0),
data=data
)
plot_smooths(
model=model_2,
time_series=x0
)
```
##Plotting interactions
It is very likely that the model will contain interactions.
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
Learn more.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
You can always update your selection by clicking Cookie Preferences at the bottom of the page.
For more information, see our Privacy Statement.
Essential cookies
We use essential cookies to perform essential website functions, e.g. they're used to log you in.
Learn more
Always active
Analytics cookies
We use analytics cookies to understand how you use our websites so we can make them better, e.g. they're used to gather information about the pages you visit and how many clicks you need to accomplish a task.
Learn more
Some generated files are not rendered by default. Learn more.
Some generated files are not rendered by default. Learn more.