estimate_profiles: Estimate parameters for profiles for a specific solution

Description Usage Arguments Details Value Examples

View source: R/estimate-profiles.R

Description

Estimate parameters for profiles for a specific solution

Usage

1
2
3
4
5
estimate_profiles(df, ..., n_profiles, variances = "equal",
  covariances = "zero", to_return = "tibble", model = NULL,
  center_raw_data = FALSE, scale_raw_data = FALSE,
  return_posterior_probs = TRUE, return_orig_df = FALSE,
  prior_control = FALSE, print_which_stats = "some")

Arguments

df

data.frame with two or more columns with continuous variables

...

unquoted variable names separated by commas

n_profiles

the number of profiles (or mixture components) to be estimated

variances

how the variable variances are estimated; defaults to "equal" (to be constant across profiles); other option is "varying" (to be varying across profiles)

covariances

how the variable covariances are estimated; defaults to "zero" (to not be estimated, i.e. for the covariance matrix to be diagonal); other options are "varying" (to be varying across profiles) and "equal" (to be constant across profiles)

to_return

character string for either "tibble" (or "data.frame") or "mclust" if "tibble" is selected, then data with a column for profiles is returned; if "mclust" is selected, then output of class mclust is returned

model

which model to estimate (DEPRECATED; use variances and covariances instead)

center_raw_data

logical for whether to center (M = 1) the raw data (before clustering); defaults to FALSE

scale_raw_data

logical for whether to scale (SD = 1) the raw data (before clustering); defaults to FALSE

return_posterior_probs

TRUE or FALSE (only applicable if to_return == "tibble"); whether to include posterior probabilities in addition to the posterior profile classification; defaults to TRUE

return_orig_df

TRUE or FALSE (if TRUE, then the entire data.frame is returned; if FALSE, then only the variables used in the model are returned)

prior_control

whether to include a regularizing prior; defaults to false

print_which_stats

if set to "some", prints (as a message) the log-likelihood, BIC, and entropy; if set to "all", prints (as a message) all information criteria and other statistics about the model; if set to any other values, then nothing is printed

Details

Creates profiles (or estimates of the mixture components) for a specific mclust model in terms of the specific number of mixture components and the structure of the residual covariance matrix

Value

a tibble with the data and profile/class assignment and the posterior probability for that profile; the output of this function can be passed to the plot_profiles() function to create a ggplot2 plot of the profiles. If the argument to_return = "mclust" is added to the function call) an mclust model object, which can be inspected or plotted with mclust functions.

Examples

1
2
3
estimate_profiles(iris,
    Sepal.Length, Sepal.Width, Petal.Length, Petal.Width,
    n_profiles = 3)

jrosen48/tidyLPA documentation built on Oct. 13, 2018, 6:54 p.m.