SlideShare a Scribd company logo
1 of 35
Download to read offline
Formulation of model likelihood functions
The most useful representation of stochastic models
June 12, 2017
Andreas Scheidegger
Eawag: Swiss Federal Institute of Aquatic Science and Technology
Statistical models are stories about how the data
came to be – Dave Harris
Andreas Scheidegger Motivation 1
What is a likelihood function?
Definition
The likelihood function p(y1, . . . , yn|θ) or L(θ) is the joint
probability (density) of observations {y1, . . . yn} given a stochastic
model with parameter values θ.
Andreas Scheidegger Motivation 2
What is a likelihood function?
Definition
The likelihood function p(y1, . . . , yn|θ) or L(θ) is the joint
probability (density) of observations {y1, . . . yn} given a stochastic
model with parameter values θ.
Informal
If we simulate output data similar to my measurements with a
stochastic model while setting the parameters equal θ, what is the
probability (density) that we obtain {y1, . . . yn}?
Andreas Scheidegger Motivation 2
For what do we need likelihood functions?
Many parameter calibration and predictions techniques require that
the model is described by its likelihood function:
Frequentist statistics:
Maximum likelihood estimator (MLE), LR-tests, . . .
Bayesian statistics:
Parameter inference, uncertainty propagation,
predictions, model comparison, . . .
→ topic of this course
Note: The actual value of the likelihood function per se is usually not of
interest.
Andreas Scheidegger Motivation 3
How to formulate likelihood functions?
Often, models are not described by the likelihood function.
A common description may rather look like this:
Yi = M(xi , θ) + i , i ∼ N(0, σ2
)
While this a complete description of the stochastic model1, it is
not directly useful for inference → we must translate such a
description into p(y|θ, x).
1
M(xi , θ) is a deterministic function. The complete model, however, is
stochastic because we added a random error term i .
Andreas Scheidegger Motivation 4
Derivation of a likelihood function
1. Decompose the joint probability density:
p(y|θ) = p(y1, . . . , yn|θ) = p(y1|θ)p(y2|θ, y1)p(y3|θ, y1, y2)
. . . p(yn|θ, y1, . . . , yn−1)
2. Formulate the conditional probabilities:
p(yi |θ, y1, . . . , yi−1)
If the observations are independent:
p(yi |θ, y1, . . . , yi−1) = p(yi |θ).
Andreas Scheidegger Derivation of p(y|θ) 5
Some (informal) advices
• Formulate first the likelihood general without specific
distribution assumptions.
• Think (informally!) p(x) as Prob(X = x) and change sums to
integrals.
• Practically, a function that is proportional to the likelihood
function is sufficient.
• The logarithmic scale is prefered for computation.
• Don’t care about identifiability of the parameters at this stage.
Andreas Scheidegger Derivation of p(y|θ) 6
Example 1: sex ratio
discrete data
Observed data y
The gender of n newborns.
Model description
We assume the probability for
girl is θ and for boy 1 − θ.
Andreas Scheidegger Examples 7
Example 1: sex ratio
discrete data
Probability for a single observation:
Prob(yi |θ) =
θ, yi = girl
1 − θ, yi = boy
Andreas Scheidegger Examples 8
Example 1: sex ratio
discrete data
Probability for a single observation:
Prob(yi |θ) =
θ, yi = girl
1 − θ, yi = boy
Independence is a reasonable assumption:
Prob(y1, . . . , yn|θ) =
n
i=1
Prob(yi |θ)
= θ#girls
(1 − θ)#boys
Andreas Scheidegger Examples 8
Example 1: sex ratio
discrete data
R implementation as function:
logL <- function(theta, n.girls, n.boys) {
LL <- n.girls*log(theta) + n.boys*log(1-theta)
return(LL)
}
Call:
logL(theta=0.4, n.girls=10, n.boys=5)
> -11.717035
Andreas Scheidegger Examples 9
Example 2: rating curve
continuous data
Observed data y, x
n pairs of water level xi and
run-off yi .
Figure: Rating curve of Sluzew
Creek. Sikorska et al. (2013)
Andreas Scheidegger Examples 10
Example 2: rating curve
continuous data
Observed data y, x
n pairs of water level xi and
run-off yi .
Model description
Water level x and run-off y are
related as
y = RC(x, θ) = θ1(x − θ2)θ3
Figure: Rating curve of Sluzew
Creek. Sikorska et al. (2013)
Andreas Scheidegger Examples 10
Example 2: rating curve
continuous data
A deterministic model?
→ We must make assumptions
about the error distribution. E.g.,
Yi = RC(xi , θ) + i , i ∼ N(0, σ2
)
or equivalent
Yi ∼ N RC(xi , θ), σ2
The RC model describes only the
expected value of an observation
for a given xi .
2
φ(x) = 1√
2π
exp{−x2
2
}
Andreas Scheidegger Examples 11
Example 2: rating curve
continuous data
A deterministic model?
→ We must make assumptions
about the error distribution. E.g.,
Yi = RC(xi , θ) + i , i ∼ N(0, σ2
)
or equivalent
Yi ∼ N RC(xi , θ), σ2
The RC model describes only the
expected value of an observation
for a given xi .
So the pdf for a single
observation is the density of a
normal distribution2
p(yi |xi , θ, σ) =
1
σ
φ
yi − RC(xi , θ)
σ
2
φ(x) = 1√
2π
exp{−x2
2
}
Andreas Scheidegger Examples 11
Example 2: rating curve
continuous data
A deterministic model?
→ We must make assumptions
about the error distribution. E.g.,
Yi = RC(xi , θ) + i , i ∼ N(0, σ2
)
or equivalent
Yi ∼ N RC(xi , θ), σ2
The RC model describes only the
expected value of an observation
for a given xi .
So the pdf for a single
observation is the density of a
normal distribution2
p(yi |xi , θ, σ) =
1
σ
φ
yi − RC(xi , θ)
σ
Finally, assuming independent
observations
p(y1, . . . , yn|x1, . . . , xn, θ, σ)
=
n
i=1
p(yi |xi , θ, σ)
2
φ(x) = 1√
2π
exp{−x2
2
}
Andreas Scheidegger Examples 11
Example 2: rating curve
continuous data
Figure: Rating curve. Example of a non-linear regression.
Andreas Scheidegger Examples 12
Example 2: rating curve
continuous data
Figure: Rating curve. Example of a non-linear regression.
Andreas Scheidegger Examples 12
Example 2: rating curve
continuous data
X (water level)
Y(runoff)
RC(X,θ)
Figure: Rating curve. Example of a non-linear regression.
Andreas Scheidegger Examples 12
Example 2: rating curve
continuous data
## deterministic raiting curve model
RC <- function(x, theta) {
y <- theta[1]*(x-theta[2])^theta[3]
return(y)
}
## log likelihood with normal distributed errors
## sigma is included as theta[4]=sigma.
logL <- function(theta, y.data, x.data) {
mean.y <- RC(x.data, theta[1:3]) # mean value for y
LL <- sum(dnorm(y.data, mean=mean.y,
sd=theta[4], log=TRUE))
return(LL)
}
Andreas Scheidegger Examples 13
Example 3: limit of quantification
censored data
Observed data y
lab 1 lab 2 lab 3 . . .
concentration y1 y2 n.d. . . .
Limit of quantification: LOQ
standard deviation of measurements: σ
Model description
“A model? I just want to calculate the
concentration.”
Andreas Scheidegger Examples 14
Example 3: limit of quantification
censored data
Figure: Left censored data.
Model description
The measurements are normal
distributed around the true mean
θ with standard deviation σ.
Andreas Scheidegger Examples 15
Example 3: limit of quantification
censored data
Figure: Left censored data.
Model description
The measurements are normal
distributed around the true mean
θ with standard deviation σ.
Andreas Scheidegger Examples 15
Example 3: limit of quantification
censored data
Figure: Left censored data.
Model description
The measurements are normal
distributed around the true mean
θ with standard deviation σ.
Andreas Scheidegger Examples 15
Example 3: limit of quantification
censored data
Likelihood for a single measured observation:
p(yi |θ, σ) = φ
yi − θ
σ
Andreas Scheidegger Examples 16
Example 3: limit of quantification
censored data
Likelihood for a single measured observation:
p(yi |θ, σ) = φ
yi − θ
σ
Likelihood for a single “not detected” observation:
Prob(n.d.|θ, σ) = Prob(yi < LOQ|θ, σ) =
LOQ
0
p(y|θ, σ) dy
=Φ
LOQ − θ
σ
Andreas Scheidegger Examples 16
Example 3: limit of quantification
censored data
Likelihood for a single measured observation:
p(yi |θ, σ) = φ
yi − θ
σ
Likelihood for a single “not detected” observation:
Prob(n.d.|θ, σ) = Prob(yi < LOQ|θ, σ) =
LOQ
0
p(y|θ, σ) dy
=Φ
LOQ − θ
σ
p(y1, . . . , yn|θ, σ) = Prob(yi < LOQ|θ, σ)#censored
¬censored
p(yi |θ, σ)
Andreas Scheidegger Examples 16
Example 3: limit of quantification
censored data
## data, if left censored = "nd"
y <- c(y1=0.35, y2=0.45, y3="nd", y4="nd", y5=0.4)
## log likelihood
logL <- function(theta, y, sigma, LOQ) {
## number of censored observations
n.censored <- sum(y=="nd")
## convert not censored observations into type ’numeric’
y.not.cen <- as.numeric(y[y!="nd"])
## likelihood for not censored observations
LL.not.cen <- sum(dnorm(y.not.cen, mean=theta, sd=sigma, log=TRUE))
## likelihood for left censored observations
LL.left.cen <- n.censored * pnorm(LOQ, mean=theta, sd=sigma, log=TRUE)
return(LL.not.cen + LL.left.cen)
}
Andreas Scheidegger Examples 17
Example 4: auto-regressive model
auto-correlated data
Observed data y
equally spaced time series data y1, . . . , yn.
Model description
Classical AR(1) model:
yt+1 = θyt + t+1, t+1 ∼ N(0, σ2
)
y0 = k
Time
waterlevel[feet]
1880 1920 1960
576
577
578
579
580
581
582
Figure: Annual water
level of Lake Huron.
Brockwell and Davis
(1991)
Andreas Scheidegger Examples 18
Example 4: auto-regressive model
auto-correlated data
Observations are only dependent on the preceding observation.
Hence:
p(y1, . . . , yn|θ, σ, y0) =
n
i=1
p(yi |yi−1, θ, σ)
LL <- dnorm(y[1], k, sigma, log=TRUE) +
sum(dnorm(y[2:n], mean=theta*y[1:(n-1)],
sd=sigma, log=TRUE))
Andreas Scheidegger Examples 19
Example 4: auto-regressive model
auto-correlated data
Observations are only dependent on the preceding observation.
Hence:
p(y1, . . . , yn|θ, σ, y0) =
n
i=1
p(yi |yi−1, θ, σ)
The conditional probabilities are all normal
p(yt|y0, . . . , yt−1, θ, σ) = p(yt|yt−1, θ, σ) = φ
yt − θyt−1
σ
LL <- dnorm(y[1], k, sigma, log=TRUE) +
sum(dnorm(y[2:n], mean=theta*y[1:(n-1)],
sd=sigma, log=TRUE))
Andreas Scheidegger Examples 19
Normality and “iid.”
Reality is normally not normal distributed
Typical statistical assumption, such as
• normality
• independence
are often chosen from a computational view point.
However, other distribution assumptions can be
incorporated easily in most cases.
Andreas Scheidegger General remarks 20
Rating curve modified
Lets assume we observe more extreme values than compatible with
a normal distribution → try t-distribution.
## log likelihood with t-distributed errors
## theta[4]=scale, theta[5]=degree of freedom.
logL <- function(theta, y.data, x.data) {
mean.y <- RC(x.data, theta[1:3]) # mean value for y
residuals <- (y.data - mean.y)/theta[4] # scaling
LL <- sum(dt(residuals, df=theta[5], log=TRUE))
return(LL)
}
Andreas Scheidegger General remarks 21
Summary
1. Decompose the joint probability density:
p(y|θ) = p(y1, . . . , yn|θ) = p(y1|θ)p(y2|θ, y1)p(y3|θ, y1, y2)
. . . p(yn|θ, y1, . . . yn−1)
2. Make assumptions to formulate the conditional probabilities:
p(yi |θ, y1, . . . yi−1)
3. Make inference, check assumptions, revise if necessary.
Andreas Scheidegger General remarks 22

