est_null_model | R Documentation |
Given an lme4 model object and the value of the treatment effect parameter under the null hypothesis, the function returns a glm or lm object fitted under the null model with no cluster effects. For linear models (lmer) the value of the null is subtracted from the value of the outcome for those in receipt of the treatment and an lm model is fitted with no treatment effect. For generalised linear models (glmer) the model is refitted as a glm model with the treatment effect specified as an offset.
est_null_model(fit, data, tr_var = "treat", null_par)
fit |
An lme4 model object |
data |
The data frame used to fit model fit |
tr_var |
A string indicating the name of the column in data that is a binary indicator for whether the observation was under the treatment (1=treatment, 0=control) |
null_par |
Numeric the value of tr_var parameter under the null hypothesis |
An lm or glm model fit under the null model
out <- twoarm_sim()
data <- out[[1]]
fit1 <- lme4::glmer(y1 ~ treat + (1|cl) ,
data=data,
family="poisson")
fit2 <- lme4::glmer(y2 ~ treat + (1|cl),
data=data,
family="poisson")
fitlist <- list(fit1,fit2)
nullfitlist <- list()
for(i in 1:length(fitlist)){
nullfitlist[[i]] <- est_null_model(fitlist[[i]],
data,
tr_var = "treat",
null_par = 0)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.