Debian Codegraph @

man/tidy.Mclust.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/mclust.R
3 \name{tidy.Mclust}
4 \alias{tidy.Mclust}
5 \alias{mclust_tidiers}
6 \title{Tidy a(n) Mclust object}
7 \usage{
8 \method{tidy}{Mclust}(x, ...)
9 }
10 \arguments{
11 \item{x}{An \code{Mclust} object return from \code{\link[mclust:Mclust]{mclust::Mclust()}}.}
12
13 \item{...}{Additional arguments. Not used. Needed to match generic
14 signature only. \strong{Cautionary note:} Misspelled arguments will be
15 absorbed in \code{...}, where they will be ignored. If the misspelled
16 argument has a default value, the default value will be used.
17 For example, if you pass \code{conf.lvel = 0.9}, all computation will
18 proceed using \code{conf.level = 0.95}. Two exceptions here are:
19 \itemize{
20 \item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if
21 it will be ignored.
22 \item \code{augment()} methods will warn when supplied a \code{newdata} argument if it
23 will be ignored.
24 }}
25 }
26 \description{
27 Tidy summarizes information about the components of a model.
28 A model component might be a single term in a regression, a single
29 hypothesis, a cluster, or a class. Exactly what tidy considers to be a
30 model component varies across models but is usually self-evident.
31 If a model has several distinct types of components, you will need to
32 specify which components to return.
33 }
34 \examples{
35 \dontshow{if (rlang::is_installed("mclust")) withAutoprint(\{ # examplesIf}
36
37 # load library for models and data
38 library(mclust)
39
40 # load data manipulation libraries
41 library(dplyr)
42 library(tibble)
43 library(purrr)
44 library(tidyr)
45
46 set.seed(27)
47
48 centers <- tibble(
49 cluster = factor(1:3),
50 # number points in each cluster
51 num_points = c(100, 150, 50),
52 # x1 coordinate of cluster center
53 x1 = c(5, 0, -3),
54 # x2 coordinate of cluster center
55 x2 = c(-1, 1, -2)
56 )
57
58 points <- centers |>
59 mutate(
60 x1 = map2(num_points, x1, rnorm),
61 x2 = map2(num_points, x2, rnorm)
62 ) |>
63 select(-num_points, -cluster) |>
64 unnest(c(x1, x2))
65
66 # fit model
67 m <- Mclust(points)
68
69 # summarize model fit with tidiers
70 tidy(m)
71 augment(m, points)
72 glance(m)
73 \dontshow{\}) # examplesIf}
74 }
75 \seealso{
76 \code{\link[=tidy]{tidy()}}, \code{\link[mclust:Mclust]{mclust::Mclust()}}
77
78 Other mclust tidiers:
79 \code{\link{augment.Mclust}()}
80 }
81 \concept{mclust tidiers}
82 \value{
83 A \code{\link[tibble:tibble]{tibble::tibble()}} with columns:
84 \item{proportion}{The mixing proportion of each component}
85 \item{size}{Number of points assigned to cluster.}
86 \item{mean}{The mean for each component. In case of 2+ dimensional models,
87 a column with the mean is added for each dimension. NA for noise
88 component}
89 \item{variance}{In case of one-dimensional and spherical models,
90 the variance for each component, omitted otherwise. NA for noise
91 component}
92 \item{component}{Cluster id as a factor.}
93
94 }