tidy_mixture_density: Tidy Mixture Data

View source: R/random-tidy-mixture.R

tidy_mixture_densityR Documentation

Tidy Mixture Data

Description

Create mixture model data and resulting density and line plots.

Usage

tidy_mixture_density(...)

Arguments

...

The random data you want to pass. Example rnorm(50,0,1) or something like tidy_normal(.mean = 5, .sd = 1)

Details

This function allows you to make mixture model data. It allows you to produce density data and plots for data that is not strictly of one family or of one single type of distribution with a given set of parameters.

For example this function will allow you to mix say tidy_normal(.mean = 0, .sd = 1) and tidy_normal(.mean = 5, .sd = 1) or you can mix and match distributions.

The output is a list object with three components.

  1. Data

  • input_data (The random data passed)

  • dist_tbl (A tibble of the passed random data)

  • density_tbl (A tibble of the x and y data from stats::density())

  1. Plots

  • line_plot - Plots the dist_tbl

  • dens_plot - Plots the density_tbl

  1. Input Functions

  • input_fns - A list of the functions and their parameters passed to the function itsefl

Value

A list object

Author(s)

Steven P. Sanderson II, MPH

Examples

output <- tidy_mixture_density(rnorm(100, 0, 1), tidy_normal(.mean = 5, .sd = 1))

output$data

output$plots

output$input_fns


TidyDensity documentation built on Nov. 2, 2023, 5:38 p.m.