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

Antworten (1)

Peter Perkins
Peter Perkins am 6 Dez. 2012

0 Stimmen

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.

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 6 Dez. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by