added generic linear regression script
fixed bug with variance calculation