data_plot: Prepare objects for plotting or plot objects

View source: R/data_plot.R

data_plotR Documentation

Prepare objects for plotting or plot objects

Description

data_plot() extracts and transforms an object for plotting, while plot() visualizes results of functions from different packages in easystats-project. See the documentation for your object's class:

  • bayestestR::bayesfactor_models()

  • bayestestR::bayesfactor_parameters()

  • bayestestR::equivalence_test()

  • bayestestR::estimate_density()

  • bayestestR::hdi()

  • bayestestR::p_direction()

  • bayestestR::p_significance()

  • bayestestR::si()

  • effectsize::effectsize()

  • modelbased::estimate_contrasts()

  • parameters::compare_parameters()

  • parameters::describe_distribution()

  • parameters::model_parameters()

  • parameters::principal_components()

  • parameters::n_clusters()

  • parameters::n_factors()

  • parameters::simulate_parameters()

  • performance::check_collinearity()

  • performance::check_heteroscedasticity()

  • performance::check_homogeneity()

  • performance::check_normality()

  • performance::check_outliers()

  • performance::compare_performance()

  • performance::performance_roc()

  • performance::check_posterior_predictions()

Usage

data_plot(x, data = NULL, ...)

Arguments

x

An object.

data

The original data used to create this object. Can be a statistical model.

...

Arguments passed to or from other methods.

Details

data_plot() is in most situation not needed when the purpose is plotting, since most plot()-functions in see internally call data_plot() to prepare the data for plotting.

Many plot()-functions have a data-argument that is needed when the data or model for plotting can't be retrieved via data_plot(). In such cases, plot() gives an error and asks for providing data or models.

Most plot()-functions work out-of-the-box, i.e. you don't need to do much more than calling plot(<object>) (see 'Examples'). Some plot-functions allow to specify arguments to modify the transparency or color of geoms, these are shown in the 'Usage' section.

See Also

Package-Vignettes

Examples

## Not run: 
library(bayestestR)
if (require("rstanarm")) {
  model <- stan_glm(
    Sepal.Length ~ Petal.Width * Species,
    data = iris,
    chains = 2, iter = 200, refresh = 0
  )

  x <- rope(model)
  plot(x)

  x <- hdi(model)
  plot(x) + theme_modern()

  data <- rnorm(1000, 1)
  x <- p_direction(data)
  plot(x)

  x <- p_direction(model)
  plot(x)

  model <- stan_glm(
    mpg ~ wt + gear + cyl + disp,
    chains = 2,
    iter = 200,
    refresh = 0,
    data = mtcars
  )
  x <- equivalence_test(model)
  plot(x)
}

## End(Not run)


see documentation built on March 31, 2022, 5:07 p.m.

Related to data_plot in see...