Skip to content
Prev 67457 / 398506 Next

R Package: mmlcr and/or flexmix

Greetings 

 

I'm a relatively new R user and I'm trying to build a latent class model.
I've used the 'R Site Search' and it appears there's not much dialogue on
these packages

 

On mmlcr, I've gotten it working, but not sure if I'm using it correctly.

 

On flexmix, I can only seem to get results for one class. 

 

I'm attaching my code below - if anyone is familiar with either of these
packages, I'd really appreciate some assistance or direction.  I'm also
attaching a small sample dataset.

 

Many thanks for your help!

 

Scott Geller

 

 

library(mmlcr)

 

model2 = mmlcr(outer = ~ first_brand_HOLIDAY + perc_zone1 +
perc_Group_nights + perc_num_asian + DaysBetweenStays + CROStays +
DaysSinceLastStay + wghtmean_median_age_pop100 + perc_num_white +
perc_num_hispanic + perc_CROStays + numMonthsActive + WEBStays +
property_loyalty + perc_NoZone + ltgold1 + ltgold3  + rho + p_hat_PCR|
gst_id, components = list(list(formula = nts ~ PCR_Dummy_class, class =
"poislong")),data=Dataset, n.groups = 5, max.iter = 5000)

 

 

libray(flexmix)

 

m1<-flexmix(nts ~ first_brand_HOLIDAY+ perc_zone1+ perc_Group_nights+
perc_num_asian+  DaysBetweenStays+ CROStays+ DaysSinceLastStay+
wghtmean_median_age_pop100+ perc_num_white+ perc_num_hispanic+
perc_CROStays+ numMonthsActive+ WEBStays+ property_loyalty+ perc_NoZone+
rho+ PCR_Dummy_class+ ltgold1+ ltgold3+ p_hat_PCR, data = data, k = 2, model
= FLXglm(family = "poisson"))

 

rm1<-refit(m1)

summary(rm1)

 

 

 

Scott Geller

Advanced Analytics,

Decision Sciences Department,

InterContinental Hotels Group

 

770-604-5149