Documentation

# regression

Linear regression

## Syntax

```[r,m,b] = regression(t,y) [r,m,b] = regression(t,y,'one') ```

## Description

`[r,m,b] = regression(t,y)` takes these arguments,

 `t` Target matrix or cell array data with a total of `N` matrix rows `y` Output matrix or cell array data of the same size

and returns these outputs,

 `r` Regression values for each of the `N` matrix rows `m` Slope of regression fit for each of the `N` matrix rows `b` Offset of regression fit for each of the `N` matrix rows

`[r,m,b] = regression(t,y,'one')` combines all matrix rows before regressing, and returns single scalar regression, slope, and offset values.

## Examples

### Fit Regression Model and Plot Fitted Values versus Targets

Train a feedforward network, then calculate and plot the regression between its targets and outputs.

```[x,t] = simplefit_dataset; net = feedforwardnet(20); net = train(net,x,t); y = net(x); [r,m,b] = regression(t,y)```
```r = 1.0000 ```
```m = 1.0000 ```
```b = 1.0878e-04 ```
`plotregression(t,y)` 