SlideShare a Scribd company logo
1 of 18
Download to read offline
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Chapter 14: Computing
Generalized, Linear, and Mixed Models
Charles E. McCulloch, Shayle R. Searle, John M. Neuhaus

Gota Morota

May 4, 2010

Gota Morota

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Outline

1

Review of LM, GLM, LMM, GLMM

2

Numerical Integration for Solving GLMM

3

GLMM in R

Gota Morota

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Linear Model and Linear Mixed Model
LM: Solving the MLE with a least squares for fixed effects and
simple formula for estimating residual variance.

ˆ
B = (X X)−1 X y
RSS
σ2 =
ˆe
N−p
LMM Solving the MLE with a least squares for the fixed effects
and random effects. Solving the MLE with a (RE)ML for the
variance components.

ˆ
B = (X V−1 X)X V−1 y
ˆ
u = DZ V−1 (y − XB)
Variance Components = (RE)ML coupled with iterative methods
where D is Var(u), V is Var(y) = ZDZ + R
Gota Morota

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Generalized Linear Model and Generalized Linear Mixed
Model
GLM: Fixed effects are estimated by solving the MLE
(nonlinear) with an iterative reweighted least squares such as
Fisher Scoring.
Bm+1 = Bm + (X WX)−1 X W∆(y − u)
where ui = g −1 (xi B ), g (ui ) = xi B, ∆ = {gu (ui )}, W = {wi },
2
wi = [υ(ui )gu (ui )]−1
GLMM Requires high dimensional integration to evaluate and
maximizing the likelihood cannot be computed explicitly
(hence not able to solve iteratively like GLM)
L=

fYi |u (yi |u)fU (u)du
i

Gota Morota

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Outline

1

Review of LM, GLM, LMM, GLMM

2

Numerical Integration for Solving GLMM

3

GLMM in R

Gota Morota

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Numerical Integration

Numerical Integration
Method for numerically approximating the value of a definite
integral
b

f (x )dx
a

Numerical integration for one-dimensional integrals
Rectangle rule
Trapezoidal rule
Simpson’s rule

Gota Morota

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Trapezoidal Rule
b

f (x )dx =

a

b −a
(f (x0 ) + 2f (x1 ) + 2f (x2 ) · · · + 2f (xn−1 ) + f (xn ))
2n

where
xk = a + k

b −a
n

for k = 0, 1, · · · , n

Figure 1: From Wikipedia http://en.wikipedia.org/wiki/Trapezoidal rule

Gota Morota

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Evaluation of the Integrals

There are various methods to do this:

Approximating the integral
Gauss-Hermite Quadrature
Laplace Approximation
Adaptive Gauss-Hermite Quadrature

Approximating the data
Penalized Quasi-Likelihood

Gota Morota

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Gauss-Hermite Quadrature I
yij |u ∼ indep. fYij |U (yij |u)
fYij |U (yij |u) = exp([yij γij − b (γij )]/γ2 − c (yij , γ))
E [yij |u] = µij
g (µij ) = xij B + ui , ui ∼ i.i.d. N (0, σ2 )
u
L=

fYij |Ui (yij |ui )fUi (ui )dui
i ,j

∞

=

e
i

j [yij γij −b (γij )]γ

−

j

c (yij ,γ) e

=

−ui2 /(2σ2 )
u

2πσ2
u

−∞

e −ui /(2σu )
2

∞

hi (ui )
i

2

−∞
Gota Morota

2

2πσ2
u

dui

Chapter 14: Computing

dui
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Gauss-Hermite Quadrature II
It be can seen that the likelihood is the product of one-dimensional
integrals of the form:
∞

h (u )

√

2

/(2σ2 )
u

du

2πσ2
u

−∞

changing u to

e −u

2σu υ gives:

∞

2

e −υ

∞

π

√

−∞

h ( 2σu υ) √ dυ ≡
−∞

√

√

where h ∗ (·) ≡ h ( 2σu ·)/ π
Gota Morota

2

h ∗ (υ)e −υ dυ

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Gauss-Hermite Quadrature III

Gauss-Hermite quadrature approximates the integral as a
weighted sum:
d

∞
∗

h (υ)e

−υ2

−∞

h ∗ (xk )wk

dυ
k =1

where wk is the weights, and the evaluation points, xk , are
designed to provide an accurate approximation in the case where
h ∗ (·) is a polynomial.

