Closed ccardehu closed 7 months ago
There is a typo in your example:
set.seed(1234)
X = runif(10)
knots = c(0.3,0.5,0.7)
degree = 2
## The `Boundary.knots` was not correctly specified in the following comment.
## resR = splines2::isp(X, knots = knots, degree = degree, intercept = F,Boundaryknots. = c(0,1))
resR = splines2::isp(X, knots = knots, degree = degree, intercept = F, Boundary.knots = c(0,1))
Rcpp::sourceCpp("test.cpp")
resCpp = testCpp(X,knots,degree)
You should be able to get the same results after fixing the typo.
There is a typo in your example:
set.seed(1234) X = runif(10) knots = c(0.3,0.5,0.7) degree = 2 ## The `Boundary.knots` was not correctly specified in the following comment. ## resR = splines2::isp(X, knots = knots, degree = degree, intercept = F,Boundaryknots. = c(0,1)) resR = splines2::isp(X, knots = knots, degree = degree, intercept = F, Boundary.knots = c(0,1)) Rcpp::sourceCpp("test.cpp") resCpp = testCpp(X,knots,degree)
You should be able to get the same results after fixing the typo.
Omg, I'm sorry! Thank you very much for your time (silly question!)
Hello,
I was wondering if anyone has found differences between the R and Rcpp basis outputs of the XX-splines family of functions. Below is a (reproducible) toy example of an Rcpp implementation of the Isplines function and the corresponding R function. As you can see, the output is different. The differences are smaller as the input vector "x" grows, but still.
Many thanks for your time and for any comment or pointer.
Best, Camilo
Rcpp code (saved as test.cpp):
R Code:
Output:
Session info: