Created
November 5, 2016 22:03
-
-
Save BioSciEconomist/409eef19ba90ec79087e9d59a81782ba to your computer and use it in GitHub Desktop.
Elements of Bayesina Econometrics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------------------------------------ | |
# | PROGRAM NAME: EX_BAYESIAN_ECONOMETRCS | |
# | DATE: 9-15-11 | |
# | CREATED BY: MATT BOGARD | |
# | PROJECT FILE: http://econometricsense.blogspot.com/2011/09/elements-of-bayesian-econometrics.html | |
# |---------------------------------------------------------------- | |
# | ADAPTED FROM: Andrew D. Martin. "Bayesian Inference and Computation in Political Science." Slides from a talk given to the Department of Politics, Nuffield College, Oxford University, March 9, # | 2004. SLIDES:http://adm.wustl.edu/media/talks/bayesslides.pdf R-CODE : http://adm.wustl.edu/media/talks/examples.zip | |
# | | |
# | | |
# | | |
# |------------------------------------------------------------------ | |
setwd('/Users/wkuuser/Desktop/Briefcase/R Data Sets') | |
library(MCMCpack) | |
murder <- read.table("murder.txt", header=TRUE) | |
names(murder) | |
dim(murder) | |
# estimation using OLS | |
lm(murder ~ unemp, data=murder) | |
summary(lm(murder ~ unemp, data=murder)) | |
# posterior with standard priors | |
post1 <- MCMCregress(murder ~ unemp, data=murder) | |
print(summary(post1)) | |
# posterior with informative priors | |
m <- matrix(c(0,3),2,1) | |
V <- matrix(c(1,0,0,1),2,2) | |
post2 <- MCMCregress(murder ~ unemp, b0=m, B0=V, data=murder) | |
print(summary(post2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment