Latent Class Regression Tool
Estimate segment-level regression models using the flexmix package
Disclaimer
- Results may contain errors. The output from this tool may be inaccurate, incomplete, or incorrect. Users should independently verify all results before relying on them.
- No warranty. This tool is provided "as is" without any warranty of any kind.
- User assumes all risk. Users assume full and complete responsibility for reviewing, validating, and determining suitability of any output.
Requirements
- R - Statistical programming language (Download R)
- RStudio - IDE for R (Download RStudio)
Setup Instructions
1
Install R and RStudio
If you don't have R and RStudio installed, download and install them from the links above. Install R first, then RStudio.
2
Download and Open the App
Download the app file and open it in RStudio:
In RStudio: File → Open File → Select the downloaded
Latent_Class_Regression.R
3
Run the App
With
Latent_Class_Regression.R open in RStudio, click the "Run App" button in the top-right corner of the editor panel. The app will open in a new window or your web browser.
Note: On first run, the app will automatically install the required R packages (
shiny and flexmix). This may take a minute.
Tip: To open in fullscreen/external browser, click the "Open in Browser" button in the app window, or use the dropdown next to "Run App" and select "Run External".
Features
CSV Data Upload
Upload your dataset in CSV format
Three Model Types
Linear, Poisson, or Binary Logistic regression
Segment Selection
Specify the number of latent segments (1-10)
Consumer/HH ID Grouping
Cluster observations by Consumer or Household ID
Segment Estimates
View coefficients, std. errors, and p-values for each segment
Model Fit Statistics
AIC, BIC, and segment sizes (prior probabilities)
Troubleshooting
App doesn't open
Make sure you have the
Latent_Class_Regression.R file open in RStudio's editor (not just in the file browser), then click "Run App".
Package installation fails
Try running these commands manually in the Console:
install.packages("shiny")
install.packages("flexmix")
Model fails to converge
Try reducing the number of segments, or check that your data has enough variation. The flexmix algorithm may need more observations per segment.
"Run App" button not visible
Make sure the file is saved with a
.R extension. RStudio only shows the "Run App" button for R files that contain Shiny code.