splitSplines | R Documentation |
data.frame
Uses fitSpline
to fit a spline to a subset of the values
of response
and stores the fitted values in data
.
The subsets are those values with the same levels combinations
of the factors listed in INDICES
and the degrees of
smoothing is controlled by df
. The derivatives
of the fitted spline can also be obtained, as can the Relative
Growth Rates (RGR).
By default, smooth.spline
will issue an error if there are not
at least four distinct x-values. On the other hand,
fitSpline
issues a warning and sets all smoothed values
and derivatives to NA
. The handling of missing values in the
observations is controlled via na.x.action
and na.y.action
.
splitSplines(data, response, x, INDICES, df = NULL, smoothing.scale = "identity",
correctBoundaries = FALSE,
deriv = NULL, suffices.deriv=NULL, RGR=NULL, AGR=NULL, sep=".",
na.x.action="exclude", na.y.action = "exclude", ...)
data |
A |
response |
A |
x |
A |
INDICES |
A |
df |
A |
smoothing.scale |
A |
correctBoundaries |
A |
deriv |
A |
suffices.deriv |
A |
RGR |
A |
AGR |
A |
sep |
A |
na.x.action |
A |
na.y.action |
A |
... |
allows for arguments to be passed to |
A data.frame
containing data
to which has been
added a column with the fitted smooth, the name of the column being
response
with .smooth
appended to it. If deriv
is
not NULL
, columns containing the values of the derivative(s)
will be added to data
; the name each of these columns will
be the value of response
with .smooth.dvf
appended,
where f
is the order of the derivative, or the value of
response
with .smooth.
and the corresponding
element of suffices.deriv
appended. If RGR
is not
NULL
, the RGR is calculated as the ratio of value of the first
derivative of the fitted spline and the fitted value for the spline.
Any pre-existing smoothed and derivative columns in data
will be
replaced. The ordering of the data.frame
for the x
values will be preserved as far as is possible; the main difficulty
is with the handling of missing values by the function merge
.
Thus, if missing values in x
are retained, they will occur at
the bottom of each subset of INDICES
and the order will be
problematic when there are missing values in y
and
na.y.action
is set to omit
.
Chris Brien
Huang, C. (2001). Boundary corrected cubic smoothing splines. Journal of Statistical Computation and Simulation, 70, 107-121.
fitSpline
, smooth.spline
,
predict.smooth.spline
, splitContGRdiff
, split
data(exampleData)
longi.dat <- splitSplines(longi.dat, response="Area", x="xDays",
INDICES = "Snapshot.ID.Tag",
df = 4, deriv=1, suffices.deriv="AGRdv", RGR="RGRdv")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.