Skip to content

Commit

Permalink
Updated man page for gsl-bs to reflect predict() and its use
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyRacine committed Apr 3, 2015
1 parent 624ed14 commit 13ee194
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
7 changes: 5 additions & 2 deletions man/gsl-bs.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,17 @@ basis; default is \sQuote{FALSE} }
the examples at the end of this help file)
\preformatted{
B <- gsl.bs(x,degree=10)
}
B.predict <- predict(gsl.bs(x,degree=10),newx=xeval)
}

}

\value{

\code{gsl.bs} returns a \code{gsl.bs} object. A matrix of dimension
\sQuote{c(length(x), degree+nbreak-1)}.
\sQuote{c(length(x), degree+nbreak-1)}. The generic function
\code{\link{predict}} extracts (or generates) predictions from the
returned object.

A primary use is in modelling formulas to directly specify a piecewise
polynomial term in a model. See \url{http://www.gnu.org/software/gsl/}
Expand Down
2 changes: 1 addition & 1 deletion vignettes/crs_faq.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ A BibTeX entry for LaTeX users is
Documentation/Manuals (\url{http://cran.r-project.org/manuals.html})
where you will discover a wealth of documentation for \texttt{R} users
of all levels. See also the \texttt{R} task views summary page
(\url{http://cran.nedmirror.nl/web/views/index.html}) for
(\url{http://cran.r-project.org/web/views}) for
information grouped under field of interest. A few documents that I
mention to my students which are tailored to econometricians include
\url{http://cran.r-project.org/doc/contrib/Verzani-SimpleR.pdf},
Expand Down
13 changes: 11 additions & 2 deletions vignettes/spline_primer.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,20 @@ of $m=n+1$ terms and is given by
where ${n\choose i}=\frac{n!}{(n-i)!i!}$, which can be expressed
recursively as
\begin{equation*}
B(x)=(1-x)\left(\sum_{i=0}^{n-1}\beta_iB_{i,n-1}(x)\right)+x\left(\sum_{i=1}^{n}\beta_iB_{i,n-1}(x)\right),
B(x)=(1-x)\left(\sum_{i=0}^{n-1}\beta_iB_{i,n-1}(x)\right)+x\left(\sum_{i=1}^{n}\beta_iB_{i-1,n-1}(x)\right),
\end{equation*}
so a degree $n$ B\'ezier curve is a linear interpolation between two
degree $n-1$ B\'ezier curves.

%% B_{i,n-1} above changed to B_{i-1,n-1} 20/1/15: "Dear Dr. Racine, I
%% have spotted a small typo in your otherwise excellent Primer on
%% Regression Splines
%% (http://cran.r-project.org/web/packages/crs/vignettes/spline_primer.pdf
%% ): on page 3, in the unnumbered equation below Eq (3) the
%% parameters of the Bernstein polynomial in the second term should be
%% B_{i-1,n-1} I believe (not B_{i,n-1}). Tamas
%% (ferenci.tamas@nik.uni-obuda.hu)"

\begin{example}{A quadratic B\'ezier curve as a linear interpolation
between two linear B\'ezier curves.}

Expand Down Expand Up @@ -210,7 +219,7 @@ coefficients of the regression model.
\begin{example}{The quadratic B\'ezier curve basis functions.}

The figure below presents the bases $B_{i,n}(x)$ underlying a B\'ezier
curve for $i=1,\dots,2$ and $n=2$.
curve for $i=0,\dots,2$ and $n=2$.

\begin{center}
<<fig=TRUE,echo=FALSE>>=
Expand Down

0 comments on commit 13ee194

Please sign in to comment.