qspliner | R Documentation |
A handmade function to construct quadratic splines.
qspliner(tilde, data, free = 0)
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. |
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.
a function suitable for, for instance, graphing or optimizing
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.