This project has moved and is read-only. For the latest updates, please go here.

Is it possible to run a linear regression using MultivariateSample and exclude the intercept?

Feb 24, 2011 at 8:04 PM

Thanks for the great library. I'd like to run a multivariate linear regression using MultivariateSample.LinearRegression().  Is it possible to fix the alpha parameter at 0?  Thanks.

Feb 27, 2011 at 9:39 PM

I'm afraid there isn't a simple way to do this. If you just have one independent variable, you can put your data into a DataSet and use the DataSet.FitToProportionality method. But if your data really are multivariate, that isn't an option.

Probably the best way for us to deal with this would be to add a method to MultivariateSample that does regression to an arbitrary, user-supplied function. We will look into this for a future version.

By the way, statisticians are generally wary of proportional regression because it can display some perverse behaviors. For example, if the fit is poor, it can acutally occur that the post-regression variance is larger that the pre-regression variance, i.e. you have "negative r-squared". In most circumstances, a statistician would advise you to do a linear fit and consider the intercept to be a calibration of your measurement device. If you have a large number of data points and that do follow a proportionality rule, then fitting to a linear function instead of a proportionality should make little difference: the intercept value will be zero within uncertainty, your P-value will remain significant, and the value of the slope won't change within uncertainty.