-
Notifications
You must be signed in to change notification settings - Fork 1
Description
library(geepack)
data(seizure)
seiz.l <- reshape(seizure,
varying=list(c("base","y1", "y2", "y3", "y4")),
v.names="y", times=0:4, direction="long")
seiz.l <- seiz.l[order(seiz.l$id, seiz.l$time),]
seiz.l$t <- ifelse(seiz.l$time == 0, 8, 2)
seiz.l$x <- ifelse(seiz.l$time == 0, 0, 1)
m3 <- geeglm(y ~ x , id = id,
data=as.data.frame(subset(seiz.l,seiz.l$y<8&seiz.l$y!=0)), corstr="exch", family=poisson)
cvGEE::cv_gee(m3)
m3
m4 <- geeglm(y ~ x , id = id,
data=as.data.frame(seiz.l), corstr="exch", family=poisson)
cvGEE::cv_gee(m3)
cvGEE::cv_gee(m4)
m3
Call:
geeglm(formula = y ~ x, family = poisson, data = as.data.frame(subset(seiz.l,
seiz.l$y < 8 & seiz.l$y != 0)), id = id, corstr = "exch")
Coefficients:
(Intercept) x
2.0758 -0.7349
Degrees of Freedom: 145 Total (i.e. Null); 143 Residual
Scale Link: identity
Estimated Scale Parameters: [1] 0.7971
Correlation: Structure = exchangeable Link = identity
Estimated Correlation Parameters:
alpha
0.3115
Number of clusters: 48 Maximum cluster size: 5
m4
Call:
geeglm(formula = y ~ x, family = poisson, data = as.data.frame(seiz.l),
id = id, corstr = "exch")
Coefficients:
(Intercept) x
3.442 -1.329
Degrees of Freedom: 295 Total (i.e. Null); 293 Residual
Scale Link: identity
Estimated Scale Parameters: [1] 19.25
Correlation: Structure = exchangeable Link = identity
Estimated Correlation Parameters:
alpha
0.7739
Number of clusters: 59 Maximum cluster size: 5
This occurs because of the following lines in your package:
counts <- object$family$linkinv(eta)
scale <- object$geese$gamma
shape_neg_bin <- (counts/(scale - 1))
log_p_y <- dnbinom(x = resp, size = shape_neg_bin,
mu = counts, log = TRUE)