

Lanczos2(NISTnls)                            R Documentation

_G_e_n_e_r_a_t_e_d _d_a_t_a

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

     The `Lanczos2' data frame has 24 rows and 2 columns of
     generated data.

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

       y: A numeric vector of generated responses.

       x: A numeric vector of generated input values.

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

     This data frame contains the following columns:

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

     These data are taken from an example discussed in Lanc-
     zos (1956).  The data were generated to 6-digits of
     accuracy using `f(x) = 0.0951*exp(-x) +
     0.8607*exp(-3*x) + 1.5576*exp(-5*x)'.

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

     Lanczos, C. (1956).  Applied Analysis.  Englewood
     Cliffs, NJ:  Prentice Hall, pp. 272-280.

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

     library(NISTnls)
     data(Lanczos2)
     plot(y ~ x, data = Lanczos2)
     ## plot log response to see the number of exponential terms
     plot(y ~ x, data = Lanczos2, log = "y")
     ## Numerical derivatives do not produce sufficient accuracy to converge
     fm1 <- nls(y ~ b1*exp(-b2*x) + b3*exp(-b4*x) + b5*exp(-b6*x),
                data = Lanczos2, trace = TRUE,
                start = c(b1 = 1.2, b2 = 0.3, b3 = 5.6, b4 = 5.5,
                          b5 = 6.5, b6 = 7.6), warnOnly = TRUE)
     fm2 <- nls(y ~ b1*exp(-b2*x) + b3*exp(-b4*x) + b5*exp(-b6*x),
                data = Lanczos2, trace = TRUE,
                start = c(b1 = 0.5, b2 = 0.7, b3 = 3.6, b4 = 4.2,
                          b5 = 4, b6 = 6.3), warnOnly = TRUE)
     fm3 <- nls(y ~ exp(outer(x,-c(b2, b4, b6))),
                data = Lanczos2, trace = TRUE, algorithm = "plinear",
                start = c(b2 = 0.3, b4 = 5.5, b6 = 7.6),
                warnOnly = TRUE)
     fm4 <- nls(y ~ exp(outer(x,-c(b2, b4, b6))),
                data = Lanczos2, trace = TRUE, algorithm = "plinear",
                start = c(b2 = 0.7, b4 = 4.2, b6 = 6.3),
                warnOnly = TRUE)
     ## Use analytic derivatives
     Lanczos <- deriv(~ b1*exp(-b2*x) + b3*exp(-b4*x) + b5*exp(-b6*x),
                      paste("b", 1:6, sep = ""),
                      function(x, b1, b2, b3, b4, b5, b6){})
     fm5 <- nls(y ~ Lanczos(x, b1, b2, b3, b4, b5, b6),
                data = Lanczos2, trace = TRUE,
                start = c(b1 = 1.2, b2 = 0.3, b3 = 5.6, b4 = 5.5,
                          b5 = 6.5, b6 = 7.6), warnOnly = TRUE)
     fm6 <- nls(y ~ Lanczos(x, b1, b2, b3, b4, b5, b6),
                data = Lanczos2, trace = TRUE,
                start = c(b1 = 0.5, b2 = 0.7, b3 = 3.6, b4 = 4.2,
                          b5 = 4, b6 = 6.3), warnOnly = TRUE)