Gota Morota

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Constants for Gauss-Hermite Quadrature
Table 1: xk and wk for d = 3

d=3

xk
-1.22474487
0
1.22474487

wk
0.29540898
1.18163590
0.29540898

Formula for xk and wk
xk = ith zero of Hn (x )

√

wk =

2n−1 n! π
n2 [Hn−1 (xk )]2

Chapter 14: Computing
Gota polynomial of degree n.
where Hn (x ) is the Hermite Morota
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Gauss-Hermite Quadrature IV

Example
Approximation of integral using 3-point quadrature:
∞

2

(1 + x 2 )e −x dx

(1 + [−1.22474]2 )(0.29541)

−∞

+ (1 + 02 )(1.18164) + (1 + 1.224742 )(0.29541)
= 2.65868

Gota Morota

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Other Approximation Methods

Laplace Approximation
1

2
3
4

find a peak xpeak of the given integrand f (x ) by taking a
derivative
apply a second-order Taylor series expansion around this peak
calculate the variance σ = 1/f (xpeak )
approximate the f (x ) ∼ N (xk , σ2 )

Adaptive Gauss-Hermite Quadrature
1
apply centralization of the f (x ) about zero or standardization
Penalize-Quasi Likelihood
1

approximate the likelihood itself

Gota Morota

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Outline

1

Review of LM, GLM, LMM, GLMM

2

Numerical Integration for Solving GLMM

3

GLMM in R

Gota Morota

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

GLMM in R

Table 2: GLMM in R

glmmPQL (1)
glmmML (2)
glmer (3)
MCMCglmm (4)
1
2

Package
MASS
glmmML
lme4
MCMCglmm

Random Effect
intercept/coef
intercept
intercept/coef
intercept/coef

Computing Method
PQL 1
Laplace/AGQ 2
Laplace/AGQ 2
MCMC

Approximation to the likelihood
Numerical Integration

Numerical Integration & approximation to the likelihood
Can be used in Likelihood-based methods (1-3) or bayesian
approach (4) for obtaining the unknown parameters.
Gota Morota

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Simulation

PQL

AGQ

0.2

0.5

1.0

1.5

0.4

0.6

0.8

1.0

2.0

Laplace

pi =

1
1 + exp (−(4 + xi + γi ))

γ ∼ N (0, 32 )
0.5

1.0

1.5

2.0

Gota Morota

Chapter 14: Computing
Review of LM, GLM, LMM, GLMM
Numerical Integration for Solving GLMM
GLMM in R

Summary

AGQ: produces greater accuracy in the evaluation of the
log-likelihood
Laplace: special case of AGQ
PQL: typically ends up in biased estimates
Difficulty dealing with more complicated models

⇓
MCMC?

Gota Morota

Chapter 14: Computing

More Related Content

What's hot

[DL輪読会]陰関数微分を用いた深層学習
[DL輪読会]陰関数微分を用いた深層学習[DL輪読会]陰関数微分を用いた深層学習
[DL輪読会]陰関数微分を用いた深層学習Deep Learning JP
 
Linear transformations-thestuffpoint.com
Linear transformations-thestuffpoint.comLinear transformations-thestuffpoint.com
Linear transformations-thestuffpoint.comAbu Bakar Soomro
 
Dcs lec02 - z-transform
Dcs   lec02 - z-transformDcs   lec02 - z-transform
Dcs lec02 - z-transformAmr E. Mohamed
 
Context-Aware Recommender System Based on Boolean Matrix Factorisation
Context-Aware Recommender System Based on Boolean Matrix FactorisationContext-Aware Recommender System Based on Boolean Matrix Factorisation
Context-Aware Recommender System Based on Boolean Matrix FactorisationDmitrii Ignatov
 
Simulation of a_pmsm_motor_control_system
Simulation of a_pmsm_motor_control_systemSimulation of a_pmsm_motor_control_system
Simulation of a_pmsm_motor_control_systemmaheshwareshwar
 
Differential equation & laplace transformation with matlab
Differential equation & laplace transformation with matlabDifferential equation & laplace transformation with matlab
Differential equation & laplace transformation with matlabRavi Jindal
 
Signal Flow Graph ( control system)
Signal Flow Graph ( control system)Signal Flow Graph ( control system)
Signal Flow Graph ( control system)Gourab Ghosh
 
