grab_psiFUN {geex} | R Documentation |
Grab estimating functions from a model object
Description
Grab estimating functions from a model object
Usage
grab_psiFUN(object, ...)
## S3 method for class 'glm'
grab_psiFUN(object, data, ...)
## S3 method for class 'geeglm'
grab_psiFUN(object, data, ...)
## S3 method for class 'merMod'
grab_psiFUN(object, data, numderiv_opts = NULL, ...)
Arguments
object |
the object from which to extrace |
... |
additonal arguments passed to other methods |
data |
the data to use for the estimating function |
numderiv_opts |
a list of arguments passed to |
Value
a function corresponding to the estimating equations of a model
Methods (by class)
-
grab_psiFUN(glm)
: Create estimating equation function from aglm
object -
grab_psiFUN(geeglm)
: Create estimating equation function from ageeglm
object -
grab_psiFUN(merMod)
: Create estimating equation function from amerMod
object
Examples
## Not run:
library(geepack)
library(lme4)
data('ohio')
glmfit <- glm(resp ~ age, data = ohio,
family = binomial(link = "logit"))
geefit <- geeglm(resp ~ age, data = ohio, id = id,
family = binomial(link = "logit"))
glmmfit <- glmer(resp ~ age + (1|id), data = ohio,
family = binomial(link = "logit"))
example_ee <- function(data, model){
f <- grab_psiFUN(model, data)
function(theta){
f(theta)
}
}
m_estimate(
estFUN = example_ee,
data = ohio,
compute_roots = FALSE,
units = 'id',
roots = coef(glmfit),
outer_args = list(model = glmfit))
m_estimate(
estFUN = example_ee,
data = ohio,
compute_roots = FALSE,
units = 'id',
roots = coef(geefit),
outer_args = list(model = geefit))
m_estimate(
estFUN = example_ee,
data = ohio,
compute_roots = FALSE,
units = 'id',
roots = unlist(getME(glmmfit, c('beta', 'theta'))),
outer_args = list(model = glmmfit))
## End(Not run)
[Package geex version 1.1.1 Index]