How can i use categorical predictors into glm

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

답변 (1개)

Peter Perkins
Peter Perkins 2012년 12월 6일

0 개 추천

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.

카테고리

도움말 센터File Exchange에서 Categorical Arrays에 대해 자세히 알아보기

질문:

2012년 12월 6일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by