qspliner {mosaicCalc} | R Documentation |
Create a quadratic spline (inefficiently)
Description
A handmade function to construct quadratic splines.
Usage
qspliner(tilde, data, free = 0)
Arguments
tilde |
A tilde expression of the form |
data |
A data frame containing the variables in |
free |
A number specifying the slope of the output function at the last knot. Default is 0: that is, flat. |
Details
Unless you have a good reason otherwise, you should be using spliner()
,
which generates cubic splines,
rather than qspliner()
. qspliner()
is intended only for demonstration purposes.
Value
a function suitable for, for instance, graphing or optimizing
Examples
Pts <- tibble(x = seq(-4,4, by=.7), y = dnorm(x))
f <- qspliner(y ~ x, data = Pts)
slice_plot(dnorm(x) ~ x, domain(x=-4:4)) %>%
slice_plot(f(x) ~ x, color= "blue") %>%
gf_point(y ~ x, data = Pts, color = "orange", size=4, alpha=0.3) %>%
gf_lims(y= c(NA,.5))
[Package mosaicCalc version 0.6.4 Index]