More Related Content

What's hot

Accelerating Metropolis Hastings with Lightweight Inference Compilation
Accelerating Metropolis Hastings with Lightweight Inference CompilationAccelerating Metropolis Hastings with Lightweight Inference Compilation
Accelerating Metropolis Hastings with Lightweight Inference CompilationFeynman Liang
 
Jam 2006 Test Papers Mathematical Statistics
Jam 2006 Test Papers Mathematical StatisticsJam 2006 Test Papers Mathematical Statistics
Jam 2006 Test Papers Mathematical Statisticsashu29
 
効率的反実仮想学習
効率的反実仮想学習効率的反実仮想学習
効率的反実仮想学習Masa Kato
 
Nonparametric testing for exogeneity with discrete regressors and instruments
Nonparametric testing for exogeneity with discrete regressors and instrumentsNonparametric testing for exogeneity with discrete regressors and instruments
Nonparametric testing for exogeneity with discrete regressors and instrumentsGRAPE
 
Path relinking for high dimensional continuous optimization
Path relinking for high dimensional continuous optimizationPath relinking for high dimensional continuous optimization
Path relinking for high dimensional continuous optimizationPatxi Gortázar
 
Model Selection with Piecewise Regular Gauges
Model Selection with Piecewise Regular GaugesModel Selection with Piecewise Regular Gauges
Model Selection with Piecewise Regular GaugesGabriel Peyré
 
