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'. 

_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")

