geelm | R Documentation |
Fits a generalized estimating equation (GEE) model with
Gaussian family with different link functions.
The geelm
function also supports LASSO or SCAD
regularization.
geelm(
formula,
data,
subset,
id,
link = c("identity", "log", "cloglog", "logit"),
corstr = c("independence", "exchangeable", "ar1"),
lambda,
exclude,
penalty = c("lasso", "scad"),
nfolds = 5,
nlambda = 200,
binit,
tol = 1e-07,
maxit = 100
)
formula |
A formula object starting with |
data |
An optional data frame that contains the covariates and response variables. |
subset |
An optional logical vector specifying a subset of observations to be used in the fitting process. |
id |
A vector which identifies the clusters. If not specified, each observation is treated as its own cluster. |
link |
A character string specifying the model link function. Available options are
|
corstr |
A character string specifying the correlation structure.
Available options are |
lambda |
An option for specifying the tuning parameter used in penalization.
When this is unspecified or has a |
exclude |
A binary numerical vector specifying which variables to exclude in variable selection.
The length of |
penalty |
A character string specifying the penalty function.
The available options are |
nfolds |
An optional integer value specifying the number of folds. The default value is 5. |
nlambda |
An optional integer value specifying the number of tuning parameters to try
if |
binit |
A optional numerical vector for the initial value. A zero vector is used when not specified. |
tol |
A positive numerical value specifying the absolute
error tolerance in root search. Default at |
maxit |
A positive integer specifying the maximum number of iteration. Default at 100. |
An object of class "geelm"
representing a linear model fit with GEE.
gendat <- function() {
id <- gl(50, 4, 200)
visit <- rep(1:4, 50)
x1 <- rbinom(200, 1, 0.6)
x2 <- runif(200, 0, 1)
phi <- 1 + 2 * x1
rhomat <- 0.667^outer(1:4, 1:4, function(x, y) abs(x - y))
chol.u <- chol(rhomat)
noise <- as.vector(sapply(1:50, function(x) chol.u %*% rnorm(4)))
e <- sqrt(phi) * noise
y <- 1 + 3 * x1 - 2 * x2 + e
dat <- data.frame(y, id, visit, x1, x2)
dat
}
set.seed(1); str(dat <- gendat())
geelm(y ~ x1 + x2, id = id, data = dat, corstr = "ar1")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.