vignettes/hglmbc2_vignette.Rmd
hglmbc2_vignette.Rmd
library(hglmbc2)
The proposed `calibrated h-likelihood with bias correction’ approach is currently limited to GLM family distributions where a response variable whose conditional distribution of \(y|u\) belongs to exponential family and the random effect \(u\sim N(0,\sigma^2)\). The algorithm consists of two main key components:
The list of components in each GLM family distribution in R is illustrated in an object of class, family
(run ?family
in R console for more details). As an example, the code below shows the constituent parts for the binomial GLM, which is what is used to fit linear logistic regression:
b.family <- binomial() class(b.family) #> [1] "family" names(b.family) #> [1] "family" "link" "linkfun" "linkinv" "variance" #> [6] "dev.resids" "aic" "mu.eta" "initialize" "validmu" #> [11] "valideta" "simulate" p.family <- poisson() p.family #> #> Family: poisson #> Link function: log b.family #> #> Family: binomial #> Link function: logit
Example: Binomial-Normal HGLM (Mixed Logit Model) with Bias Correction Binomial-Normal HGLM
is also known as the mixed logit
model in GLM family with the binary response variable and the random effect \(u\sim N(0,\sigma^2)\).
library(hglmbc2) ## basic example code data <- eversmoke mformula <- "smoke_ever ~ as.factor(age) + as.factor(gender) + as.factor(race) + as.factor(year) + povt_rate" dom <- "county" y.family <- "binomial" rand.family <- "gaussian" ## Fit the model # hglmbc.fit <- hglmbc(data=eversmoke, mformula, dom = "county", y.family=binomial) # hglmbc.fit$summary
University of Nebraska Medical Center, niro.uno@gmail.com, https://niroshar.github.io/My-Profile/↩