added linear model code