Displaying 1 result from an estimated 1 matches for "pred_man2".
Did you mean:
pred_man
2011 Sep 06
1
Question about Natural Splines (ns function)
Hi - How can I 'manually' reproduce the results in 'pred1' below? My attempt
is pred_manual, but is not correct. Any help is much appreciated.
library(splines)
set.seed(12345)
y <- rgamma(1000, shape =0.5)
age <- rnorm(1000, 45, 10)
glm1 <- glm(y ~ ns(age, 4), family=Gamma(link=log))
dd <- data.frame(age = 16:80)
mm <- model.matrix( ~ ns(dd$age, 4))
pred1 <-