---
title: "Benchmarking mclust and MPlus"
author: "Vignette Author"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Benchmarking mclust and MPlus}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

## Purpose

The purpose of this vignette is to facilitate benchmarking the output from the use of two packages, MPlus (via the MplusAutomation package) and mclust (via the mclust package). As CRAN does not allow for MPlus to be used, this vignette is not rendered, but can be rendered on your own computer as long as you have MPlus (and MplusAutomation) installed. Please note that _MPlus must be installed on your computer for this vignette to run_.

```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>", 
  eval = FALSE
)
```

# Using mclust

## Just one fit

```{r}
library(tidyLPA)
library(dplyr)

iris %>% 
  select(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width) %>% 
  estimate_profiles(n_profiles = 2) %>% 
  get_fit() %>% 
  as.data.frame()
```

# Using MPlus

## Just one fit

```{r}
iris %>% 
  select(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width) %>% 
  estimate_profiles(n_profiles = 2, package = "mplus") %>% 
  get_fit() %>% 
  as.data.frame()
```

# Using mclust

## Many fits

```{r}
library(tidyLPA)
library(dplyr)

iris %>% 
  select(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width) %>% 
  estimate_profiles(n_profiles = 2:4, models = c(1, 2, 3, 6)) %>% 
  get_fit() %>% 
  as.data.frame()
```

# Using MPlus

##  Many fits

```{r}
iris %>% 
  select(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width) %>% 
  estimate_profiles(n_profiles = 2:4, models = c(1, 2, 3, 6),
                    package = "mplus") %>% 
  get_fit() %>% 
  as.data.frame()
```
