View source: R/mixture-regression-methods.R
| get_results.latents_mixture_regression | R Documentation |
Tables of a mixture-of-regressions fit
## S3 method for class 'latents_mixture_regression'
get_results(
x,
what = "coefficients",
level = 0.95,
vcov_type = NULL,
data = NULL,
truth = NULL,
by = c("class", "group_class"),
...
)
## S3 method for class 'latents_mixture_regression'
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
what = "coefficients",
level = 0.95,
vcov_type = NULL,
...
)
## S3 method for class 'latents_mixture_regression'
coef(object, ...)
## S3 method for class 'latents_mixture_regression'
vcov(object, type = NULL, ...)
## S3 method for class 'latents_mixture_regression'
confint(object, parm, level = 0.95, ...)
## S3 method for class 'latents_mixture_regression'
logLik(object, ...)
## S3 method for class 'latents_mixture_regression'
nobs(object, ...)
x |
A fit from |
what |
The table to return; see Tables. |
level |
Confidence level for the intervals. |
vcov_type |
|
data, truth |
For |
by |
For |
... |
Unused. |
row.names, optional |
Unused; part of the generic. |
object |
A fit from |
type |
Covariance type for |
parm |
Parameter names or positions; all by default. |
A base data.frame as described under Tables, or a named list
of them for what = "all".
coefficientsOne row per class and regression term: class
("common" for a shared term), term, estimate, std_error,
statistic (Wald z), p_value, conf_low, conf_high,
p_adjusted (Benjamini-Hochberg across the non-intercept rows;
NA for intercepts) and, for the binomial and Poisson families,
exp_estimate (odds or rate ratio). For the ordinal family each
class's thresholds lead its rows as terms "threshold:<lower>|<upper>"
(delta-method errors; no p_adjusted or exp_estimate), and
exp_estimate of a slope is the cumulative odds ratio of a higher
category.
classesOne row per class: share (mean posterior), count
(summed posterior), n_assigned (modal assignment), mean_posterior
(average posterior of the units assigned to it); sigma and
sigma_std_error for the Gaussian family; prior and
prior_std_error when membership has no covariates. Units are groups
under class_level = "group".
membershipOne row per multinomial-logit coefficient: model
("class" or "group_class"), class, term, reference, the Wald
columns and odds_ratio. In the two-level model the class intercepts
are per group class, (Intercept):group_class_h.
group_classesTwo-level model: one row per group class and
class, with the model-implied class probability, the group_share,
n_groups_assigned, and std_error of the probability when
membership has no covariates.
fitOne row: log likelihood, parameter count, aic, bic
(penalized by the number of independent units: rows, or groups when
id defines them), bic_rows (always by rows, as flexmix reports it),
sabic, icl, relative entropy (and group_entropy), the smallest
class share, convergence and start replication.
assignmentsOne row per data row used: row (its position in
the supplied data), the id column, modal class, its posterior,
and one probability_class_k column per class; two-level fits add
group_class and group_posterior.
groupsOne row per group (class_level = "group" or the
two-level model): its size, modal class or group class, and
posterior probabilities.
fittedOne row per data row: observed, the posterior-weighted
fitted mean, fitted_modal (the modal class's mean), residual
and class.
startsOne row per start: its log likelihood, convergence,
iterations, stage ("screened": stopped after the 50-iteration
screening because better starts existed; "completed": run to
convergence or max_iter), whether it degenerated, and which one was
selected. n_best_replicated counts completed starts only.
classificationOne row per assigned (modal) class and class:
the mean_posterior probability of class among the units assigned to
assigned, and n_assigned. Its diagonal is each class's average
posterior probability; values near one mean well-separated classes.
recoveryNeeds data and truth: the modal classes
cross-tabulated against a known classification, one row per assigned
class and true value, with the count n and its share of the
assigned class. Group-level under class_level = "group" or
by = "group_class", where truth must be constant within groups.
fit <- mixture_regression(score ~ hours, data = study_hours, n_classes = 2,
n_starts = 3, seed = 1)
get_results(fit, "coefficients")
get_results(fit, "fit")
get_results(fit, "coefficients", vcov_type = "robust")
get_results(fit, "recovery", data = study_hours, truth = "strategy")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.