cauchy.regression=function(theta,data) { logf=function(y,x) dcauchy(y,location=theta[1]+theta[2]*x, scale=exp(theta[3]),log=TRUE) sum(logf(data$y, data$x)) }