added freq to ols; converted k.gas in passing to optim()