| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/mclust.R |
| 3 |
\name{glance.Mclust} |
| 4 |
\alias{glance.Mclust} |
| 5 |
\title{Glance at a(n) Mclust object} |
| 6 |
\usage{ |
| 7 |
\method{glance}{Mclust}(x, ...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{x}{An \code{Mclust} object return from \code{\link[mclust:Mclust]{mclust::Mclust()}}.} |
| 11 |
|
| 12 |
\item{...}{Additional arguments. Not used. Needed to match generic |
| 13 |
signature only. \strong{Cautionary note:} Misspelled arguments will be |
| 14 |
absorbed in \code{...}, where they will be ignored. If the misspelled |
| 15 |
argument has a default value, the default value will be used. |
| 16 |
For example, if you pass \code{conf.lvel = 0.9}, all computation will |
| 17 |
proceed using \code{conf.level = 0.95}. Two exceptions here are: |
| 18 |
\itemize{ |
| 19 |
\item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if |
| 20 |
it will be ignored. |
| 21 |
\item \code{augment()} methods will warn when supplied a \code{newdata} argument if it |
| 22 |
will be ignored. |
| 23 |
}} |
| 24 |
} |
| 25 |
\description{ |
| 26 |
Glance accepts a model object and returns a \code{\link[tibble:tibble]{tibble::tibble()}} |
| 27 |
with exactly one row of model summaries. The summaries are typically |
| 28 |
goodness of fit measures, p-values for hypothesis tests on residuals, |
| 29 |
or model convergence information. |
| 30 |
|
| 31 |
Glance never returns information from the original call to the modeling |
| 32 |
function. This includes the name of the modeling function or any |
| 33 |
arguments passed to the modeling function. |
| 34 |
|
| 35 |
Glance does not calculate summary measures. Rather, it farms out these |
| 36 |
computations to appropriate methods and gathers the results together. |
| 37 |
Sometimes a goodness of fit measure will be undefined. In these cases |
| 38 |
the measure will be reported as \code{NA}. |
| 39 |
|
| 40 |
Glance returns the same number of columns regardless of whether the |
| 41 |
model matrix is rank-deficient or not. If so, entries in columns |
| 42 |
that no longer have a well-defined value are filled in with an \code{NA} |
| 43 |
of the appropriate type. |
| 44 |
} |
| 45 |
\examples{ |
| 46 |
\dontshow{if (rlang::is_installed("mclust")) withAutoprint(\{ # examplesIf} |
| 47 |
|
| 48 |
# load library for models and data |
| 49 |
library(mclust) |
| 50 |
|
| 51 |
# load data manipulation libraries |
| 52 |
library(dplyr) |
| 53 |
library(tibble) |
| 54 |
library(purrr) |
| 55 |
library(tidyr) |
| 56 |
|
| 57 |
set.seed(27) |
| 58 |
|
| 59 |
centers <- tibble( |
| 60 |
cluster = factor(1:3), |
| 61 |
# number points in each cluster |
| 62 |
num_points = c(100, 150, 50), |
| 63 |
# x1 coordinate of cluster center |
| 64 |
x1 = c(5, 0, -3), |
| 65 |
# x2 coordinate of cluster center |
| 66 |
x2 = c(-1, 1, -2) |
| 67 |
) |
| 68 |
|
| 69 |
points <- centers |> |
| 70 |
mutate( |
| 71 |
x1 = map2(num_points, x1, rnorm), |
| 72 |
x2 = map2(num_points, x2, rnorm) |
| 73 |
) |> |
| 74 |
select(-num_points, -cluster) |> |
| 75 |
unnest(c(x1, x2)) |
| 76 |
|
| 77 |
# fit model |
| 78 |
m <- Mclust(points) |
| 79 |
|
| 80 |
# summarize model fit with tidiers |
| 81 |
tidy(m) |
| 82 |
augment(m, points) |
| 83 |
glance(m) |
| 84 |
\dontshow{\}) # examplesIf} |
| 85 |
} |
| 86 |
\value{ |
| 87 |
A \code{\link[tibble:tibble]{tibble::tibble()}} with exactly one row and columns: |
| 88 |
\item{BIC}{Bayesian Information Criterion for the model.} |
| 89 |
\item{df}{Degrees of freedom used by the model.} |
| 90 |
\item{logLik}{The log-likelihood of the model. [stats::logLik()] may be a useful reference.} |
| 91 |
\item{nobs}{Number of observations used.} |
| 92 |
\item{model}{A string denoting the model type with optimal BIC} |
| 93 |
\item{G}{Number mixture components in optimal model} |
| 94 |
\item{hypvol}{If the other model contains a noise component, the |
| 95 |
value of the hypervolume parameter. Otherwise `NA`.} |
| 96 |
|
| 97 |
} |