"BXC (Bendix Carstensen)" <bxc at steno.dk> writes:
> > apc <- glm( D ~ ns( Ax, knots=seq(50,80,10), Bo=c(40,90) ) +
> + ns( Cx, knots=seq(1880,1940,20), Bo=c(1840,1960) ) +
> + ns( Px, knots=seq(1960,1980,10), Bo=c(1940,2000) ) +
> + offset( log( Y ) ),
> + family=poisson )
> > pterm <- predict( apc, type="terms" )
> > plink <- predict( apc, type="link" )
> > ( apply( pterm, 1, sum ) + log( Y ) - plink )[1:10]
> 1 2 3 4 5 6 7 8 9
> 10
> 6.85047 6.85047 6.85047 6.85047 6.85047 6.85047 6.85047 6.85047 6.85047
> 6.85047
> > coef( apc )[1]
> (Intercept)
> -13.61998
>
> >From the help page for predict.glm I would have expected that the
> constant 6.85
> was -intercept.
>
> What am I missing from predict.glm? (or from splines?)
Same thing that you're missing from predict(..., type="terms") in
general.
Try
y <- rnorm(10)
x <- runif(10)
apc <- lm(y~x)
predict(apc,type="terms")
predict(apc,type="terms") - predict(apc,type="response")
mean(predict(apc,type="terms"))
and I think enlightenment will follow.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907