inverse z-transform ppt
inverse z-transform pptinverse z-transform ppt
inverse z-transform pptmihir jain
 
digital control Chapter 2 slide
digital control Chapter 2 slidedigital control Chapter 2 slide
digital control Chapter 2 slideasyrafjpk
 

What's hot (17)

Control chap10
Control chap10Control chap10
Control chap10
 
002 ray modeling dynamic systems
002 ray modeling dynamic systems002 ray modeling dynamic systems
002 ray modeling dynamic systems
 
[DL輪読会]陰関数微分を用いた深層学習
[DL輪読会]陰関数微分を用いた深層学習[DL輪読会]陰関数微分を用いた深層学習
[DL輪読会]陰関数微分を用いた深層学習
 
Linear transformations-thestuffpoint.com
Linear transformations-thestuffpoint.comLinear transformations-thestuffpoint.com
Linear transformations-thestuffpoint.com
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Simulation And Modelling
Simulation And ModellingSimulation And Modelling
Simulation And Modelling
 
Dcs lec02 - z-transform
Dcs   lec02 - z-transformDcs   lec02 - z-transform
Dcs lec02 - z-transform
 
Master method
Master methodMaster method
Master method
 
Context-Aware Recommender System Based on Boolean Matrix Factorisation
Context-Aware Recommender System Based on Boolean Matrix FactorisationContext-Aware Recommender System Based on Boolean Matrix Factorisation
Context-Aware Recommender System Based on Boolean Matrix Factorisation
 
Time complexity
Time complexityTime complexity
Time complexity
 
Simulation of a_pmsm_motor_control_system
Simulation of a_pmsm_motor_control_systemSimulation of a_pmsm_motor_control_system
Simulation of a_pmsm_motor_control_system
 
Differential equation & laplace transformation with matlab
Differential equation & laplace transformation with matlabDifferential equation & laplace transformation with matlab
Differential equation & laplace transformation with matlab
 
Master theorem
Master theoremMaster theorem
Master theorem
 
Signal Flow Graph ( control system)
Signal Flow Graph ( control system)Signal Flow Graph ( control system)
Signal Flow Graph ( control system)
 
inverse z-transform ppt
inverse z-transform pptinverse z-transform ppt
inverse z-transform ppt
 
digital control Chapter 2 slide
digital control Chapter 2 slidedigital control Chapter 2 slide
digital control Chapter 2 slide
 
Laplace transformation
Laplace transformationLaplace transformation
Laplace transformation
 

Viewers also liked

Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...
Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...
Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...Gota Morota
 
Chapter 12 Application of Gibbs Sampling in Variance Component Estimation and...
Chapter 12 Application of Gibbs Sampling in Variance Component Estimation and...Chapter 12 Application of Gibbs Sampling in Variance Component Estimation and...
Chapter 12 Application of Gibbs Sampling in Variance Component Estimation and...Gota Morota
 
Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...
Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...
Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...Gota Morota
 
Whole-genome prediction of complex traits using kernel methods
Whole-genome prediction of complex traits using kernel methodsWhole-genome prediction of complex traits using kernel methods
Whole-genome prediction of complex traits using kernel methodsGota Morota
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheLeslie Samuel
 

Viewers also liked (6)

Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...
Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...
Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...
 
Chapter 12 Application of Gibbs Sampling in Variance Component Estimation and...
Chapter 12 Application of Gibbs Sampling in Variance Component Estimation and...Chapter 12 Application of Gibbs Sampling in Variance Component Estimation and...
Chapter 12 Application of Gibbs Sampling in Variance Component Estimation and...
 
Catalogo.pdf meridional
Catalogo.pdf meridionalCatalogo.pdf meridional
Catalogo.pdf meridional
 
Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...
Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...
Application of Bayesian and Sparse Network Models for Assessing Linkage Diseq...
 
Whole-genome prediction of complex traits using kernel methods
Whole-genome prediction of complex traits using kernel methodsWhole-genome prediction of complex traits using kernel methods
Whole-genome prediction of complex traits using kernel methods
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
 

Similar to Chapter 14 Computing: McCulloch, CE, Searle SR and Neuhaus, JM 2008. Generalized, Linear and Mixed Models. John Wiley & Sons, New York. Second Edition.

hankel_norm approximation_fir_ ijc
hankel_norm approximation_fir_ ijchankel_norm approximation_fir_ ijc
hankel_norm approximation_fir_ ijcVasilis Tsoulkas
 
