View source: R/grab_psiFUN_funs.R
grab_psiFUN | R Documentation |
Grab estimating functions from a model object
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, ...)
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 |
a function corresponding to the estimating equations of a model
grab_psiFUN(glm)
: Create estimating equation function from a glm
object
grab_psiFUN(geeglm)
: Create estimating equation function from a geeglm
object
grab_psiFUN(merMod)
: Create estimating equation function from a merMod
object
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.