home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Educational / R-0.49-MI / R-0.49-I / help / splines / bs < prev    next >
Encoding:
Text File  |  1997-09-13  |  2.2 KB  |  63 lines

  1.     
  2.     _G_e_n_e_r_a_t_e _a _B_a_s_i_s _f_o_r _P_o_l_y_n_o_m_i_a_l _S_p_l_i_n_e_s
  3.     
  4.          bs(x, df, knots, degree=3, intercept=FALSE, Boundary.knots)
  5.     
  6.     _A_r_g_u_m_e_n_t_s:
  7.     
  8.                 x:
  9.          the predictor variable.
  10.     
  11.                df:
  12.          degrees of freedom; one can specify df rather than
  13.          knots; bs() then chooses df-degree-1 knots at suitable
  14.          quantiles of x.
  15.     
  16.             knots:
  17.          the internal breakpoints that define the spline. The
  18.          default is NULL, which results in a basis for ordinary
  19.          polynomial regression. Typical values are the mean or
  20.          median for one knot, quantiles for more knots. See also
  21.          Boundary.knots.
  22.     
  23.            degree:
  24.          degree of the piecewise polynomial---default is 3 for
  25.          cubic splines.
  26.     
  27.         intercept:
  28.          if TRUE, an intercept is included in the basis; default
  29.          is FALSE.
  30.     
  31.     Boundary.knots:
  32.          boundary points at which to anchor the B-spline basis
  33.          (default the range of the data). If both knots and
  34.          Boundary.knots are supplied, the basis parameters do
  35.          not depend on x. Data can extend beyond Boundary.knots
  36.     
  37.          Value:
  38.     
  39.          a matrix of dimension length(x) * df, where either df
  40.          was supplied or if knots were supplied, df =
  41.          length(knots) + 3 + intercept.  Attributes are returned
  42.          that correspond to the arguments to bs, and explicitly
  43.          give the knots, Boundary.knots etc for use by
  44.          predict.bs().  bs() is based on the function
  45.          spline.des() written by Douglas Bates. It generates a
  46.          basis matrix for representing the family of piecewise
  47.          polynomials with the specified interior knots and
  48.          degree, evaluated at the values of x. A primary use is
  49.          in modeling formulas to directly specify a piecewise
  50.          polynomial term in a model. Beware of making predic-
  51.          tions with new x values when df is used as an argument.
  52.          Either use safe.predict.gam(), or else specify knots
  53.          and Boundary.knots.
  54.     
  55.          ns, poly, lo, s, smooth.spline, predict.bs.
  56.     
  57.     _E_x_a_m_p_l_e_s:
  58.     
  59.          lm(y ~ bs(age, 4) + bs(income, 4)) # an additive model
  60.          fit <- lm(y ~ bs(age, knots=c(20,30), B=c(0,100)))
  61.          predict(fit, new.age) #safe predictions because explicit knot sequence was supplied.
  62.     
  63.