

BOD {nls}                                    R Documentation

_B_i_o_c_h_e_m_i_c_a_l _O_x_y_g_e_n _D_e_m_a_n_d

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

     The `BOD' data frame has 6 rows and 2 columns giving
     the biochemical oxygen demand versus time in an evalua-
     tion of water quality.

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

    Time: A numeric vector giving the time of the measure-
          ment (days).

  demand: A numeric vector giving the biochemical oxygen
          demand (mg/l).

_F_o_r_m_a_t_:

     This data frame contains the following columns:

_S_o_u_r_c_e_:

     Bates and Watts (1998), Nonlinear Regression Analysis
     and Its Applications, Wiley, Appendix A1.4.  Originally
     from Marske (1967), M.Sc. Thesis, University of Wiscon-
     sin - Madison.

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

     library(nls)
     data(BOD)
     # simplest form of fitting a first-order model to these data
     fm1 <- nls(demand ~ A*(1-exp(-exp(lrc)*Time)), data = BOD,
        start = c(A = 20, lrc = log(.35)))
     coef(fm1)
     print(fm1)
     # using the plinear algorithm
     fm2 <- nls(demand ~ (1-exp(-exp(lrc)*Time)), data = BOD,
        start = c(lrc = log(.35)), algorithm = "plinear", trace = TRUE)
     # using a self-starting model
     fm3 <- nls(demand ~ SSasympOrig(Time, A, lrc), data = BOD)
     summary( fm3 )

