I've run the following model:
log <- svyglm(compo ~ bs(edadc,degree=1, knots =c(-1,8)) +
numenf5 + BMIc + BMIc2 + fried,
dclus,family = quasibinomial)
When I try to calculate logits for edadc=0, I get different results when I write:
newdata2 <- with(compoc,
data.frame(edadc = rep(seq(from = -1, to = 0))))
newdata2$BMIc<-0
newdata2$BMIc2<-0
newdata2$numenf5<-2
newdata2$fried<-"R"
newdata2 <- cbind(newdata2, predict(log, newdata2,
type = "link",se= TRUE))
edadc BMIc BMIc2 numenf5 fried link SE
1 -1 0 0 2 R -0.8689483 0.1319695
2 0 0 0 2 R -0.2217048 0.1569442
and when I write:
newdata2 <- with(compoc,
data.frame(edadc = rep(seq(from = -1, to = 1))))
newdata2$BMIc<-0
newdata2$BMIc2<-0
newdata2$numenf5<-2
newdata2$fried<-"R"
newdata2 <- cbind(newdata2, predict(log,
newdata2, type = "link",se= TRUE))
edadc BMIc BMIc2 numenf5 fried link SE
1 -1 0 0 2 R -0.8689483 0.1319695
2 0 0 0 2 R -0.5453266 0.1021396
3 1 0 0 2 R -0.2217048 0.1569442
The different calculation for link happens when I introduce positive values for edadc in newdata2.
At request of Ben Bolker, here you have a reproducible example: