Skip to contents

Plot component functions

Usage

g_component(
  object,
  rug_sides = "b",
  missings_spec = missings_specification(),
  facet_spec = facet_specification(),
  logodds_to_prob = FALSE
)

Arguments

object

Object of class sculpture.

rug_sides

"" for none, "b", for bottom, "trbl" for all 4 sides (see geom_rug)

missings_spec

Object of class missings_specificatoin.

facet_spec

Object of class facet_specificatoin.

logodds_to_prob

(logical) Only valid for binary response and sculptures built on the log-odds scale. Defaults to FALSE (i.e. no effect). If TRUE, then the y-values are transformed through inverse logit function 1 / (1 + exp(-x)).

Value

List of ggplots (one for continuous features, one for discrete).

Examples

df <- mtcars
df$vs <- as.factor(df$vs)
model <- rpart::rpart(
  hp ~ mpg + carb + vs,
  data = df,
  control = rpart::rpart.control(minsplit = 10)
)
model_predict <- function(x) predict(model, newdata = x)
covariates <- c("mpg", "carb", "vs")
pm <- sample_marginals(df[covariates], n = 50, seed = 5)

rs <- sculpt_rough(
  dat = pm,
  model_predict_fun = model_predict,
  n_ice = 10,
  seed = 1,
  verbose = 0
)

ds <- sculpt_detailed_gam(rs)

g_component(ds)$continuous