coplot
) and controls their number and the amount of overlap
between intervals.
co.intervals(x, number = 6, overlap = 0.5)
2
columns and
number
rows. The left column contains
the values of the left end points of the intervals, and the right
collumn contains the corresponding right end points.
The rows of the result, which are used as conditioning intervals
in
coplot
, describe the endpoints of intervals that have the following
properties:
(1) the first interval has
min(x)
as
its left endpoint and the last interval has
max(x)
as its right endpoint.
(2) All other endpoints are values in
x
.
(3) The numbers of values of
x
in the intervals
are as nearly equal as possible.
(4) For two successive intervals, the fraction of points shared by the
intervals is as close to
overlap
as possible.
E.intervals <- co.intervals(ethanol$E, 9, 0.25) E.intervals # produces the following output: [,1] [,2] [1,] 0.535 0.686 [2,] 0.655 0.761 [3,] 0.733 0.811 [4,] 0.808 0.899 [5,] 0.892 1.002 [6,] 0.990 1.045 [7,] 1.042 1.125 [8,] 1.115 1.189 [9,] 1.175 1.232 # plot results coplot(NOx ~ C | E, given.values = E.intervals, data = ethanol, panel = function(x,y) panel.smooth(x, y, span = 1, degree = 1))