MM framework for RL
MM framework for RLMM framework for RL
MM framework for RLSung Yub Kim
 
Fuzzy logic based mrac for a second order system
Fuzzy logic based mrac for a second order systemFuzzy logic based mrac for a second order system
Fuzzy logic based mrac for a second order systemIAEME Publication
 
Fuzzy logic based mrac for a second order system
Fuzzy logic based mrac for a second order systemFuzzy logic based mrac for a second order system
Fuzzy logic based mrac for a second order systemIAEME Publication
 
Charged Lepton Flavour Violation in Left-Right Symmetric Model
Charged Lepton Flavour Violation in Left-Right Symmetric ModelCharged Lepton Flavour Violation in Left-Right Symmetric Model
Charged Lepton Flavour Violation in Left-Right Symmetric ModelSamim Ul Islam
 
Generalized Nonlinear Models in R
Generalized Nonlinear Models in RGeneralized Nonlinear Models in R
Generalized Nonlinear Models in Rhtstatistics
 
Bayesian Inference and Uncertainty Quantification for Inverse Problems
Bayesian Inference and Uncertainty Quantification for Inverse ProblemsBayesian Inference and Uncertainty Quantification for Inverse Problems
Bayesian Inference and Uncertainty Quantification for Inverse ProblemsMatt Moores
 
DUALITY THEORY FOR COMPOSITE GEOMETRIC PROGRAMMING
DUALITY THEORY FOR COMPOSITE GEOMETRIC PROGRAMMINGDUALITY THEORY FOR COMPOSITE GEOMETRIC PROGRAMMING
DUALITY THEORY FOR COMPOSITE GEOMETRIC PROGRAMMINGYa-Ping Wang
 
YaPingPresentation
YaPingPresentationYaPingPresentation
YaPingPresentationYa-Ping Wang
 
Numerical analysis m2 l4slides
Numerical analysis  m2 l4slidesNumerical analysis  m2 l4slides
Numerical analysis m2 l4slidesSHAMJITH KM
 

Similar to Chapter 14 Computing: McCulloch, CE, Searle SR and Neuhaus, JM 2008. Generalized, Linear and Mixed Models. John Wiley & Sons, New York. Second Edition. (20)

hankel_norm approximation_fir_ ijc
hankel_norm approximation_fir_ ijchankel_norm approximation_fir_ ijc
hankel_norm approximation_fir_ ijc
 
Asymtotic Appoach.ppt
Asymtotic Appoach.pptAsymtotic Appoach.ppt
Asymtotic Appoach.ppt
 
02-asymp.ppt
02-asymp.ppt02-asymp.ppt
02-asymp.ppt
 
MM framework for RL
MM framework for RLMM framework for RL
MM framework for RL
 
02 asymp
02 asymp02 asymp
02 asymp
 
Fuzzy logic based mrac for a second order system
Fuzzy logic based mrac for a second order systemFuzzy logic based mrac for a second order system
Fuzzy logic based mrac for a second order system
 
Fuzzy logic based mrac for a second order system
Fuzzy logic based mrac for a second order systemFuzzy logic based mrac for a second order system
Fuzzy logic based mrac for a second order system
 
DISCRETE LOGARITHMS.pdf
DISCRETE LOGARITHMS.pdfDISCRETE LOGARITHMS.pdf
DISCRETE LOGARITHMS.pdf
 
Charged Lepton Flavour Violation in Left-Right Symmetric Model
Charged Lepton Flavour Violation in Left-Right Symmetric ModelCharged Lepton Flavour Violation in Left-Right Symmetric Model
Charged Lepton Flavour Violation in Left-Right Symmetric Model
 
Generalized Nonlinear Models in R
Generalized Nonlinear Models in RGeneralized Nonlinear Models in R
Generalized Nonlinear Models in R
 
Lecture 16
Lecture 16Lecture 16
Lecture 16
 
Lecture2a algorithm
Lecture2a algorithmLecture2a algorithm
Lecture2a algorithm
 
Chapter 05
Chapter 05Chapter 05
Chapter 05
 
Bayesian Inference and Uncertainty Quantification for Inverse Problems
Bayesian Inference and Uncertainty Quantification for Inverse ProblemsBayesian Inference and Uncertainty Quantification for Inverse Problems
Bayesian Inference and Uncertainty Quantification for Inverse Problems
 
