predict_polar_gam: Get all predictions from a polar GAM model

View source: R/gam.R

predict_polar_gamR Documentation

Get all predictions from a polar GAM model

Description

It returns a tibble with the predictions from all the terms in a polar_gam model.

Usage

predict_polar_gam(
  model,
  origin = NULL,
  exclude_terms = NULL,
  length_out = 50,
  values = NULL,
  return_ci = FALSE,
  ci_z = 1.96
)

Arguments

model

A polar_gam model object.

origin

The coordinates of the origin as a vector of c(x, y) coordinates.

exclude_terms

Terms to be excluded from the prediction. Term names should be given as they appear in the model summary (for example, "s(x0,x1)").

length_out

An integer indicating how many values along the numeric predictors to use for predicting the outcome term (the default is 50).

values

User supplied values for numeric terms as a named list.

return_ci

Whether to return a tibble with cartesian confidence intervals (for use with geom_polar_ci).

ci_z

The z-value for calculating the CIs (the default is 1.96 for 95 percent CI).

Details

The function converts the coordinates from polar to cartesian automatically.

To see an example of plotting, see the examples in geom_polar_ci.

Value

A tibble with predictions from a polar_gam model.

Examples


library(dplyr)
tongue_it01 <- filter(tongue, speaker == "it01")
it01_pol <- polar_gam(Y ~ s(X, by = c2_place) + s(X, word, bs = "fs"),
data = tongue_it01)

# get predictions
it01_pred <- predict_polar_gam(it01_pol)

# get predictions excluding the random smooth for word (the coefficient for
# the random smooth is set to 0)
it01_excl_rand <- predict_polar_gam(it01_pol, exclude_terms = "s(X,word)")


rticulate documentation built on April 3, 2025, 7:26 p.m.