Resistant line or Tukey line

Most elements explained here applied to regression-type functions; please read it as an introduction to these functions.

line() produces a Tukey line>


When you execute this command line, you will see this output that contains the regression coefficients.

line(x, y)

[1]  60.5868  -0.1157

You can also store the object:

resline =  line(urb,infmor)

an then examine this object with str(resline) to display:

List of 4
 $ call         : language line(x, y)
 $ coefficients : num [1:2] 60.587 -0.116
 $ residuals    : num [1:183] -42.47  -2.36 -24.24 -12.12  29.99 ...
 $ fitted.values: num [1:183] 60.5 60.4 60.2 60.1 60.0 ...
 - attr(*, "class")= chr "tukeyline"

The function creates an object of type "tukeyline" which is a regression type object; a series of functions let you extract this information from it for their specific purpose.

The same information can also be retrieved using resline$coefficients, resline$residuals or resline$fitted.

You can use this directly in various functions, e.g.

Note that you can also write: plot(line(urb~infmor)$residuals))

See also