- mcmc.R: A Random Walk-based MCMC routine that takes a parameter template, a set of hyper-parameters, a log-likelihood function and a log-prior function as input. Performs adaptive steps during burnin. Can perform parellel tempering in order to overcome multimodality.
- numeric_stoch_diff.R: Returns realization of specified stochastic differential equations (SDE). based on chapter 12 in Kloeden and Platen's book "Numerical Solution of Stochastic Differential Equations".
- dtable.R: Does Bayesian contingency table analysis, calulating the Bayes factor fro having vs not having dependency between rows and columns. This is also available as an R package called DTable, install by the R commands install.packages('DTable',repos='http://folk.uio.no/trondr/R',type='source') and then library(DTable). Help functions are then available.

- mcmc_test1.R: An example of use of mcmc.R. Does linear regression with a semi-conjugate prior. Tests this on a simulated dataset.
- mcmc_test2.R: Another example of use of mcmc.R. Does a mixture analysis, with a distributiona ssumed to be the mixture of two normal distributions. Tests this on several simulated datasets, big and small plus one dataset where the model assumptions are broken, namely mixture of three normal distributions, in order to check that parallel tempering overcomes multimodality.
- test_numeric_stoch_diff.R:
An example of use of numeric_stoch_diff.R.
Tests this on:
- Gravity with and without stochastic contributions
- The Ornstein-Uhlenbeck process
- A 2 layered linear SDE system
- Phenotypic evolution in two species experiencing repulsion
- Stochastic Lotka-Volterra (hunter-prey ecology)

- cyclic_lin.R: Another example of use of numeric_stoch_diff.R. Examines a 2 component linear SDE with cyclic behavior.
- barnard_test.R: Tests the dtable.R routines up against classic contingency analysis for some example datasets.
- linear_regression_test.R tests the MCMC+importance sampling methodology in mcmc.R for calculating the marginal likelihood of a linear regression model. This is compared to the exact marginal likelihood, using conjugate priors.
- ou_test2.R tests the MCMC+importance sampling methodology in mcmc.R for calculating the marginal likelihood of an OU model. This is compared to the exact marginal likelihood (or rather the logarithm is compared), which is calculated by the use of discretization and conjugate priors.
- singlesegment_powerlaw.R. Calculates estimated stage-discharge rating-curve (single segment power-law with location parameter) for the dataset Gryta.

- urn_inference_N.R: Does Bayesian inference on urn sampling data. PS: Norwegian comments.
- yatzi.R: Simulates the game yatzi so as to estimate the probability of getting the outcome "yatzi".
- testbinom.R: Tests whether binomical data has a success rate above 1/6 using frequentist and Bayesian tests.
- finite_queue.R. A little exercise in queuing theory. Checks the behviour of M/1/1 ques and then introduces the possibility that people in the back get tired and leave the queue without getting service.

- Back to my main page.