Chapter 27 DIY
Now, over to you as usual.
We want you try to set up Bayes lm()
estimation using the dataset from Chapter 2 (anxiety) and the dataset from Chapter 3 (schools) to set up Bayes lmer()
. Note that you will need to do some learning here and check out the package (blme
) Here are the stages you may want to consider. Note, that you may need to explore some further resources to find out how to approach the models that we did not discuss. Alternatively, try something out on your own data.
Whilst we are here, you can also note that you can fit simple logisit models using BAS
via bas.glm()
Try with titanic (check Chapter 3 for data and steps), the example of specification is presented below:
#Set up the model
bas_titanic<-bas.glm(Survived~ Pclass + Sex + Age, data=titanic, method='BAS', family=binomial(), modelprior=uniform())
#Summarise
summary(bas_titanic)
#Simple plots
plot(bas_titanic)
,
#Load the data in
#Provide descriptions
#Provide histograms for the outcome variables
#Use pairs plots to check simple relationship among the predictors
#Set up the basic model
#Get the results
#Check for outliers
#Plot predictions from the model
#Make a decision which model to go for
#What if you have more data? Or/and different prior parameters?
#Provide some nice plots to accompany your results
27.1 Extra Resources to check
Quick note: the amount of resources available for Bayesian stats in R had grown literally in past few months so watch out as we are sure there will be quite a few coming down fairly soon to make the use of Bayesian statistics incredibly easy!
Among many we would like to recommend the following:
Interesting reading on applications of Bayes: - Bayesian Search for Missing Aircrafts, Ships and People -