Lecture3(b).pdf
Lecture3(b).pdfLecture3(b).pdf
Lecture3(b).pdf
 
MUMS Opening Workshop - An Overview of Reduced-Order Models and Emulators (ED...
MUMS Opening Workshop - An Overview of Reduced-Order Models and Emulators (ED...MUMS Opening Workshop - An Overview of Reduced-Order Models and Emulators (ED...
MUMS Opening Workshop - An Overview of Reduced-Order Models and Emulators (ED...
 
DUALITY THEORY FOR COMPOSITE GEOMETRIC PROGRAMMING
DUALITY THEORY FOR COMPOSITE GEOMETRIC PROGRAMMINGDUALITY THEORY FOR COMPOSITE GEOMETRIC PROGRAMMING
DUALITY THEORY FOR COMPOSITE GEOMETRIC PROGRAMMING
 
YaPingPresentation
YaPingPresentationYaPingPresentation
YaPingPresentation
 
Numerical analysis m2 l4slides
Numerical analysis  m2 l4slidesNumerical analysis  m2 l4slides
Numerical analysis m2 l4slides
 
lecture6.ppt
lecture6.pptlecture6.ppt
lecture6.ppt
 

Recently uploaded

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Recently uploaded (20)

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

Chapter 14 Computing: McCulloch, CE, Searle SR and Neuhaus, JM 2008. Generalized, Linear and Mixed Models. John Wiley & Sons, New York. Second Edition.

  • 1. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Chapter 14: Computing Generalized, Linear, and Mixed Models Charles E. McCulloch, Shayle R. Searle, John M. Neuhaus Gota Morota May 4, 2010 Gota Morota Chapter 14: Computing
  • 2. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Outline 1 Review of LM, GLM, LMM, GLMM 2 Numerical Integration for Solving GLMM 3 GLMM in R Gota Morota Chapter 14: Computing
  • 3. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Linear Model and Linear Mixed Model LM: Solving the MLE with a least squares for fixed effects and simple formula for estimating residual variance. ˆ B = (X X)−1 X y RSS σ2 = ˆe N−p LMM Solving the MLE with a least squares for the fixed effects and random effects. Solving the MLE with a (RE)ML for the variance components. ˆ B = (X V−1 X)X V−1 y ˆ u = DZ V−1 (y − XB) Variance Components = (RE)ML coupled with iterative methods where D is Var(u), V is Var(y) = ZDZ + R Gota Morota Chapter 14: Computing
  • 4. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Generalized Linear Model and Generalized Linear Mixed Model GLM: Fixed effects are estimated by solving the MLE (nonlinear) with an iterative reweighted least squares such as Fisher Scoring. Bm+1 = Bm + (X WX)−1 X W∆(y − u) where ui = g −1 (xi B ), g (ui ) = xi B, ∆ = {gu (ui )}, W = {wi }, 2 wi = [υ(ui )gu (ui )]−1 GLMM Requires high dimensional integration to evaluate and maximizing the likelihood cannot be computed explicitly (hence not able to solve iteratively like GLM) L= fYi |u (yi |u)fU (u)du i Gota Morota Chapter 14: Computing
  • 5. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Outline 1 Review of LM, GLM, LMM, GLMM 2 Numerical Integration for Solving GLMM 3 GLMM in R Gota Morota Chapter 14: Computing
  • 6. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Numerical Integration Numerical Integration Method for numerically approximating the value of a definite integral b f (x )dx a Numerical integration for one-dimensional integrals Rectangle rule Trapezoidal rule Simpson’s rule Gota Morota Chapter 14: Computing
  • 7. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Trapezoidal Rule b f (x )dx = a b −a (f (x0 ) + 2f (x1 ) + 2f (x2 ) · · · + 2f (xn−1 ) + f (xn )) 2n where xk = a + k b −a n for k = 0, 1, · · · , n Figure 1: From Wikipedia http://en.wikipedia.org/wiki/Trapezoidal rule Gota Morota Chapter 14: Computing
  • 8. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Evaluation of the Integrals There are various methods to do this: Approximating the integral Gauss-Hermite Quadrature Laplace Approximation Adaptive Gauss-Hermite Quadrature Approximating the data Penalized Quasi-Likelihood Gota Morota Chapter 14: Computing
  • 9. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Gauss-Hermite Quadrature I yij |u ∼ indep. fYij |U (yij |u) fYij |U (yij |u) = exp([yij γij − b (γij )]/γ2 − c (yij , γ)) E [yij |u] = µij g (µij ) = xij B + ui , ui ∼ i.i.d. N (0, σ2 ) u L= fYij |Ui (yij |ui )fUi (ui )dui i ,j ∞ = e i j [yij γij −b (γij )]γ − j c (yij ,γ) e = −ui2 /(2σ2 ) u 2πσ2 u −∞ e −ui /(2σu ) 2 ∞ hi (ui ) i 2 −∞ Gota Morota 2 2πσ2 u dui Chapter 14: Computing dui
  • 10. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Gauss-Hermite Quadrature II It be can seen that the likelihood is the product of one-dimensional integrals of the form: ∞ h (u ) √ 2 /(2σ2 ) u du 2πσ2 u −∞ changing u to e −u 2σu υ gives: ∞ 2 e −υ ∞ π √ −∞ h ( 2σu υ) √ dυ ≡ −∞ √ √ where h ∗ (·) ≡ h ( 2σu ·)/ π Gota Morota 2 h ∗ (υ)e −υ dυ Chapter 14: Computing
  • 11. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Gauss-Hermite Quadrature III Gauss-Hermite quadrature approximates the integral as a weighted sum: d ∞ ∗ h (υ)e −υ2 −∞ h ∗ (xk )wk dυ k =1 where wk is the weights, and the evaluation points, xk , are designed to provide an accurate approximation in the case where h ∗ (·) is a polynomial. Gota Morota Chapter 14: Computing
  • 12. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Constants for Gauss-Hermite Quadrature Table 1: xk and wk for d = 3 d=3 xk -1.22474487 0 1.22474487 wk 0.29540898 1.18163590 0.29540898 Formula for xk and wk xk = ith zero of Hn (x ) √ wk = 2n−1 n! π n2 [Hn−1 (xk )]2 Chapter 14: Computing Gota polynomial of degree n. where Hn (x ) is the Hermite Morota
  • 13. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Gauss-Hermite Quadrature IV Example Approximation of integral using 3-point quadrature: ∞ 2 (1 + x 2 )e −x dx (1 + [−1.22474]2 )(0.29541) −∞ + (1 + 02 )(1.18164) + (1 + 1.224742 )(0.29541) = 2.65868 Gota Morota Chapter 14: Computing
  • 14. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Other Approximation Methods Laplace Approximation 1 2 3 4 find a peak xpeak of the given integrand f (x ) by taking a derivative apply a second-order Taylor series expansion around this peak calculate the variance σ = 1/f (xpeak ) approximate the f (x ) ∼ N (xk , σ2 ) Adaptive Gauss-Hermite Quadrature 1 apply centralization of the f (x ) about zero or standardization Penalize-Quasi Likelihood 1 approximate the likelihood itself Gota Morota Chapter 14: Computing
  • 15. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Outline 1 Review of LM, GLM, LMM, GLMM 2 Numerical Integration for Solving GLMM 3 GLMM in R Gota Morota Chapter 14: Computing
  • 16. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R GLMM in R Table 2: GLMM in R glmmPQL (1) glmmML (2) glmer (3) MCMCglmm (4) 1 2 Package MASS glmmML lme4 MCMCglmm Random Effect intercept/coef intercept intercept/coef intercept/coef Computing Method PQL 1 Laplace/AGQ 2 Laplace/AGQ 2 MCMC Approximation to the likelihood Numerical Integration Numerical Integration & approximation to the likelihood Can be used in Likelihood-based methods (1-3) or bayesian approach (4) for obtaining the unknown parameters. Gota Morota Chapter 14: Computing
  • 17. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Simulation PQL AGQ 0.2 0.5 1.0 1.5 0.4 0.6 0.8 1.0 2.0 Laplace pi = 1 1 + exp (−(4 + xi + γi )) γ ∼ N (0, 32 ) 0.5 1.0 1.5 2.0 Gota Morota Chapter 14: Computing
  • 18. Review of LM, GLM, LMM, GLMM Numerical Integration for Solving GLMM GLMM in R Summary AGQ: produces greater accuracy in the evaluation of the log-likelihood Laplace: special case of AGQ PQL: typically ends up in biased estimates Difficulty dealing with more complicated models ⇓ MCMC? Gota Morota Chapter 14: Computing