Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

natural splines #2

Open
ekhco opened this issue Sep 19, 2017 · 3 comments
Open

natural splines #2

ekhco opened this issue Sep 19, 2017 · 3 comments

Comments

@ekhco
Copy link

ekhco commented Sep 19, 2017

A problem I encounter when the .Environment is removed from terms is that natural splines no longer work when predicting:

library(strip)
library(splines)
x <- 1:1000/100
e <- rnorm(1:1000,mean=0, sd=0.3)
y <- sqrt(x) + e
plot(x,y)

# natural spline fit
nsfit <- lm(y ~ ns(x,df=3))
fit0 <- strip(nsfit, keep="predict")
predict(fit0, newdata=data.frame(x=1:10))
@spgarbet
Copy link

spgarbet commented Oct 4, 2022

Just had this same issue. The fact the ticket was opened in 2017 doesn't give me much hope.

@spgarbet
Copy link

spgarbet commented Oct 4, 2022

I've also tried things with rms and biglm to work around this and used rcs, all have similar issues.

@spgarbet
Copy link

spgarbet commented Oct 4, 2022

I am committed to solving this problem for a grant, Using the original code, I find the issue is the handling of the "terms" sub-object.

> object.size(nsfit)
308056 bytes
> object.size(fit0)
9136 bytes
> fit0$terms <- nsfit$terms
> object.size(fit0)
9304 bytes
> predict(fit0, newdata=data.frame(x=1))
1 
0.9332283 

spgarbet added a commit to spgarbet/strip that referenced this issue Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants