# Problems with Regress Function

2 Ansichten (letzte 30 Tage)
Robert am 5 Nov. 2014
Kommentiert: the cyclist am 5 Nov. 2014
I'm trying to make a linear regression I have a matrix 1439x5. The first column is observed data and the following 4 are predictor variables. my code looks like this
ans = regress(wl(:,1:1),wl(:,2:5))
I am only getting an output of 4 numbers, where there should be 1439. Any ideas?
Thank you in advance for any help
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

the cyclist am 5 Nov. 2014
You say that you have 4 predictor variables. Therefore, you are estimating the coefficients of those 4 predictive terms in the linear regression. You get exactly what I would expect out of the function.
Why do you expect something else? Have you read
doc regress
?
##### 2 KommentareKeine anzeigenKeine ausblenden
Robert am 5 Nov. 2014
Hi, you're too right. For some reason I thought it was going to spit out 1439 predicted values based on the coefficients, but re reading the regress doc made me realise I am wrong. Cheers
the cyclist am 5 Nov. 2014
Glad it worked out. FYI, you can also use fitlm to fit linear regression models. This is the more object-oriented version that MATLAB introduced recently, and has a bunch of methods (such as predict) that can do things like get the predicted values.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Support Vector Machine Regression finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by