Function for reordering the estimated parameters for glca model.

# S3 method for glca
reorder(x, ..., class.order = NULL, cluster.order = NULL, decreasing = TRUE)

Arguments

x

an object of "glca", usually, a result of a call to glca.

...

further arguments passed to or from other methods.

class.order

a integer vector of length equal to number of latent classes of the glca model, assigning the desired order of the latent classes

cluster.order

a integer vector of length equal to number of latent clusters of the glca model, assigning the desired order of the latent clusters

decreasing

logical, when the class.order or cluster.order are not given, whether to rearrange the latent classes (clusters) by decreasing order of the magnitude of the probability of responding the first-category to the first manifest item (prevalence for the first latent class).

Details

Since the latent classes or clusters can be switched according to the initial value of EM algorithm, the order of estimated parameters can be arbitrary.

Examples

lca = glca(item(DEFECT, HLTH, RAPE, POOR, SINGLE, NOMORE) ~ 1,
            data = gss08, nclass = 3, na.rm = TRUE)
#> Manifest items :
#>  DEFECT HLTH RAPE POOR SINGLE NOMORE 
#> 
#> Deleted observation(s) : 
#> 56 observation(s) for missing at least 1 variable 
#> 
#> SET : 1  .....loglik : -591.1231 
#> SET : 2  .....loglik : -591.1231 
#> SET : 3  .....loglik : -591.1239 
#> SET : 4  .....loglik : -591.1231 
#> SET : 5  .....loglik : -591.1231 
#> SET : 6  .....loglik : -593.1768 
#> SET : 7  .....loglik : -591.1231 
#> SET : 8  ....loglik : -591.1231 
#> SET : 9  .....loglik : -591.1306 
#> SET : 10 .....loglik : -591.1231 
#> 
#> Start with SET 10 (-591.1231)
#> 
#> Latent class analysis Fitting...
#> 
#>  50 iteration 
#> 
#> Converged at 50 iteration (loglik :-591.1231)
plot(lca)



# Given ordering number
lca321 = reorder(lca, 3:1)
plot(lca321)



# Descending order
dec_lca = reorder(lca, decreasing = TRUE)
plot(dec_lca)



# Ascending order
inc_lca = reorder(lca, decreasing = FALSE)
plot(inc_lca)