fitSpline | R Documentation |
data.frame
Uses smooth.spline
to fit a spline to all the values of
response
stored in data
.
The amount of smoothing can be controlled by df
.
If df = NULL
, the amount of
smoothing is controlled by the default arguments and those you supply
for smooth.spline
. The method of Huang (2001) for correcting the
fitted spline for estimation bias at the end-points will be applied if
correctBoundaries
is TRUE
.
The derivatives of the fitted spline can also be obtained, and the
Relative Growth Rate (RGR) computed using them, provided
correctBoundaries
is FALSE
. Otherwise, growth rates can be
obtained by difference using splitContGRdiff
.
By default, smooth.spline
will issue an error if there are not
at least four distinct x-values. On the other hand, fitSplines
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
.
fitSpline(data, response, x, df=NULL, smoothing.scale = "identity",
correctBoundaries = FALSE,
deriv=NULL, suffices.deriv=NULL, RGR=NULL, AGR=NULL,
na.x.action="exclude", na.y.action = "exclude", ...)
data |
A |
response |
A |
x |
A |
df |
A |
smoothing.scale |
A |
correctBoundaries |
A |
deriv |
A |
suffices.deriv |
A |
RGR |
A |
AGR |
A |
na.x.action |
A |
na.y.action |
A |
... |
allows for arguments to be passed to |
A data.frame
containing x
and the fitted smooth. The names
of the columns will be the value of x
and the value of response
with .smooth
appended. The number of rows in the data.frame
will be equal to the number of pairs that have neither a missing x
or
response
and it will have the same order of codex as data
.
If deriv
is not NULL
, columns
containing the values of the derivative(s) will be added to the
data.frame
; 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.
Chris Brien
Huang, C. (2001). Boundary corrected cubic smoothing splines. Journal of Statistical Computation and Simulation, 70, 107-121.
splitSplines
, smooth.spline
,
predict.smooth.spline
, splitContGRdiff
data(exampleData)
fit <- fitSpline(longi.dat, response="Area", , x="xDays", df = 4,
deriv=c(1,2), suffices.deriv=c("AGRdv","Acc"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.