Interpreting cubic spline coefficients. The actual numerical output is a very complicated scaled, derived representation of these values. spline and e. Here is a working example. For B- and TPF splines, you can use the DEGREE= option to specify the Regression splines involve dividing the range of a feature X into K distinct regions (by using so called knots). knots <- c(550, 625) mkSpline <- function(k, x) (x - k > 0) * (x Sep 29, 2009 · Interpreting Cubic Spline Coefficients for spline (theta, R) danago. There are three spline bases available in the EFFECT statement: the B-spline (BASIS=BSPLINE, the default), the truncated power function (BASIS=TPF), and the natural cubic spline (NATURALCUBIC). ns generates orthogonal (uncorrelated) terms that are harder to interpret whereas rcs uses the truncated power basis which is easy to represent in an equation. This approach has gained more favor from Bayesians, but is not the approach taken in SAS PROC GAM. a list of coefficient vectors See Also. So, for 10 data points, there should be 4* (10-1)=36 coefficients. Oct 7, 2014 · By default degrees of bivariate spline is 3. Dec 5, 2019 · Step 2: Solve for the Unknowns. Or indeed use СubicSpline which works in the power basis. Homepage: I'm currently using cubic-spline interpolation via the Curve Fitting Toolbox to obtain a piecewise polynomial to a set of data points. Various boundary conditions can be requested using the optional bc_type argument of make_interp_spline. , for RGB color data). Cubic splines are given special emphasis. Restricted cubic spline are an easy way of including an explanatory variable in a smooth non-linear way in a wide variety of models. Thus, the cubic spline has second order or C 2 continuity Feb 18, 2015 · With five values in each of X and Y, I ended up with coefs also having five values. proc logistic data=EVENTS0; effect spl = spline (PRALBUM / details naturalcubic basis=tpf (noint) k=1 are B-spline basis functions, or sines/cosines, etc. mesage; curves for routine is not able to deal with Multiple knots. In the following we consider approximating between any two consecutive points and by a linear, quadratic, and cubic polynomial (of first, second, and third degree). Linear spline: with two parameters and can only satisfy the following two equations required for to be continuous: Jun 17, 2017 · Cubic spline interpolation is the process of constructing a spline f: [ x 1, x n + 1] → R which consists of n polynomials of degree three, referred to as f 1 to f n. Then. 6 Using glance with a logistic regression model Coefficients of the polynomials on each segment. I'm fitting a natural basis spline on a data set of the form: splineModel=lm(dist~bs(speed, df=3), data=cars) using bs function of spline package. 3). Problem 1. You will now see your 3 regression constants: y = -0. Given an interval [a,b], a function f: [a,b] → R, and a set of nodes ~x = (x0,x1,,xN). Frank Harrell explains the details in Section 2. However, what is the reference group (i. s = spline(x,y,xq) returns a vector of interpolated values s corresponding to the query points in xq. or in more minimalistic manner: (1) Interpolant (2) y at x=1. Given spl = make_interp_spline(), the spl is a BSpline object which has spl. Mar 6, 2019 · Cubic splines are created by using a cubic polynomial in an interval between two successive knots. Feb 9, 2024 · S ( x) = 1 1 ( x) + 2 2 ( x) + ⋯ + ( x). Primarily what it’s demanding is — Find an interpolant for the segment that contains x = 1. $\begingroup$ There are different basis function representations for splines. 5. x = np. We will focus on restricted cubic splines, which are also known as natural splines . 2). There are many types of splines and many options for their fitting [14–17]. In practice, three, four, or five knots are often used. spline for further details. Nov 11, 2023 · The algorithm given in Spline interpolation is also a method by solving the system of equations to obtain the cubic function in the symmetrical form. Interpolate data with a piecewise cubic polynomial which is twice continuously differentiable . interpolate import UnivariateSpline. I have read various papers and the one that analysed the data the closest to what I need to do, found outliers first, and then fit a nonparametric cubic spline regression model for each cow Aug 31, 2020 · 1. • Clamped spline. 4/30 a knots of a B-spline of degree-1 is where it bends; B-splines of degree-1 are compact, and are only non-zero over (no more than) three adjacent knots. 5, and k 3 = 8. They establish a relationship between the known data points and adjustrcspline graphs the adjusted predictions. It may be easier to see how this is actually working in action. Within each region, a polynomial function (also called a Basis Spline or B-splines) is fit to the data. Since we want to evaluate the velocity at t = 16 and use linear spline interpolation, we need to choose the two data points closest to t = 16 that also bracket t = 16 to evaluate it. The OUTPUT statement computes predicted values. 864151123x + -591. width, height, and depth describe the extent of the data in pixels/voxels. The result is an intuitive parametrization whose elements are easy to interpret and relate naturally to the spline function — in particular, priors are easier to elicit. Jun 26, 2017 · One more question for the output of the cubic spline mixed effects model with knots basline (0 months), 6 months (initial phase), 12 months (bmi regain) and 36 months (linear constant/increase phase) after surgery to take into account the course of the bmi of the data: Mathematically spline is a piecewise polynomial of degree k with continuity of derivatives of order k-1 at the common joints between the segments. Therefore the returned c0[], c1[], c2[] and c3[] arrays all have size n-1. Since these are just piecewise polynomials I'd subsequently like to integrate the interpolation function algebraically. We shall illustrate a simple way to do this. What Matlab's spline gives you appears to be the partial polynomial coefficients describing the cubic equations connecting the points you pass in, which leads me to believe that the Matlab spline is a control-point based spline Aug 18, 2022 · 3-knot restricted cubic spline regression. This section provides an example of using splines in PROC GLMSELECT to fit a GLM regression model. See the end of that Section of the notes. Given that five data points implies four spline sections, and that a cubic polynomial has four coefficients, I would have expected to get four times four= 16 coefficients. Once polynomial coefficients are found, a secondary function can be called which outputs spline interpolated values for given inputs. B-spline of degree 1 is a linear combination of B-spline of However, a restricted cubic spline may be a better choice than a linear spline when working with a very curved function. c the coefficients --- in the b-spline basis. Keywords: st0215, xblc, cubic spline, modeling strategies, logistic regression 1 Introduction . c[3, 0] May 7, 2021 · If you fit with a restricted cubic spline, you get a set of associated coefficients, with the first being for the linear term and the rest being the coefficients of the non-linear terms. – Francesco. They are penalized by the conventional intergrated square second derivative cubic spline penalty. Feb 2, 2022 · Cubic splines are a method to represent nonlinear relationships using a set of cubic polynomials, each over a different domain, to represent a continuous variable. c of the following size (4, <length of t> + 2*(k+1)-1) corresponding to the consecutive intervals along the curve ( k+1 knots are added at either end of the curve by splrep ). In the mathematical field of numerical analysis, spline interpolation is a form of interpolation where the interpolant is a special type of piecewise polynomial called a spline. meaning there are 4 coefficients that need to be specified for every 2 points. 1 Interpreting the Coefficients of a Logistic Regression Model; 10. That is, instead of fitting a single, high-degree polynomial to all of the values at once, spline interpolation fits low-degree polynomials to Below we plot the cubic spline next to the natural cubic spline for comparison. For n data points, the unknowns are the coefficients ai,bi,ci,di of the I'm new to using restricted cubic splines and I was wondering if anyone can shed some light on it. To compute the coefficients of our splines, we first define the strictly diagonally dominant matrix “A” and then apply the Jacobi Method to solve for c (a) The natural spline: S 0(a) = 0 = S N−1 (b), (b) The clamped cubic spline: S 0 0 (a) = f (a) and S0 N−1 (b) = f 0(b). I would like to know whether is possible to print the actual spline equations fitted (the tracing) within each knot. We're skipping to cubic interpolants because you'll develop quadratic splines in HW5 . For example, if y is 1-d, then c[k, i] is a coefficient for (x-x[i])**(3-k) on the segment between x[i] and x[i+1]. Proof of lemma. splines. Spline (mathematics) Single knots at 1/3 and 2/3 establish a spline of three cubic polynomials meeting with C2 parametric continuity. Software library for the calculation of multidimensional cubic splines. See full list on towardsdatascience. , how can I find the "limit values" of that portion of the spline)? How can trasnform "xi", "xi'" and "xi''" in range of the predictor? The simplest conditions follow from the assumption that the concavity is zero at the ends. 5 using Natural Cubic Spline that would interpolate all the data points given and know its corresponding y-coordinate. Sep 29, 2009. PROC GAM makes use of cubic smoothing splines. In case you are surprised, let's try a even Cubic spline data interpolator. Since we are dealing with interpolating splines, constraints are imposed to guarantee that the spline actually passes through the given data points. The values of s are determined by cubic spline interpolation of x and y. For cubic splines with (k+1)-regular knot arrays this means two boundary conditions—or removing two values from the x array. The trailing dimensions match the dimensions of y, excluding axis. Alone they are not interpretable. In numerical analysis, a cubic Hermite spline or cubic Hermite interpolator is a spline where each piece is a third-degree polynomial specified in Hermite form, that is, by its values and first derivatives at the end points of the corresponding domain interval. Apr 22, 2015 · Among the different spline functions present in R, I have not found one where I can: i) fit the spline while deciding how many knots and where along the x-axis; ii) obtaining the equation of the fitted spline; iii) obtain the derivative of the fitted function and iv) possibly having a statistics the goodness of fit of the spline. A spline is a smoothed curve included in a regression model. This technique offers several advantages over other techniques. What scipy. import numpy as np. When i am fitting my data, if the degree is 3, i should get 16 coefficients and 8 knot points in x and y direction respectively. I can’t seem to find much documentation on the output so I am not sure how to interpret! I am using 5 knots (percentile list). Using this wiki page, I was already able to evaluate various points correctly with the result of. 3531443. The first order derivative of the splines at the end points are set to known values. 4 Interpreting the rest of the model output from glm; 10. 10. If you really need the coefficients in the power basis, you can evaluate the derivatives of use PPoly. 5 Deviance and Comparing Our Model to the Null Model; 10. t1 = 20, v(t1) = 517. The function will return a list of four vectors representing the coefficients. Apr 19, 2014 · At the same time, I collected data on various variables like milk volume, fat and protein % of the milk, weight of each cow, etc. A spline is a function defined by piecewise polynomials. Hence, first, we construct S” (x) then integrate it twice to obtain S (x). Sharma, PhD Back to our original problem Calculate the natural cubic spline interpolating the data: x 0 1 2 2. bs="cr". Let u(x) be a cubic polynomial on [0,1], and let u(0) = a, u(1) = b, u00(0) = A, and u00(1) = B. The function s() has similarities to the smooth. Condition 1 gives 2N relations. linspace(0, 10, 20) 4. from_spline(spl). (iii)Generate the cubic spline interpolation that can be used to interpret the given data. I'm not sure there is any way to get exactly those coefficients from scipy. The problem I have in understanding the output probably has more to to with restricted-cubic-splines generally than with the fact that I'm using them in quantile regression. t0 = 15, v(t0) = 362. Conditions 2, 3 and 4 each gives N − 1 relations. E(yjx) = 0 + K X 1x +. So in your example, the coefficients for the first segment [x 1, x 2] would be in column 0: y 1 would be s. ) g (. The clamped cubic spline gives more accurate approximation to the function f(x), but requires knowledge of the derivative at the endpoints. 3. Oct 5, 2023 · Solution. 125 0 Using (1){(5), we can construct the following cubic spline: Figure :Satis es the three conditions! As we noted before, a GAM is a GLM whose linear predictor includes a sum of smooth functions of covariates. Fitting the Cox PH model requires using the basis function transformations of the exposure variables as the covariates in the model (and introduces regression coefficients b j ), cubicspline finds a piecewise cubic spline function that interpolates the data points. But I cannot find anything that tells me the coefficients of Jun 2, 2012 · In order to do that you need to: select the cell that contains your formula: extend the selection the left 2 spaces (you need the select to be at least 3 cells wide): press F2. The end conditions for cubic spline interpolation with equidistant knots will be defined so as to make the (slightly modified) B-spline coefficients minimal. The Jun 16, 2023 · The way that rcs() implements the splines, the coefficients are represented as a linear coefficient plus extra terms for the non-linearities. These constraints are described in Section 2. Sep 20, 2017 · Linear spline (a) and cubic spline (b) basis functions using knots at quartiles of the case exposures (k 1 = 3. When using a restricted cubic spline, one obtains a continuous smooth function that is linear before the first knot, a piecewise cubic polynomial between adjacent knots, and linear again after the last knot. import scipy. Dec 21, 2011 · The purpose of this paper is to review the fundamentals of interpolating cubic splines. Does anyone know how to interpret the values that are returned by the get_coeffs method? Is there any place where this is documented? Feb 25, 2024 · The calculator will provide you with the coefficients of the cubic polynomials, the equations for each segment, and the final spline curve that you can visualize graphically. Regression with restricted cubic splines in SAS. Not related to your question: Computing cubic splines is much easier if you express each segment in Hermite form, rather than algebraic form. Spline Interpolation Natasha S. I'm just confused on what the output means in terms of the coefficients and if there is a way to create the polynomial equations between each pair of knots. Parameters: x array_like, shape (n,) 1-D array containing values of the independent variable. I want to be able to create the piece-wise polynomial set over the set of knots. The overall chi-square p-value is not significant, but I wonder how to interpret the two coefficients. Other interp: bezier, bilinear(), linterp(), nn(), polyinterp(), pwiselinterp() Sep 15, 2016 · I seem to have a problem with the splines::ns() function in R. splrep(x,y) Strangely, I needed to remove the first and last 3 entries in the arrays to get the code to work (note Dec 8, 2017 · Spline adjustment differs because the mean difference varies over the domain of the predictor. mfxrcspline graphs the marginal effects. This is a definition of a natural cubic spline. 5 1. May 13, 2017 · Cubic splines have a nice interpretation that makes them popular in functional data analysis: They can be viewed as the solution to a least squares problem (with smoothness constraints) for data lying in a Hilbert space. For each x-y ordered pair. You can get the (recursive) expression of B-splines from Definition of B-spline. I fit a restricted cubic spline function with k =3 knots as follows: fitted. As we can see, the natural cubic spline is generally smoother and closer to linear on the right boundary of the predictor space, where it has, additionally, narrower confidence intervals in comparison to the cubic spline. Since there are intervals and four coefficients for each we require a total of May 16, 2017 · Truncated power basis expansions and penalized spline methods are demonstrated for estimating nonlinear exposure-response relationships in the Cox proportional hazards model. I would like to have the coefficients of all piecewise fitted polynomials. For multiple knots we can write this as. Mar 1, 2017 · This need not be the case, and the bulk of this report will focus on the interpretation of analyses with splines. Jan 14, 2019 · I have used restricted cubic spline transformed to fix a Cox PH model using Dr. e. The method is illustrated using a simulated data set under a known exposure-response relationship and in a data application examining risk of The higher the order is, the more smooth the spline becomes. My end goal is to be able to reconstruct these piecewise polynomial functions outside of matlab using the coefficients provided in the coefficient structure. 5 3 3. Oct 3, 2021 · Very, very useful. If the covariance between estimated coefficients b1 b 1 and b2 b 2 is high, then in any sample where b1 b 1 is high, you can also expect b2 b 2 to be high. A cubic spline function, with three knots (τ 1,τ 2,τ 3) will have 7 degrees of freedom. Triple knots at both ends of the interval ensure that the curve interpolates the end points. Jan 15, 2009 · Here we follow a different approach where the definition of cubic polynomials induces a local parametrization for cubic splines. Jul 18, 2021 · Natural Cubic Spline: In Natural cubic spline, we assume that the second derivative of the spline at boundary points is 0: Now, since the S (x) is a third-order polynomial we know that S” (x) is a linear spline which interpolates. Then you should get F. from scipy. Like with quadratic regression, separate interpretation of the coefficients is of no practical value with RCS regression, as the effect of SFS on VO 2 max is a function of multiple regression coefficients. They estab lish a relationship between the known data points and the unknown coefficients Apr 19, 2017 · I think the fact that the SAS documentation refers to the restricted cubic splines as "natural cubic splines" has prevented some practitioners from realizing that SAS supports restricted cubic splines. This is happening for one of the spline fit (f1). knots,coeff,n=scipy. spline() but is implemented. This produces good approximation results as compared e. with the not-a-knot spline. Cubic regression splines. Oct 28, 2020 · To overcome the difficulties in the interpretation of the spline regression coefficients it is customary to present the results graphically, displaying the estimated shape of the spline function with its confidence intervals, or to choose some values of the explanatory variable and evaluate the estimated outcome at these values. Example 3 Jan 24, 2017 · See the documentation here. 78. Then u(x) has the form u(x) = A 6 (1−x)3 + a− A 6 (1−x)+ B 6 x3 + b− B 6 x. Suppose we want to estimate E(yjx) = f (x) using a piecewise linear model. ( ) ( ) 1 ( 0 ) (0 ) f n x n f x n f x f x ′ = ′ ′ = ′ - (5d) In traditional cubic splines equations 2 to 5 are combined and the n+1 by n+1 tridiagonal matrix is solved to yield the cubic spline equations for each segment [1,3]. With link function g(. 15. Value. Read more. Wood (2017). pp = spline(x,y) returns a piecewise polynomial structure for use by ppval and the spline utility unmkpp. press Ctrl + Shift + Enter. These have a cubic spline basis defined by a modest sized set of knots spread evenly through the covariate values. Instead of float*, it is also possible to pass float2*, float3*, or float4* data (e. Jul 27, 2018 · So I propose to do a cubic spline interpolation and then calculate the integral of the spline function by analytically calculating the integral of the cubic in each segment. 5 4 y 2. 17 Cubic splines require the analyst to specify a set of knots, which are specific values of the continuous variable X. pyplot as plt. 1. To summarize this all in one sentence, each coefficient scales the spline different directions by multiplying the coefficients by their bases, in turn giving us our regression line. Feb 2, 2023 · Once a restricted cubic spline transformation is applied, we interpret the graph, not the coefficients! Visualize model with a restricted cubic spline The code below shows how to use the marginaleffects to generate predicted values from the model and how these values can be plotted with ggplot2 . The other method used quite often is Cubic Hermite spline, this gives us the spline in Hermite form. S j(x j+1) = S j+1(x j+1) for j = 0,1,,n −2. 5 0. It is straightforward to check that the formula works. 1 Review of Interpolation using Cubic Splines Recall from last time the problem of approximating a function over an interval using cubic splines. We’ve approached the interpolation problem by choosing (high-degree) polyno-mials for our basis functions φi : f(x) = n j=0 cjφj(x). We illustrate the command through several worked examples using data from a large study of Swedish men on the relation between physical activity and the occurrence of lower urinary tract symptoms. example. The "Parameter Estimates" table contains the estimates of the group-specific "intercepts," the spline coefficients varied by group, and the residual variance ("Scale," Output 40. A suitable computational algorithm to define the coefficients of cubic splines solves a WELL-posed linear system for concavities I''(V k) = m k subject to the boundary conditions: m 0 = m n = 0 (for natural See Duchon. 35 '. model <- Rq(y ~ rcs(x, 3), x=TRUE, y=TRUE, tau=0. A joint test of the hypothesis that all of the non-linear term coefficients equal 0 is the test you need. 0, k 2 = 5. interpolate. Note that the sample values will be replaced by the cubic B-spline coefficients. Cubic. But i am getting 25 coefficients and 9 knot points for the second fit (f2). 4. To determine the coefficients of each cubic function, we write out the constraints explicitly as a system of linear equations with 4(n − 1) unknowns. The spline has four parameters on each of the K+1 regions minus three constraints for each knot, resulting in a K+4 degrees of freedom. These new points are function values of an interpolation function (referred to as spline), which itself consists of multiple cubic piecewise polynomials. S′ j (x j+1) = S ′ j+1 (x j+1) for j = 0,1,,n −2. where f kgK k=1 are the locations of the change points Note that knot locations are de ned before estimating regression coe cients Also, regression coe cients are interpreted conditional on the knots. Dec 2, 2018 · Solution: We first understand what it wants. For details see cubic. Try the following: import numpy as np. Jan 29, 2016 · I have a set of measured values that I'd liked to interpolate in R using cubic splines. # -*- coding: utf-8 -*-. Frank Harrell's cph () from the rms package. Description. 5 of Regression Modeling Strategies. In a more Bayesian sense, b1 b 1 contains information about b2 b 2. 01777539x^2 + 6. import matplotlib. The coefficients in the ppform are not the coefficients of a standard polynomial, but rather correspond to the Jun 17, 2017 · Cubic spline interpolation is the process of constructing a spline f: [ x 1, x n + 1] → R which consists of n polynomials of degree three, referred to as f 1 to f n. gives. The result is represented as a PPoly instance with breakpoints matching the given data. Opposed to regression, the interpolation function traverses all n + 1 pre-defined points of a data set D. We will use the option basis spline equal to cubic regression splines: bs="cr". Find a cubic spline s: [a,b] such that B-spline Curves: Computing the Coefficients. you will not end up with the same set of coefficients. t as the knots and spl. This ensures from the outset that values and first derivatives match, and you only have to solve a linear system that forces second derivatives to match, too. Predict two adjacent categories over key points in the domain to get the analogue of a "raw coefficient". There are several types of splines implemented in the function. where f kgK k=1 are the locations of the change points Note that knot locations are de ned before estimating regression coe cients Also, regression coe cients are interpreted Oct 14, 2021 · I am using restricted cubic splines with logistic regression. The EFFECT statement defines a B-spline expansion for the equivalence ratio. g. The postrcspline package provides tools for interpreting the results: adjustrcspline graphs the adjusted predictions. In summary, the function spline (theta, R) returns a piecewise polynomial interpolation of the points in theta and R, represented in a ppform. 3 Odds Ratio interpretation of Coefficients; 10. , daily on individual cows. Dec 28, 2015 · This means that I need to write the code to evaluate a point given the knots and coefficients myself. Let's use the insight we extracted when building piecewise linear interpolants to construct piecewise cubic interpolants, or cubic splines. S′′ j (x j+1) = S ′′ j+1 (x j+1) for j = 0,1,,n −2. This approach can be efficient (recall the barycentric form of the Lagrange interpolant), but using high degree poly-nomials can lead to large errors due to erratic oscillations, especially near the interval endpoints. There is a separate cubic polynomial for each interval, each with its own coefficients: together, these polynomial segments are denoted , the spline. regression. Now, let’s assume t_i = x_i for i The function s() within the model indicates that we want to smoothing spline for that predictor. (a) For cubic spline interpolation do the following: (i) Calculate the cubic spline coefficients for each interval (ii) Form cubic spline interpolation function for each interval xi , xi 1 , i 1, 2,, n 1. This code takes an x and a corresponding y sequence, each with length n, and returns cubic polynomial coefficients for each segment. k=1 k+1(x k)+. Alternatively, the second derivative u00(x) is a linear function with u00(0) = A and u This is not necessary and is done here only for convenience of interpretation. The two points are t0 = 15 and t1 = 20. tionships. 50, data=d) I am confused by the fact that. com For multiple knots we can write this as. S(x j) = f(x j) for j = 0,1,,n. Calculates spline coefficients and interpolated data values in 1D to 3D. Although de Boor's algorithm is a standard way for computing the point on a B-spline curve that corresponds to a given u, we really need these coefficients in many cases ( e. B-spline of degree 0 is the most basis class, while. , curve interpolation and approximation). Cubic Spline Interpolant (2 of 2) The cubic spline interpolant will have the following properties. # clear any open plots. Using representation May 16, 2015 · The (estimated) covariance of two regression coefficients is the covariance of the estimates, b b. Question. This is an example of \nonparametric regression," which ironically connotes the inclusion of lots of parameters rather than fewer. Assume for simplicity that a = x0 < x1 < ··· < xN = b. Lemma. R code is provided for fitting models to get point and interval estimates. Chapter Three – Quadratic Spline Interpolation. The b-spline coefficients are accessed via the c attribute of a BSpline object: >>> Cubic spline interpolation is a mathematical method commonly used to construct new points within the boundaries of a set of known points. We begin by defining a cubic spline in Section 1. The pitch variable describes the width of a row in the image in bytes. ), model matrix X X of n n rows and p p features (plus a column for the intercept), a vector of p p coefficients β β, we can write a GLM as follows: GLM: g(μ) = Xβ G L M: g ( μ) = X β For the GAM, it The cubic spline interpolation is a piecewise continuous curve, passing through each of the values in the table. Feb 23, 2021 · The output shows three differenet coefficients which reflect different part of the spline curve. splrep gives you is the coefficients for the knots for a b-spline. In mathematics, a spline is a function defined piecewise by polynomials . Spline interpolation. I would appreciate a lot if you could help me in clarifying two additional points: - The possibility of getting the coefficients of the different splines functions using R (lm & bs functions) - The formula to obtaine the number of degrees of freedom of a bs spline model based on the number of coefficients and the knots. It produces a smooth curve over the interval being studied while at the same time offering a distinct polynomial for each subinterval (known as Splines). 2. I have been looking at functions like spline and splinefun as well as those in the splines2 package. Use CubicSpline to plot the cubic spline interpolation of the data set x = [0, 1, 2] and y = [1, 3, 2] for 0 ≤ x ≤ 2. 2 Using predict to describe the model’s fits; 10. co zs lb zz bw ad vv lb df pu