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

Respuestas (1)

Peter Perkins
Peter Perkins el 6 de Dic. de 2012

0 votos

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.

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Preguntada:

el 6 de Dic. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by