AN ALPHA -CUT OPERATION IN A TRANSPORTATION PROBLEM USING SYMMETRIC HEXAGONAL...
AN ALPHA -CUT OPERATION IN A TRANSPORTATION PROBLEM USING SYMMETRIC HEXAGONAL...AN ALPHA -CUT OPERATION IN A TRANSPORTATION PROBLEM USING SYMMETRIC HEXAGONAL...
AN ALPHA -CUT OPERATION IN A TRANSPORTATION PROBLEM USING SYMMETRIC HEXAGONAL...ijfls
 
GradStudentSeminarSept30
GradStudentSeminarSept30GradStudentSeminarSept30
GradStudentSeminarSept30Ryan White
 
Reinforcement Learning: Hidden Theory and New Super-Fast Algorithms
Reinforcement Learning: Hidden Theory and New Super-Fast AlgorithmsReinforcement Learning: Hidden Theory and New Super-Fast Algorithms
Reinforcement Learning: Hidden Theory and New Super-Fast AlgorithmsSean Meyn
 
Introducing Zap Q-Learning
Introducing Zap Q-Learning   Introducing Zap Q-Learning
Introducing Zap Q-Learning Sean Meyn
 
Machine Learning for Actuaries
Machine Learning for ActuariesMachine Learning for Actuaries
Machine Learning for ActuariesArthur Charpentier
 
Introduction to Stochastic calculus
Introduction to Stochastic calculusIntroduction to Stochastic calculus
Introduction to Stochastic calculusAshwin Rao
 

What's hot (20)

Accelerating Metropolis Hastings with Lightweight Inference Compilation
Accelerating Metropolis Hastings with Lightweight Inference CompilationAccelerating Metropolis Hastings with Lightweight Inference Compilation
Accelerating Metropolis Hastings with Lightweight Inference Compilation
 
