File: is_gam_model.Rd

package info (click to toggle)
r-cran-insight 0.19.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,308 kB
  • sloc: sh: 13; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 982 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/is_gam_model.R
\name{is_gam_model}
\alias{is_gam_model}
\title{Checks if a model is a generalized additive model}
\usage{
is_gam_model(x)
}
\arguments{
\item{x}{A model object.}
}
\value{
A logical, \code{TRUE} if \code{x} is a generalized additive model
\emph{and} has smooth-terms
}
\description{
Small helper that checks if a model is a generalized additive
model.
}
\note{
This function only returns \code{TRUE} when the model inherits from a
typical GAM model class \emph{and} when smooth terms are present in the model
formula. If model has no smooth terms or is not from a typical gam class,
\code{FALSE} is returned.
}
\examples{
if (require("mgcv")) {
  data(iris)
  model1 <- lm(Petal.Length ~ Petal.Width + Sepal.Length, data = iris)
  model2 <- gam(Petal.Length ~ Petal.Width + s(Sepal.Length), data = iris)
  is_gam_model(model1)
  is_gam_model(model2)
}
}