knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
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:

  1. A linear predictor: $\eta_i=\sum_{i=1}^n x_i\beta_i$,
  2. A link function: $\eta_i = g(\mu_i)$,

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)
names(b.family)

p.family <- poisson()

p.family
b.family

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


niroshar/hglmbc2 documentation built on Oct. 27, 2020, 2:22 a.m.