Tuesday, March 24, 2015

Matlab Statistic Tool Box regstats model trick

Just found this trick today.
When using:

regstats(y,x)

Matlab will use the linear model y=ax+b model to fit the data and calculate all relevant statistical parameters.

But sometimes we want to fix the trend line through zero, (0,0). In these case, this trick will help:

regstats(y,x,1)

Now Matlab will use the linear model y=ax model to fit the data and calculate all relevant statistical parameters.

Don't know why. But it is tested on R2010b version and confirmed by comparing with Excel calculation results.

No comments:

Post a Comment