R/geekin.R
geekin.Rd
The geekin function fits generalized estimating equations but where the correlation structure is given as linear function of (scaled) fixed correlation structures.
geekin(
formula,
family = gaussian,
data,
weights,
subset,
id,
na.action,
control = geepack::geese.control(...),
varlist,
...
)
See corresponding documentation to glm
.
See corresponding documentation to glm
.
See corresponding documentation to glm
.
See corresponding documentation to glm
.
See corresponding documentation to glm
.
a vector which identifies the clusters. The length of id
should be the same as the number of observations. Data must be sorted so
that observations on a cluster are contiguous rows for all entities in the
formula. If not the function will give an error
See corresponding documentation to glm
.
See corresponding documentation to glm
.
a list containing one or more matrix or bdsmatrix objects that represent the correlation structures
further arguments passed to or from other methods.
Returns an object of type geeglm
.
The geekin function is essentially a wrapper function to geeglm
.
Through the varlist argument, it allows for correlation structures of the
form
R = sum_i=1^k alpha_i R_i
where alpha_i are(nuisance) scale parameters that are used to scale the off-diagonal elements of the individual correlation matrices, R_i.
lmekin
, geeglm
# Get dataset
library(kinship2)
library(mvtnorm)
data(minnbreast)
breastpeda <- with(minnbreast[order(minnbreast$famid), ], pedigree(id,
fatherid, motherid, sex,
status=(cancer& !is.na(cancer)), affected=proband,
famid=famid))
set.seed(10)
nfam <- 6
breastped <- breastpeda[1:nfam]
# Simulate a response
# Make dataset for lme4
df <- lapply(1:nfam, function(xx) {
as.data.frame(breastped[xx])
})
mydata <- do.call(rbind, df)
mydata$famid <- rep(1:nfam, times=unlist(lapply(df, nrow)))
y <- lapply(1:nfam, function(xx) {
x <- breastped[xx]
rmvtnorm.pedigree(1, x, h2=0.3, c2=0)
})
yy <- unlist(y)
library(geepack)
geekin(yy ~ 1, id=mydata$famid, varlist=list(2*kinship(breastped)))
#>
#> Call:
#> geekin(formula = yy ~ 1, id = mydata$famid, varlist = list(2 *
#> kinship(breastped)))
#>
#> Coefficients:
#> (Intercept)
#> -0.1709465
#>
#> Degrees of Freedom: 225 Total (i.e. Null); 224 Residual
#>
#> Scale Link: identity
#> Estimated Scale Parameters: [1] 0.8873601
#>
#> Correlation: Structure = userdefined Link = identity
#> Estimated Correlation Parameters:
#> alpha:1
#> 0.2659875
#>
#> Number of clusters: 6 Maximum cluster size: 47
#>
# lmekin(yy ~ 1 + (1|id), data=mydata, varlist=list(2*kinship(breastped)),method="REML")