Jam 2006 Test Papers Mathematical Statistics
Jam 2006 Test Papers Mathematical StatisticsJam 2006 Test Papers Mathematical Statistics
Jam 2006 Test Papers Mathematical Statistics
 
効率的反実仮想学習
効率的反実仮想学習効率的反実仮想学習
効率的反実仮想学習
 
Nonparametric testing for exogeneity with discrete regressors and instruments
Nonparametric testing for exogeneity with discrete regressors and instrumentsNonparametric testing for exogeneity with discrete regressors and instruments
Nonparametric testing for exogeneity with discrete regressors and instruments
 
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
 
Path relinking for high dimensional continuous optimization
Path relinking for high dimensional continuous optimizationPath relinking for high dimensional continuous optimization
Path relinking for high dimensional continuous optimization
 
PMED Opening Workshop - Inference on Individualized Treatment Rules from Obse...
PMED Opening Workshop - Inference on Individualized Treatment Rules from Obse...PMED Opening Workshop - Inference on Individualized Treatment Rules from Obse...
PMED Opening Workshop - Inference on Individualized Treatment Rules from Obse...
 
PMED Transition Workshop - Non-parametric Techniques for Estimating Tumor Het...
PMED Transition Workshop - Non-parametric Techniques for Estimating Tumor Het...PMED Transition Workshop - Non-parametric Techniques for Estimating Tumor Het...
PMED Transition Workshop - Non-parametric Techniques for Estimating Tumor Het...
 
Model Selection with Piecewise Regular Gauges
Model Selection with Piecewise Regular GaugesModel Selection with Piecewise Regular Gauges
Model Selection with Piecewise Regular Gauges
 
AN ALPHA -CUT OPERATION IN A TRANSPORTATION PROBLEM USING SYMMETRIC HEXAGONAL...
AN ALPHA -CUT OPERATION IN A TRANSPORTATION PROBLEM USING SYMMETRIC HEXAGONAL...AN ALPHA -CUT OPERATION IN A TRANSPORTATION PROBLEM USING SYMMETRIC HEXAGONAL...
AN ALPHA -CUT OPERATION IN A TRANSPORTATION PROBLEM USING SYMMETRIC HEXAGONAL...
 
Lausanne 2019 #4
Lausanne 2019 #4Lausanne 2019 #4
Lausanne 2019 #4
 
Main
MainMain
Main
 
Analysis of data
Analysis of dataAnalysis of data
Analysis of data
 
GradStudentSeminarSept30
GradStudentSeminarSept30GradStudentSeminarSept30
GradStudentSeminarSept30
 
Reinforcement Learning: Hidden Theory and New Super-Fast Algorithms
Reinforcement Learning: Hidden Theory and New Super-Fast AlgorithmsReinforcement Learning: Hidden Theory and New Super-Fast Algorithms
Reinforcement Learning: Hidden Theory and New Super-Fast Algorithms
 
Introducing Zap Q-Learning
Introducing Zap Q-Learning   Introducing Zap Q-Learning
Introducing Zap Q-Learning
 
Machine Learning for Actuaries
Machine Learning for ActuariesMachine Learning for Actuaries
Machine Learning for Actuaries
 
Introduction to Stochastic calculus
Introduction to Stochastic calculusIntroduction to Stochastic calculus
Introduction to Stochastic calculus
 
Stochastic calculus
Stochastic calculus Stochastic calculus
Stochastic calculus
 
Side 2019 #9
Side 2019 #9Side 2019 #9
Side 2019 #9
 

Similar to Formulation of model likelihood functions

Regression on gaussian symbols
Regression on gaussian symbolsRegression on gaussian symbols
Regression on gaussian symbolsAxel de Romblay
 
Linear regression without tears
Linear regression without tearsLinear regression without tears
Linear regression without tearsAnkit Sharma
 
Efficient Analysis of high-dimensional data in tensor formats
Efficient Analysis of high-dimensional data in tensor formatsEfficient Analysis of high-dimensional data in tensor formats
Efficient Analysis of high-dimensional data in tensor formatsAlexander Litvinenko
 
Session II - Estimation methods and accuracy Li-Chun Zhang Discussion: Sess...
Session II - Estimation methods and accuracy   Li-Chun Zhang Discussion: Sess...Session II - Estimation methods and accuracy   Li-Chun Zhang Discussion: Sess...
Session II - Estimation methods and accuracy Li-Chun Zhang Discussion: Sess...Istituto nazionale di statistica
 
Estimation Theory, PhD Course, Ghent University, Belgium
Estimation Theory, PhD Course, Ghent University, BelgiumEstimation Theory, PhD Course, Ghent University, Belgium
Estimation Theory, PhD Course, Ghent University, BelgiumStijn De Vuyst
 
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...Gabriel Peyré
 
Low Complexity Regularization of Inverse Problems
Low Complexity Regularization of Inverse ProblemsLow Complexity Regularization of Inverse Problems
Low Complexity Regularization of Inverse ProblemsGabriel Peyré
 
Supervised Prediction of Graph Summaries
Supervised Prediction of Graph SummariesSupervised Prediction of Graph Summaries
Supervised Prediction of Graph SummariesDaniil Mirylenka
 
Error analysis statistics
Error analysis   statisticsError analysis   statistics
Error analysis statisticsTarun Gehlot
 
Ch 4 Slides.doc655444444444444445678888776
Ch 4 Slides.doc655444444444444445678888776Ch 4 Slides.doc655444444444444445678888776
Ch 4 Slides.doc655444444444444445678888776ohenebabismark508
 
