Introduction To Mixed-Effects Models For Hierarchical and Longitudinal Data (Part II)
Introduction To Mixed-Effects Models For Hierarchical and Longitudinal Data (Part II)
Sociology 761
John Fox
Lecture Notes
Introduction to Mixed-Effects Models for Hierarchical and Longitudinal Data (Part II)
I In the following table, the logit, probit and complementary log-log links
are for binomial or binary data:
l = j(l)
l = j 1( l)
l
l
logh l
hl
1
1
l
l
1@2
2
l
l
s
l
2l
l
1
logit
logh
1 l
1 + hl
probit
x(l)
x1( l)
complementary log-log logh[ logh(1 l)] 1 exp[ exp( l)]
Link
identity
log
inverse
inverse-square
square-root
Sociology 761
c
Copyright 2006
by John Fox
c
Copyright 2006
by John Fox
Introduction to Mixed-Effects Models for Hierarchical and Longitudinal Data (Part II)
I In R, generalized linear models are fit with the glm function, and most of
the arguments of glm are similar to those of lm:
The response variable and regressors are given in a model formula
data, subset, and na.action arguments determine the data on
which the model is fit.
The additional family argument is used to specify a family-generator
function, which may take other arguments, such as a link function.
Sociology 761
c
Copyright 2006
by John Fox
Introduction to Mixed-Effects Models for Hierarchical and Longitudinal Data (Part II)
c
Copyright 2006
by John Fox
Sociology 761
Introduction to Mixed-Effects Models for Hierarchical and Longitudinal Data (Part II)
link
family
log logit probit cloglog
gaussian
X
binomial
X
X
X
X
poisson
X
Gamma
X
inverse.gaussian X
quasi
X
X
X
X
quasibinomial
X
X
X
quasipoisson
X
Sociology 761
Introduction to Mixed-Effects Models for Hierarchical and Longitudinal Data (Part II)
I The following table shows the links available for each family in R, with
the default links in bold:
c
Copyright 2006
by John Fox
link
family
identity inverse sqrt 1/mu^2
gaussian
X
X
binomial
poisson
X
X
Gamma
X
X
inverse.gaussian
X
X
X
quasi
X
X
X
X
quasibinomial
quasipoisson
X
X
Sociology 761
c
Copyright 2006
by John Fox
Introduction to Mixed-Effects Models for Hierarchical and Longitudinal Data (Part II)
Sociology 761
c
Copyright 2006
by John Fox
Introduction to Mixed-Effects Models for Hierarchical and Longitudinal Data (Part II)
Sociology 761
c
Copyright 2006
by John Fox
Introduction to Mixed-Effects Models for Hierarchical and Longitudinal Data (Part II)
10
Introduction to Mixed-Effects Models for Hierarchical and Longitudinal Data (Part II)
Sociology 761
c
Copyright 2006
by John Fox
Introduction to Mixed-Effects Models for Hierarchical and Longitudinal Data (Part II)
11
The number of women per district in the sample ranges from 2 to 118.
Sociology 761
c
Copyright 2006
by John Fox
Sociology 761
c
Copyright 2006
by John Fox
Introduction to Mixed-Effects Models for Hierarchical and Longitudinal Data (Part II)
12
I To test whether all of the random effects are required, I fit several models
to the data.
I found that I could not get the estimates to converge when I included
random effects for number of children, so I omitted these from the
model.
I obtained the following approximate maximized log-likelihoods (with
model 1 including the random effects for both cage and urban):
Model Omitting Random Effects for logh O
1
1198=99
2
cage
1199=65
3
urban
1206=35
4
intercept
1220=94
Introduction to Mixed-Effects Models for Hierarchical and Longitudinal Data (Part II)
13
Likelihood ratio tests for the variance and covariance components are
as follows:
s
Variance and Covariance Components for J2 gi
cage
1=32 3 =73
urban
14=72 3 =002
intercept
43=90 3 =001
I therefore retained the random effects for urban and the random
intercepts, but removed the random effects for age.
c
Copyright 2006
by John Fox
Introduction to Mixed-Effects Models for Hierarchical and Longitudinal Data (Part II)
14
Sociology 761
c
Copyright 2006
by John Fox
Sociology 761
Introduction to Mixed-Effects Models for Hierarchical and Longitudinal Data (Part II)
c
Copyright 2006
by John Fox
15
Sociology 761
c
Copyright 2006
by John Fox