General linear model implementation