Spatial Point Processes and Their Applications in Epidemiology
Spatial Point Processes and Their Applications in EpidemiologySpatial Point Processes and Their Applications in Epidemiology
Spatial Point Processes and Their Applications in EpidemiologyLilac Liu Xu
 
Anti-differentiating Approximation Algorithms: PageRank and MinCut
Anti-differentiating Approximation Algorithms: PageRank and MinCutAnti-differentiating Approximation Algorithms: PageRank and MinCut
Anti-differentiating Approximation Algorithms: PageRank and MinCutDavid Gleich
 

Similar to Formulation of model likelihood functions (20)

Regression on gaussian symbols
Regression on gaussian symbolsRegression on gaussian symbols
Regression on gaussian symbols
 
Linear regression without tears
Linear regression without tearsLinear regression without tears
Linear regression without tears
 
Efficient Analysis of high-dimensional data in tensor formats
Efficient Analysis of high-dimensional data in tensor formatsEfficient Analysis of high-dimensional data in tensor formats
Efficient Analysis of high-dimensional data in tensor formats
 
lec2_CS540_handouts.pdf
lec2_CS540_handouts.pdflec2_CS540_handouts.pdf
lec2_CS540_handouts.pdf
 
Session II - Estimation methods and accuracy Li-Chun Zhang Discussion: Sess...
Session II - Estimation methods and accuracy   Li-Chun Zhang Discussion: Sess...Session II - Estimation methods and accuracy   Li-Chun Zhang Discussion: Sess...
Session II - Estimation methods and accuracy Li-Chun Zhang Discussion: Sess...
 
pattern recognition
pattern recognition pattern recognition
pattern recognition
 
Chapter1
Chapter1Chapter1
Chapter1
 
002.decision trees
002.decision trees002.decision trees
002.decision trees
 
Estimation Theory, PhD Course, Ghent University, Belgium
Estimation Theory, PhD Course, Ghent University, BelgiumEstimation Theory, PhD Course, Ghent University, Belgium
Estimation Theory, PhD Course, Ghent University, Belgium
 
Slides ACTINFO 2016
Slides ACTINFO 2016Slides ACTINFO 2016
Slides ACTINFO 2016
 
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
Low Complexity Regularization of Inverse Problems - Course #2 Recovery Guaran...
 
Ullmayer_Rodriguez_Presentation
Ullmayer_Rodriguez_PresentationUllmayer_Rodriguez_Presentation
Ullmayer_Rodriguez_Presentation
 
Low Complexity Regularization of Inverse Problems
Low Complexity Regularization of Inverse ProblemsLow Complexity Regularization of Inverse Problems
Low Complexity Regularization of Inverse Problems
 
Randomized algorithms ver 1.0
Randomized algorithms ver 1.0Randomized algorithms ver 1.0
Randomized algorithms ver 1.0
 
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
 
Supervised Prediction of Graph Summaries
Supervised Prediction of Graph SummariesSupervised Prediction of Graph Summaries
Supervised Prediction of Graph Summaries
 
Error analysis statistics
Error analysis   statisticsError analysis   statistics
Error analysis statistics
 
Ch 4 Slides.doc655444444444444445678888776
Ch 4 Slides.doc655444444444444445678888776Ch 4 Slides.doc655444444444444445678888776
Ch 4 Slides.doc655444444444444445678888776
 
Spatial Point Processes and Their Applications in Epidemiology
Spatial Point Processes and Their Applications in EpidemiologySpatial Point Processes and Their Applications in Epidemiology
Spatial Point Processes and Their Applications in Epidemiology
 
Anti-differentiating Approximation Algorithms: PageRank and MinCut
Anti-differentiating Approximation Algorithms: PageRank and MinCutAnti-differentiating Approximation Algorithms: PageRank and MinCut
Anti-differentiating Approximation Algorithms: PageRank and MinCut
 

More from Andreas Scheidegger

Bayesian End-Member Mixing Model
Bayesian End-Member Mixing ModelBayesian End-Member Mixing Model
Bayesian End-Member Mixing ModelAndreas Scheidegger
 
Recurrent Neuronal Network tailored for Weather Radar Nowcasting
Recurrent Neuronal Network tailored for Weather Radar NowcastingRecurrent Neuronal Network tailored for Weather Radar Nowcasting
Recurrent Neuronal Network tailored for Weather Radar NowcastingAndreas Scheidegger
 
Kalibrierung von Kanalnetzmodellen mit binären Messdaten
Kalibrierung von Kanalnetzmodellen mit binären MessdatenKalibrierung von Kanalnetzmodellen mit binären Messdaten
Kalibrierung von Kanalnetzmodellen mit binären MessdatenAndreas Scheidegger
 
Experimental design approach for optimal selection and placement of rain sensors
Experimental design approach for optimal selection and placement of rain sensorsExperimental design approach for optimal selection and placement of rain sensors
Experimental design approach for optimal selection and placement of rain sensorsAndreas Scheidegger
 
Bayesian assimilation of rainfall sensors with fundamentally different integr...
Bayesian assimilation of rainfall sensors with fundamentally different integr...Bayesian assimilation of rainfall sensors with fundamentally different integr...
Bayesian assimilation of rainfall sensors with fundamentally different integr...Andreas Scheidegger
 
