isoreg                 package:stats                 R Documentation

_I_s_o_t_o_n_i_c / _M_o_n_o_t_o_n_e _R_e_g_r_e_s_s_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Compute the isotonic (monotonely increasing nonparametric) least
     squares regression which is piecewise constant.

_U_s_a_g_e:

     isoreg(x, y = NULL)

_A_r_g_u_m_e_n_t_s:

    x, y: in 'isoreg', coordinate vectors of the regression points. 
          Alternatively a single "plotting" structure can be specified:
          see 'xy.coords'. 

     ...: potentially further arguments passed to methods.

_D_e_t_a_i_l_s:

     The algorithm determines the convex minorant m(x) of the
     _cumulative_ data (i.e., 'cumsum(y)') which is piecewise linear
     and the result is m'(x), a step function with level changes at
     locations where the convex m(x) touches the cumulative data
     polygon and changes slope.
      'as.stepfun()' returns a 'stepfun' object which can be more
     parsimonious.

_V_a_l_u_e:

     'isoreg()' returns an object of class 'isoreg' which is basically
     a list with components 

       x: original (constructed) abscissa values 'x'.

       y: corresponding y values.

      yf: fitted values corresponding to _ordered_ x values.

      yc: cumulative y values corresponding to _ordered_ x values.

  iKnots: integer vector giving indices where the fitted curve jumps,
          i.e., where the convex minorant has kinks.

   isOrd: logical indicating if original x values were ordered
          increasingly already.

     ord: 'if(!isOrd)': integer permutation 'order(x)' of _original_
          'x'.

    call: the 'call' to 'isoreg()' used.

_N_o_t_e:

     The code should be improved to accept _weights_ additionally and
     solve the corresponding weighted least squares problem.
      "Patches are welcome!"

_R_e_f_e_r_e_n_c_e_s:

     Barlow, R. E., Bartholomew, D. J., Bremner, J. M., and Brunk, H.
     D. (1972) _Statistical inference under order restrictions_; Wiley,
     London.

     Robertson, T., Wright,F. T. and Dykstra, R. L. (1988) _Order
     Restricted Statistical Inference_; Wiley, New York.

_S_e_e _A_l_s_o:

     the plotting method 'plot.isoreg' with more examples; 'isoMDS()'
     from the 'MASS' package internally uses isotonic regression.

_E_x_a_m_p_l_e_s:

     (ir <- isoreg(c(1,0,4,3,3,5,4,2,0)))
     plot(ir, plot.type = "row")

     (ir3 <- isoreg(y3 <- c(1,0,4,3,3,5,4,2, 3)))# last "3", not "0"
     (fi3 <- as.stepfun(ir3))
     (ir4 <- isoreg(1:10, y4 <- c(5, 9, 1:2, 5:8, 3, 8)))
     cat("R^2 =", formatC(sum(residuals(ir4)^2) / (9*var(y4)), dig=2),"\n")

