The R Project SVN R

Rev

Rev 69494 | Rev 85254 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 69494 Rev 69510
Line 25... Line 25...
25
    values in \code{x} must be between the \dQuote{inner} knots
25
    values in \code{x} must be between the \dQuote{inner} knots
26
    \code{knots[ord]} and \code{knots[ length(knots) - (ord-1)]}.}
26
    \code{knots[ord]} and \code{knots[ length(knots) - (ord-1)]}.}
27
  \item{ord}{a positive integer giving the order of the spline function.
27
  \item{ord}{a positive integer giving the order of the spline function.
28
    This is the number of coefficients in each piecewise polynomial
28
    This is the number of coefficients in each piecewise polynomial
29
    segment, thus a cubic spline has order 4.  Defaults to 4.}
29
    segment, thus a cubic spline has order 4.  Defaults to 4.}
30
  \item{derivs}{an integer vector of the same length as \code{x} and with
30
  \item{derivs}{an integer vector with values between \code{0} and
31
    values between \code{0} and \code{ord - 1}.  The derivative of the
31
    \code{ord - 1}, conceptually recycled to the length of \code{x}.
32
    given order is evaluated at the \code{x} positions.  Defaults to a
32
    The derivative of the given order is evaluated at the \code{x}
-
 
33
    positions.  Defaults to zero (or a vector of zeroes of the same
33
    vector of zeroes of the same length as \code{x}.}
34
    length as \code{x}).}
34
  \item{outer.ok}{logical indicating if \code{x} should be allowed
35
  \item{outer.ok}{logical indicating if \code{x} should be allowed
35
    outside the \emph{inner} knots, see the \code{x} argument.}
36
    outside the \emph{inner} knots, see the \code{x} argument.}
36
  \item{sparse}{logical indicating if the result should inherit from class
37
  \item{sparse}{logical indicating if the result should inherit from class
37
    \code{"\link[Matrix:sparseMatrix-class]{sparseMatrix}"} (from package \CRANpkg{Matrix}).}
38
    \code{"\link[Matrix:sparseMatrix-class]{sparseMatrix}"} (from package \CRANpkg{Matrix}).}
38
%    \code{\linkS4class{sparseMatrix}} (from package \CRANpkg{Matrix}).}
39
%    \code{\linkS4class{sparseMatrix}} (from package \CRANpkg{Matrix}).}
Line 53... Line 54...
53
}
54
}
54
\author{Douglas Bates and Bill Venables}
55
\author{Douglas Bates and Bill Venables}
55
\examples{
56
\examples{
56
require(graphics)
57
require(graphics)
57
splineDesign(knots = 1:10, x = 4:7)
58
splineDesign(knots = 1:10, x = 4:7)
-
 
59
splineDesign(knots = 1:10, x = 4:7, deriv = 1)
58
## visualize band structure
60
## visualize band structure
59
\donttest{Matrix::drop0(zapsmall(6*splineDesign(knots = 1:40, x = 4:37, sparse = TRUE)))}
61
\donttest{Matrix::drop0(zapsmall(6*splineDesign(knots = 1:40, x = 4:37, sparse = TRUE)))}
60
 
62
 
61
knots <- c(1,1.8,3:5,6.5,7,8.1,9.2,10)  # 10 => 10-4 = 6 Basis splines
63
knots <- c(1,1.8,3:5,6.5,7,8.1,9.2,10)  # 10 => 10-4 = 6 Basis splines
62
x <- seq(min(knots)-1, max(knots)+1, length.out = 501)
64
x <- seq(min(knots)-1, max(knots)+1, length.out = 501)