Bayesian MAR(1) model

Project information

Project members
brice.semmens e2holmes eric.ward mark.scheuerell mdscheuerell

Sharing
Public


Description
This set of Matlab scripts conducts a first order MAR(1) model to estimate interactive effects, and covariate effects, on a time series of data from a community.

It uses a Gibbs sampler to estimate parameters, and currently is set up with diffuse priors on all parameters for the model. It is pretty basic at this point, but it works.

Note on the Gamma distribution:

Going back and forth between Matlab/R/WinBUGS can be confusing, because of the different parameterizations of the gamma pdf. Here's the Matlab/BUGS forms and the R equivalents:

Matlab: X ~ g(a,b) E[X] = ab

R equivalent: X ~ g(shape=a,scale=b)

BUGS: X ~ g(a,b) E[X] = a/b

R equivalent: X ~ g(shape=a,rate=b) OR

X ~ g(shape=a,scale=1/b)



Files

Bayesian MAR(1) model /
  • Download Bayesian MAR(1) model as zip archive Download
Name Status Rev Size Updated Downloads Brief Description Actions
lwa62to94.txt
Stable
1 100.6 KB 06/23/2008 23:22 PDT 54 54 f
data for this example
MAR_Bayes.m
Stable
1 9 KB 06/23/2008 23:22 PDT 81 81 f
main MAR program
MLR_Gibbs_func.m
Stable
2 649 B 07/02/2008 16:04 PDT 92 92 f
gibbs routine
R_BUGS_MAR_code.r
Stable
1 2 KB 07/08/2008 08:40 PDT 67 67 f
R/BUGS code to do the MAR(1) Bayesian estimation
R_BUGS_SSMAR_code.r
Stable
1 2.7 KB 07/08/2008 09:09 PDT 57 57 f
R/BUGS code to do the state space MAR(1) Bayesian estimation (also referred to as dynamic linear models)
univariate.R
Stable
1 30.1 KB 07/05/2008 17:58 PDT 55 55 f
This is Eric's R code to do Bayesian linear regression with Gibbs sampling. This file must be sourced; for a simpler example see the Gibbs linear regression project...
univariate_LakeWA_example.r
Stable
2 774 B 07/05/2008 18:04 PDT 76 76 f
This is the R version of Brice's MATLAB code. It includes 2 versions of the algorithm: a pure R algorithm written by Eric, and an implementation of function MCMCregress (> 100X FASTER!). And it does model selection (Bayes factor)

Keywords



Downloads

45 project downloads
482 individual file downloads

Sculpin 0.2 | xhtml | problems or comments? | report bugs