Uploaded May 2018 | Updated September 2026, 2 hours ago
This video illustrates how to derive a Gibbs sampling scheme for an applied example.
This video is part of a lecture course which closely follows the material covered in the book, "A Student's Guide to Bayesian Statistics", published by Sage, which is available to order on Amazon here: amazon.co.uk/Students-Guide-Bayesian-Statistics/dp/1473916364
For more information on all things Bayesian, have a look at: ben-lambert.com/bayesian/. The playlist for the lecture course is here: youtube.com/playlist?list=PLwJRxp3blEvZ8AKMXOy0fc0cqT61GsKCG&disable_polymer=true
This video illustrates how to derive a Gibbs sampling scheme for an applied example.
This video is part of a lecture course which closely follows the material covered in the book, "A Student's Guide to Bayesian Statistics", published by Sage, which is available to order on Amazon here: amazon.co.uk/Students-Guide-Bayesian-Statistics/dp/1473916364
For more information on all things Bayesian, have a look at: ben-lambert.com/bayesian/. The playlist for the lecture course is here: youtube.com/playlist?list=PLwJRxp3blEvZ8AKMXOy0fc0cqT61GsKCG&disable_polymer=true


![Monte Carlo Simulation of Omitted Variable Bias in Least Squares
This video provides an example of how Monte Carlo Simulation can be used to demonstrate the bias and inconsistency of Ordinary Least Squares in the presence of an omitted variable.
clear; close all; clc;
%Define the population parameters
alpha=1;
beta1=1;
beta2=1;
% Sample size n
n=10000;
% Number of samples m
m=1000;
% Store the estimated beta in a vector
beta_hat=zeros(m,1);
for i=1:m
%Generate independent variables randomly
x1=4*randn(n,1);
x2=0.25*x1+randn(n,1);
%Generate errors in the population
e=randn(n,1);
%Generate the dependent variable
y=alpha+beta1*x1+beta2*x2+e;
%Generate the LS estimates of alpha and beta using matrix formulation
X=[ones(n,1) x1];
beta_hatvec=(inv((X*X)))*X*y;
% Pull out only the second component - the estimate of beta
beta_hat(i)=beta_hatvec(2);
end
zoom=0.8;
% Draw a histogram of the result
FigHandle = figure(Position, [750, 300, 1049*zoom, 895*zoom]);
hist(beta_hat,20)
xlabel(Beta hat)
ylabel(Frequency)
xlim([0.5,1.5]) Check out https://ben-lambert.com/econometrics-course-problem-sets-and-data/ for course materials, and information regarding updates on each of the courses. Quite excitingly (for me at least), I am about to publish a whole series of new videos on Bayesian statistics on youtube. See here for information: https://ben-lambert.com/bayesian/ Accompanying this series, there will be a book: https://www.amazon.co.uk/gp/product/1473916364/ref=pe_3140701_247401851_em_1p_0_ti Monte Carlo Simulation of Omitted Variable Bias in Least Squares](https://i.ytimg.com/vi/BmQvpLiM1ks/mqdefault.jpg)
![Monte Carlo Simulation for Ordinary Least Squares
This video provides an example of Monte Carlo Simulation, using Ordinary Least Squares Estimators.
Check out http://oxbridge-tutor.co.uk/undergraduate-econometrics-course/ for course materials, and information regarding updates on each of the courses.
The Matlab code used in this simulation is shown below.
clear; close all; clc;
%Define the population parameters
alpha=1;
beta=1;
% Sample size n
n=10000;
% Number of samples m
m=1000;
% Store the estimated beta in a vector
beta_hat=zeros(m,1);
for i=1:m
%Generate independent variable randomly
x=4*randn(n,1);
%Generate errors in the population
e=randn(n,1);
%Generate the dependent variable
y=alpha+beta*x+e;
%Generate the LS estimates of alpha and beta using matrix formulation
X=[ones(n,1) x];
beta_hatvec=(inv((X*X)))*X*y;
% Pull out only the second component - the estimate of beta
beta_hat(i)=beta_hatvec(2);
end
zoom=0.8;
% Draw a histogram of the result
FigHandle = figure(Position, [750, 300, 1049*zoom, 895*zoom]);
hist(beta_hat,20)
xlabel(Beta hat)
ylabel(Frequency) Check out https://ben-lambert.com/econometrics-course-problem-sets-and-data/ for course materials, and information regarding updates on each of the courses. Quite excitingly (for me at least), I am about to publish a whole series of new videos on Bayesian statistics on youtube. See here for information: https://ben-lambert.com/bayesian/ Accompanying this series, there will be a book: https://www.amazon.co.uk/gp/product/1473916364/ref=pe_3140701_247401851_em_1p_0_ti Monte Carlo Simulation for Ordinary Least Squares](https://i.ytimg.com/vi/BsCgwERndJ0/mqdefault.jpg)






