How can i use categorical predictors into glm
4 views (last 30 days)
Show older comments
Hey everyone,
I'm trying to use GeneralizedLinearModel. My dataset is composed of categorical data and quantitative data (the response variable is quantitative). How can I pass to my model the categorical data? When i was using R i could type 'factor()' command, but matlab I cannot find the same one.
Thank you very much Andrea
0 Comments
Answers (1)
Peter Perkins
on 6 Dec 2012
Andrea, if you have a dataset array containing your data, GeneralizedLinearModel.fit will automatically recognize any predictor variables that are categorical and do the right thing. By categorical, I mean that you have already converted the predictor to be nominal or ordinal. There's an example of using categorical predictors in the LinearModel documentation, it's the exact same idea for GeneralizedLinearModel.
Hope this helps.
0 Comments
See Also
Categories
Find more on Categorical Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!