# How to calculate regression with dummy variables?

17 Ansichten (letzte 30 Tage)
JFz am 17 Jul. 2018
Bearbeitet: the cyclist am 17 Jul. 2018
Hi, I am trying to use 2nd degree polynomial regression with dummy variables. Which function should I use? Thanks for any help!
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

the cyclist am 17 Jul. 2018
Bearbeitet: the cyclist am 17 Jul. 2018
If you have the Statistics and Machine Learning Toolbox, take a look at the fitlm function.
You might also find the dummyvar command useful for creating dummy variables.
Take a look at Regression with Categorical Covariates for an example.
##### 2 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
the cyclist am 17 Jul. 2018
Bearbeitet: the cyclist am 17 Jul. 2018
Do you mean that you have polynomials for your independent variables, like
y = a + b*x + c*x^2
That is a linear model. "Linear" refers to the coefficients, not the powers (or whatever) of the variables.
On the other hand, something like
y = a + x^b
is nonlinear in the coefficient. Yes, you would need fitnlm for something like that.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Find more on Linear Regression in Help Center and File Exchange

R2018a

### Community Treasure Hunt

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

Start Hunting!

Translated by