New information sources for rain fields
New information sources for rain fieldsNew information sources for rain fields
New information sources for rain fieldsAndreas Scheidegger
 

More from Andreas Scheidegger (8)

Bayesian End-Member Mixing Model
Bayesian End-Member Mixing ModelBayesian End-Member Mixing Model
Bayesian End-Member Mixing Model
 
Sensitivity analysis
Sensitivity analysisSensitivity analysis
Sensitivity analysis
 
Review of probability calculus
Review of probability calculusReview of probability calculus
Review of probability calculus
 
Recurrent Neuronal Network tailored for Weather Radar Nowcasting
Recurrent Neuronal Network tailored for Weather Radar NowcastingRecurrent Neuronal Network tailored for Weather Radar Nowcasting
Recurrent Neuronal Network tailored for Weather Radar Nowcasting
 
Kalibrierung von Kanalnetzmodellen mit binären Messdaten
Kalibrierung von Kanalnetzmodellen mit binären MessdatenKalibrierung von Kanalnetzmodellen mit binären Messdaten
Kalibrierung von Kanalnetzmodellen mit binären Messdaten
 
Experimental design approach for optimal selection and placement of rain sensors
Experimental design approach for optimal selection and placement of rain sensorsExperimental design approach for optimal selection and placement of rain sensors
Experimental design approach for optimal selection and placement of rain sensors
 
Bayesian assimilation of rainfall sensors with fundamentally different integr...
Bayesian assimilation of rainfall sensors with fundamentally different integr...Bayesian assimilation of rainfall sensors with fundamentally different integr...
Bayesian assimilation of rainfall sensors with fundamentally different integr...
 
New information sources for rain fields
New information sources for rain fieldsNew information sources for rain fields
New information sources for rain fields
 

Recently uploaded

Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisDiwakar Mishra
 
Animal Communication- Auditory and Visual.pptx
Animal Communication- Auditory and Visual.pptxAnimal Communication- Auditory and Visual.pptx
Animal Communication- Auditory and Visual.pptxUmerFayaz5
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bSérgio Sacani
 
Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksSérgio Sacani
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...Sérgio Sacani
 
Boyles law module in the grade 10 science
Boyles law module in the grade 10 scienceBoyles law module in the grade 10 science
Boyles law module in the grade 10 sciencefloriejanemacaya1
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsSérgio Sacani
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡anilsa9823
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhousejana861314
 
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...Sérgio Sacani
 
GFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxGFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxAleenaTreesaSaji
 
Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Nistarini College, Purulia (W.B) India
 
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |aasikanpl
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...RohitNehra6
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRDelhi Call girls
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCEPRINCE C P
 
G9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.pptG9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.pptMAESTRELLAMesa2
 
Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxgindu3009
 

Recently uploaded (20)

Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
 
Animal Communication- Auditory and Visual.pptx
Animal Communication- Auditory and Visual.pptxAnimal Communication- Auditory and Visual.pptx
Animal Communication- Auditory and Visual.pptx
 
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43bNightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
Nightside clouds and disequilibrium chemistry on the hot Jupiter WASP-43b
 
Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disks
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
 
The Philosophy of Science
The Philosophy of ScienceThe Philosophy of Science
The Philosophy of Science
 
Boyles law module in the grade 10 science
Boyles law module in the grade 10 scienceBoyles law module in the grade 10 science
Boyles law module in the grade 10 science
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhouse
 
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
 
CELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdfCELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdf
 
GFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxGFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptx
 
Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...
 
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
 
G9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.pptG9 Science Q4- Week 1-2 Projectile Motion.ppt
G9 Science Q4- Week 1-2 Projectile Motion.ppt
 
Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptx
 

