Posts tagged with bayesian

Let’s say that you’re fitting a cumbersome model so time is not to waste over a PC staring at the screen half anxious-half bored…

Then, you can always leave and go on with meetings and all your daily routine and have R notify you the results! How?

We will illustrate the situation above using some Bayesian Model Averaging code adapted by Martin Feldkircher & Stefan Zeugner. You should download the code and source everything in R except for the example in the end (after the definition of the functions!).

#The code to get a model
fls.data=read.table(url("http://feldkircher.gzpace.net/links/fls_data_adj.txt"))

data.M=as.matrix(fls.data)
K=ncol(dataM)-1  # nr. of regressors

# this setting corresponds to a uniform prior on the model space (prior.msize=K/2 and theta="fix")
# and the ric specification since K^2> N (with N the nr. of observations) as suggested by fls
model.ric=fls(X.data=data.M,burn=60000,iter=700000,g=(1/K^2),nmodel=100,theta="fix",prior.msize=K/2,logfile=T,mcmc="bd",start.value=rep(0,K),beta.save=T)

This is gonna take s o m e time (really!), so you could let R working and go out for a cup of coffee (typical of Greek people!). Add the following at the end of the above code.

library(twitteR)
sess <- initSession('myUser', 'myPass') # Set your user account info
ns <- updateStatus('A model waits for you @ home ;) ', sess)

Would you really care enough to check whether the fit is done when outside?

Well, that’s a good book that you shouldn’t miss “Introduction to Applied Bayesian Statistics and Estimation for Social Scientists”. Why you shouldn’t miss it? Coz, it’s practical and I mean p r a c t i c a l big time!!!

I don’t own tons of (traditionally) printed books but that’s one of the few breaking the rule. I easily rank it above The Bayesian Core

First stop at all costs the book’s webpage to download the R & Winbugs code…

Springer | Amazon | Google Books | S. Lynch | Book Page

How imbd ranks movies?

The formula for calculating the Top Rated 250 Titles gives a true Bayesian estimate:

$latex WR=\frac{\nu }{\nu +m}R+\frac{m}{\nu +m}C$

where:

$latex R$ = average for the movie (mean) = (Rating)

$latex \nu$ = number of votes for the movie = (votes)

$latex m$ = minimum votes required to be listed in the Top 250 (currently 1500)

$latex C$ = the mean vote across the whole report (currently 6.9)

for the Top 250, only votes from regular voters are considered. (source)

Now that’s something unexpected! Going further than the simple arithmetic mean is something exciting, right?

The formula is the well-known decomposition of the posterior mean -distributed a priori as normal- compromising the prior guess ($latex C$) and the data ($latex R$) weighted by the sample ($latex \nu$) and the pretend-to-be initial sample ($latex m$) under the conjugate prior setting.

Real Time Web Analytics