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

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).

Value

A tibble with predictions from a polar_gam model.

Details

The function behaves like predict_gam but it converts the coordinates from polar to cartesian automatically. Check vignette("predict-gam", package = "tidymv") to an overview of the predict method.

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

Examples

# \donttest{
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)
#> The origin is x = 14.3901267816422, y = -65.2315420525847.

# 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)")
# }