Chapter 4 Exercises
Student t simulation and analysis
1. Generate 4000 samples from a standard Student-t distribution with 4 degrees of freedom. How might you compare this distribution to a standard normal distribution in BUGS? [Hint: axis limits in WinBUGS graphs can be changed by right-clicking on the graph and selecting “Properties…”]
2. Adapt your code so that we can save the 4,000 simulated values as a data set for analysis in WinBUGS later. [Hint: create a vector of t-distributed variables and use “Save State” from the “Model” menu after just one iteration.]
3. Now assume that we do not know the values of any parameters and specify a model for the simulated data. Use the following priors: normal with mean zero and standard deviation 100 for the mean; uniform on the interval (0, 10) for the standard deviation; and a uniform prior on the interval (3, 30) for the degrees of freedom. [Remember that the “precision parameter” in the t distribution is given by d / ((d – 2)*variance), where “d” is the degrees of freedom; hence the reason for bounding the distribution of d away from 2.]
4. Choose two sets of initial values and run a two-chain analysis. How many iterations should we discard (burn in)? How many iterations are required for accurate inferences?