Formulation of model likelihood functions

  • 1. Formulation of model likelihood functions The most useful representation of stochastic models June 12, 2017 Andreas Scheidegger Eawag: Swiss Federal Institute of Aquatic Science and Technology
  • 2. Statistical models are stories about how the data came to be – Dave Harris Andreas Scheidegger Motivation 1
  • 3. What is a likelihood function? Definition The likelihood function p(y1, . . . , yn|θ) or L(θ) is the joint probability (density) of observations {y1, . . . yn} given a stochastic model with parameter values θ. Andreas Scheidegger Motivation 2
  • 4. What is a likelihood function? Definition The likelihood function p(y1, . . . , yn|θ) or L(θ) is the joint probability (density) of observations {y1, . . . yn} given a stochastic model with parameter values θ. Informal If we simulate output data similar to my measurements with a stochastic model while setting the parameters equal θ, what is the probability (density) that we obtain {y1, . . . yn}? Andreas Scheidegger Motivation 2
  • 5. For what do we need likelihood functions? Many parameter calibration and predictions techniques require that the model is described by its likelihood function: Frequentist statistics: Maximum likelihood estimator (MLE), LR-tests, . . . Bayesian statistics: Parameter inference, uncertainty propagation, predictions, model comparison, . . . → topic of this course Note: The actual value of the likelihood function per se is usually not of interest. Andreas Scheidegger Motivation 3
  • 6. How to formulate likelihood functions? Often, models are not described by the likelihood function. A common description may rather look like this: Yi = M(xi , θ) + i , i ∼ N(0, σ2 ) While this a complete description of the stochastic model1, it is not directly useful for inference → we must translate such a description into p(y|θ, x). 1 M(xi , θ) is a deterministic function. The complete model, however, is stochastic because we added a random error term i . Andreas Scheidegger Motivation 4
  • 7. Derivation of a likelihood function 1. Decompose the joint probability density: p(y|θ) = p(y1, . . . , yn|θ) = p(y1|θ)p(y2|θ, y1)p(y3|θ, y1, y2) . . . p(yn|θ, y1, . . . , yn−1) 2. Formulate the conditional probabilities: p(yi |θ, y1, . . . , yi−1) If the observations are independent: p(yi |θ, y1, . . . , yi−1) = p(yi |θ). Andreas Scheidegger Derivation of p(y|θ) 5
  • 8. Some (informal) advices • Formulate first the likelihood general without specific distribution assumptions. • Think (informally!) p(x) as Prob(X = x) and change sums to integrals. • Practically, a function that is proportional to the likelihood function is sufficient. • The logarithmic scale is prefered for computation. • Don’t care about identifiability of the parameters at this stage. Andreas Scheidegger Derivation of p(y|θ) 6
  • 9. Example 1: sex ratio discrete data Observed data y The gender of n newborns. Model description We assume the probability for girl is θ and for boy 1 − θ. Andreas Scheidegger Examples 7
  • 10. Example 1: sex ratio discrete data Probability for a single observation: Prob(yi |θ) = θ, yi = girl 1 − θ, yi = boy Andreas Scheidegger Examples 8
  • 11. Example 1: sex ratio discrete data Probability for a single observation: Prob(yi |θ) = θ, yi = girl 1 − θ, yi = boy Independence is a reasonable assumption: Prob(y1, . . . , yn|θ) = n i=1 Prob(yi |θ) = θ#girls (1 − θ)#boys Andreas Scheidegger Examples 8
  • 12. Example 1: sex ratio discrete data R implementation as function: logL <- function(theta, n.girls, n.boys) { LL <- n.girls*log(theta) + n.boys*log(1-theta) return(LL) } Call: logL(theta=0.4, n.girls=10, n.boys=5) > -11.717035 Andreas Scheidegger Examples 9
  • 13. Example 2: rating curve continuous data Observed data y, x n pairs of water level xi and run-off yi . Figure: Rating curve of Sluzew Creek. Sikorska et al. (2013) Andreas Scheidegger Examples 10
  • 14. Example 2: rating curve continuous data Observed data y, x n pairs of water level xi and run-off yi . Model description Water level x and run-off y are related as y = RC(x, θ) = θ1(x − θ2)θ3 Figure: Rating curve of Sluzew Creek. Sikorska et al. (2013) Andreas Scheidegger Examples 10
  • 15. Example 2: rating curve continuous data A deterministic model? → We must make assumptions about the error distribution. E.g., Yi = RC(xi , θ) + i , i ∼ N(0, σ2 ) or equivalent Yi ∼ N RC(xi , θ), σ2 The RC model describes only the expected value of an observation for a given xi . 2 φ(x) = 1√ 2π exp{−x2 2 } Andreas Scheidegger Examples 11
  • 16. Example 2: rating curve continuous data A deterministic model? → We must make assumptions about the error distribution. E.g., Yi = RC(xi , θ) + i , i ∼ N(0, σ2 ) or equivalent Yi ∼ N RC(xi , θ), σ2 The RC model describes only the expected value of an observation for a given xi . So the pdf for a single observation is the density of a normal distribution2 p(yi |xi , θ, σ) = 1 σ φ yi − RC(xi , θ) σ 2 φ(x) = 1√ 2π exp{−x2 2 } Andreas Scheidegger Examples 11
  • 17. Example 2: rating curve continuous data A deterministic model? → We must make assumptions about the error distribution. E.g., Yi = RC(xi , θ) + i , i ∼ N(0, σ2 ) or equivalent Yi ∼ N RC(xi , θ), σ2 The RC model describes only the expected value of an observation for a given xi . So the pdf for a single observation is the density of a normal distribution2 p(yi |xi , θ, σ) = 1 σ φ yi − RC(xi , θ) σ Finally, assuming independent observations p(y1, . . . , yn|x1, . . . , xn, θ, σ) = n i=1 p(yi |xi , θ, σ) 2 φ(x) = 1√ 2π exp{−x2 2 } Andreas Scheidegger Examples 11
  • 18. Example 2: rating curve continuous data Figure: Rating curve. Example of a non-linear regression. Andreas Scheidegger Examples 12
  • 19. Example 2: rating curve continuous data Figure: Rating curve. Example of a non-linear regression. Andreas Scheidegger Examples 12
  • 20. Example 2: rating curve continuous data X (water level) Y(runoff) RC(X,θ) Figure: Rating curve. Example of a non-linear regression. Andreas Scheidegger Examples 12
  • 21. Example 2: rating curve continuous data ## deterministic raiting curve model RC <- function(x, theta) { y <- theta[1]*(x-theta[2])^theta[3] return(y) } ## log likelihood with normal distributed errors ## sigma is included as theta[4]=sigma. logL <- function(theta, y.data, x.data) { mean.y <- RC(x.data, theta[1:3]) # mean value for y LL <- sum(dnorm(y.data, mean=mean.y, sd=theta[4], log=TRUE)) return(LL) } Andreas Scheidegger Examples 13
  • 22. Example 3: limit of quantification censored data Observed data y lab 1 lab 2 lab 3 . . . concentration y1 y2 n.d. . . . Limit of quantification: LOQ standard deviation of measurements: σ Model description “A model? I just want to calculate the concentration.” Andreas Scheidegger Examples 14
  • 23. Example 3: limit of quantification censored data Figure: Left censored data. Model description The measurements are normal distributed around the true mean θ with standard deviation σ. Andreas Scheidegger Examples 15
  • 24. Example 3: limit of quantification censored data Figure: Left censored data. Model description The measurements are normal distributed around the true mean θ with standard deviation σ. Andreas Scheidegger Examples 15
  • 25. Example 3: limit of quantification censored data Figure: Left censored data. Model description The measurements are normal distributed around the true mean θ with standard deviation σ. Andreas Scheidegger Examples 15
  • 26. Example 3: limit of quantification censored data Likelihood for a single measured observation: p(yi |θ, σ) = φ yi − θ σ Andreas Scheidegger Examples 16
  • 27. Example 3: limit of quantification censored data Likelihood for a single measured observation: p(yi |θ, σ) = φ yi − θ σ Likelihood for a single “not detected” observation: Prob(n.d.|θ, σ) = Prob(yi < LOQ|θ, σ) = LOQ 0 p(y|θ, σ) dy =Φ LOQ − θ σ Andreas Scheidegger Examples 16
  • 28. Example 3: limit of quantification censored data Likelihood for a single measured observation: p(yi |θ, σ) = φ yi − θ σ Likelihood for a single “not detected” observation: Prob(n.d.|θ, σ) = Prob(yi < LOQ|θ, σ) = LOQ 0 p(y|θ, σ) dy =Φ LOQ − θ σ p(y1, . . . , yn|θ, σ) = Prob(yi < LOQ|θ, σ)#censored ¬censored p(yi |θ, σ) Andreas Scheidegger Examples 16
  • 29. Example 3: limit of quantification censored data ## data, if left censored = "nd" y <- c(y1=0.35, y2=0.45, y3="nd", y4="nd", y5=0.4) ## log likelihood logL <- function(theta, y, sigma, LOQ) { ## number of censored observations n.censored <- sum(y=="nd") ## convert not censored observations into type ’numeric’ y.not.cen <- as.numeric(y[y!="nd"]) ## likelihood for not censored observations LL.not.cen <- sum(dnorm(y.not.cen, mean=theta, sd=sigma, log=TRUE)) ## likelihood for left censored observations LL.left.cen <- n.censored * pnorm(LOQ, mean=theta, sd=sigma, log=TRUE) return(LL.not.cen + LL.left.cen) } Andreas Scheidegger Examples 17
  • 30. Example 4: auto-regressive model auto-correlated data Observed data y equally spaced time series data y1, . . . , yn. Model description Classical AR(1) model: yt+1 = θyt + t+1, t+1 ∼ N(0, σ2 ) y0 = k Time waterlevel[feet] 1880 1920 1960 576 577 578 579 580 581 582 Figure: Annual water level of Lake Huron. Brockwell and Davis (1991) Andreas Scheidegger Examples 18
  • 31. Example 4: auto-regressive model auto-correlated data Observations are only dependent on the preceding observation. Hence: p(y1, . . . , yn|θ, σ, y0) = n i=1 p(yi |yi−1, θ, σ) LL <- dnorm(y[1], k, sigma, log=TRUE) + sum(dnorm(y[2:n], mean=theta*y[1:(n-1)], sd=sigma, log=TRUE)) Andreas Scheidegger Examples 19
  • 32. Example 4: auto-regressive model auto-correlated data Observations are only dependent on the preceding observation. Hence: p(y1, . . . , yn|θ, σ, y0) = n i=1 p(yi |yi−1, θ, σ) The conditional probabilities are all normal p(yt|y0, . . . , yt−1, θ, σ) = p(yt|yt−1, θ, σ) = φ yt − θyt−1 σ LL <- dnorm(y[1], k, sigma, log=TRUE) + sum(dnorm(y[2:n], mean=theta*y[1:(n-1)], sd=sigma, log=TRUE)) Andreas Scheidegger Examples 19
  • 33. Normality and “iid.” Reality is normally not normal distributed Typical statistical assumption, such as • normality • independence are often chosen from a computational view point. However, other distribution assumptions can be incorporated easily in most cases. Andreas Scheidegger General remarks 20
  • 34. Rating curve modified Lets assume we observe more extreme values than compatible with a normal distribution → try t-distribution. ## log likelihood with t-distributed errors ## theta[4]=scale, theta[5]=degree of freedom. logL <- function(theta, y.data, x.data) { mean.y <- RC(x.data, theta[1:3]) # mean value for y residuals <- (y.data - mean.y)/theta[4] # scaling LL <- sum(dt(residuals, df=theta[5], log=TRUE)) return(LL) } Andreas Scheidegger General remarks 21
  • 35. Summary 1. Decompose the joint probability density: p(y|θ) = p(y1, . . . , yn|θ) = p(y1|θ)p(y2|θ, y1)p(y3|θ, y1, y2) . . . p(yn|θ, y1, . . . yn−1) 2. Make assumptions to formulate the conditional probabilities: p(yi |θ, y1, . . . yi−1) 3. Make inference, check assumptions, revise if necessary. Andreas Scheidegger General remarks 22