Description Usage Arguments Details Value Author(s) See Also Examples
hglmbc is used to fit hierarchical generalized linear models using h-likelihood
with bias correction in small area estimation (SAE) for exponential
family distributions with normally distributed random effects.
1 2 3 4 5 6 7 8 9 |
data |
a data frame. |
mformula |
an object of class |
dom |
a domain/cluster/small area to specify the random effect. e.g. numeric zipcode, county, or state code, and also name of the county or name of the state. |
y.family |
a distribution from _exponential family_ to describe the error distribution. See
|
rand.family |
a discription of the distribution of random effects. |
tol |
predefined tolerance value. Default value is tol=1e-10. |
... |
other arguments, See details section. |
A typical model has the form response ~ terms where the response is the (numeric)
vector and terms is a series of terms which specifies a linear predictor for response.
A terms are specified as a linear combination of predictors, in Small Area Estiamtion (SAE), it is
a vector of fixed effects. e.g. y ~ x1 + x2 + as.factor(x3).
If a formula is not defined, the user can input the response variable, resp, a vector
of fixed effects, such as fe.disc for categorical variables and fe.cont for continuous
variables. If not, the user can define the resp, then, it will automatically select the
fixed effects based on the variable types.
The hglmbc function also has the flexibility to use different reference category for factor
variables. e.g. ref.group can be defined for each categorical variable. By default the
reference group will be considered in alphebetical order or numerical order. In order to use a different
reference group, ref.group needs to be defined. e.g. for categorical variables
age (groups: 1, 2, 3), if the prefered reference group is 2, then set ref.group = "age2".
An object of class hglmbc consists of the hierarchical maximum likelihood estimates (HMLEs)
of fixed effects, random effects, and variance parameters with other values,
est.beta |
HMLE of fixed effects. |
re |
HMLE of the random effects. |
var.par |
HMLE of the dispersion parameter for the random effects. |
fe.cov |
the estimated variance-covariance matrix of the fixed effects. |
fe.cov |
the estimated vaiance-covaraince matrix of the random effects. |
iter |
number of iterations at convergence. |
AICBIC |
A list of likelihood values for model selection purposes,where |
summary |
a summary object of the fitted model. |
Nirosha Rathnayake, Dai (Daisy) Hongying
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ## Not run:
# Using ever use of smoke data set. Discrete and continuous variables are defined.
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"
hglmbc.fit <- hglmbc(data=eversmoke, mformula, dom = "county", y.family="binomial")
# mformula is not defined,
resp <- "smoke_ever"
dom <- "county"
catX <- c("year","gender","race","age")
contX <- "povt_rate"
hglmbc.fit <- hglmbc(data = eversmoke, resp, dom = "county",fe.disc = catX,
fe.cont = contX, y.family = "binomial")
# Poisson-Normal HGLM
N = 1000
p = 20
nVars = 5
x = matrix(rnorm(N * p), N, p)
beta = rnorm(nVars)
f = x[, seq(nVars)] %*% beta
mu = exp(f)
y = rpois(N, mu)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.