find_best_fit: Find the most fit model by grid search of number of models

Description Usage Arguments Value Examples

View source: R/profile_plot.R

Description

Find the most fit model by grid search of number of models

Usage

1
find_best_fit(data, form, criterion = "bic", maximum_num_class = 7, ...)

Arguments

data

The dataframe to pass in

form

the formula for the LDA modeling

criterion

The criterion to choose the best model, default to BIC. Possible options include "aic","Gsq" and "llike"

maximum_num_class

If you input the data to let the function find out the most fit by the criterion of BIC, what is the maximum number of classes you want it in the search space; Optional, default to 7. If you input a model object in the model parameter, this parameter will be nullified.

...

The wrapper arguments for the poLCA fitting function in the poLCA package. All the arguments passed within here will be passed into the poLCA function.

Value

The model object of the most fit model according to the criterion

Examples

1
2
3
4
5
# Define a formula for the LDA modeling
f = with(data, cbind(tax, religion, free_election, state_aid, civil_rights, women)~1)
# This will yield the best model according to the criterion. The model object could be
# passed into further ploting functions
best_model = find_best_fit(data, form = f, criterion = 'bic')

DavidykZhao/LCA_plotter documentation built on Dec. 11, 2019, 8:38 p.m.