profile_plot: Function to produce a profile plot for a LDA model object

Description Usage Arguments Value Examples

View source: R/profile_plot.R

Description

Function to produce a profile plot for a LDA model object

Usage

1
profile_plot(data, num_var, form, model = NULL, maximum_num_class = 7, ...)

Arguments

data

The dataframe to containing the item variables

num_var

The number of the item variables put into the LCA modeling

form

the formula for the LDA modeling

model

the most fit model produced by the function find_best_fit. It is optional, if not provided, the functio will automatically find the most fit by the criterion of BIC.

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. If you want to change the model selecting criterion other than BIC, pleas use find_best_fit function where you could customize the criterion.

...

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 ggplot objects; you could customize the plot on top of the returned ggplot object

Examples

1
2
3
4
5
6
7
# Define a formula for the LDA modeling
f = with(data, cbind(tax, religion, free_election, state_aid, civil_rights, women)~1)
p = profile_plot(data, num_var, f) # This will yield the plot
# If you want to further customize the plot, you could add
more adjustments on top of the plot object. For example:
p + theme(plot.margin=unit(c(1.5,1.5,1.5,1.2),"cm")) +
  labs(title = "The title name that you want")

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