Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot_bivariate

Create correlation plots for a mixture model


Description

Creates a faceted plot of two-dimensional correlation plots and unidimensional density plots for an object of class 'tidyProfile'.

Usage

plot_bivariate(
  x,
  variables = NULL,
  sd = TRUE,
  cors = TRUE,
  rawdata = TRUE,
  bw = FALSE,
  alpha_range = c(0, 0.1),
  return_list = FALSE
)

Arguments

x

tidyProfile object to plot. A tidyProfile is one element of a tidyLPA analysis.

variables

Which variables to plot. If NULL, plots all variables that are present in all models.

sd

Logical. Whether to show the estimated standard deviations as lines emanating from the cluster centroid.

cors

Logical. Whether to show the estimated correlation (standardized covariance) as ellipses surrounding the cluster centroid.

rawdata

Logical. Whether to plot raw data, weighted by posterior class probability.

bw

Logical. Whether to make a black and white plot (for print) or a color plot. Defaults to FALSE, because these density plots are hard to read in black and white.

alpha_range

Numeric vector (0-1). Sets the transparency of geom_density and geom_point.

return_list

Logical. Whether to return a list of ggplot objects, or just the final plot. Defaults to FALSE.

Value

An object of class 'ggplot'.

Author(s)

Caspar J. van Lissa

Examples

# Example 1
iris_sample <- iris[c(1:10, 51:60, 101:110), ] # to make example run more quickly
## Not run: 
iris_sample %>%
 subset(select = c("Sepal.Length", "Sepal.Width")) %>%
 estimate_profiles(n_profiles = 2, models = 1) %>%
 plot_bivariate()

## End(Not run)
# Example 2
## Not run: 
mtcars %>%
  subset(select = c("wt", "qsec", "drat")) %>%
  poms() %>%
  estimate_profiles(3) %>%
  plot_bivariate()

## End(Not run)

tidyLPA

Easily Carry Out Latent Profile Analysis (LPA) Using Open-Source or Commercial Software

v1.0.8
MIT + file LICENSE
Authors
Joshua M Rosenberg [aut, cre], Caspar van Lissa [aut], Jennifer A Schmidt [ctb], Patrick N Beymer [ctb], Daniel Anderson [ctb], Matthew J. Schell [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.