[R] orthogonal/perpendicular distance from regression line

roger koenker rkoenker at uiuc.edu
Fri Feb 20 20:17:53 CET 2009


For the bivariate case:

g  <- function(b,x,y)
         (abs(y - b[1] - b[2] * x))/sqrt(1 + crossprod(b))

url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    rkoenker at uiuc.edu            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Champaign, IL 61820



On Feb 20, 2009, at 11:12 AM, GAF wrote:

>
> Hi there,
> I am trying to measure orthogonal/perpendicular distances from  
> regression
> lines (i.e. the shortest distance from a given point to my  
> regression line).
> As it sounds rather easy (basically just an orthogonal/perpendicular
> residual) I hoped that there was some function in R that can do  
> that. All
> efforts so far remained unsuccessful, however.
> Does anybody know?
> Thnx and cheers,
> Philipp
> -- 
> View this message in context: http://www.nabble.com/orthogonal-perpendicular-distance-from-regression-line-tp22123179p22123179.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list