Statistics 481: Homework
Final:
The Final is related to testing out the code from the bayestestR R package. Dowload the .Rmd file, modify the code as instructed, answer the questions in the .Rmd file, knit it to a .docx or .pdf file, and submit it on Blackboard
- R Notebook:
Project:
The project is to try to determine the number of event that Pres. Trump held since the start of the COVID-19 Lockdown and to determine an average number of people who attened each event. Using the the code in the rose_garden_ver08.Rmd, update the values of k, the number of events, and n, the average number of people at each event, estimate the predicted number of people who may have tested positive after the events Py[i] and the total number of people who may have tested postive, Py_tot.
Write a summary of your findings in a separate .docx file. Incude a table for each event and the estimated number of people who tested positive. Report the total number of people who may have tested positive with a 95% Bayesian Credible Interval.
Quiz:
The quiz is to experience the difference between running JAGS using single threaded rjags and running JAGS in parallel using runjags.
Run rose_garden_ver08.Rmd using the following values of (k,n): (5, 300), (10, 400), (50, 1000), (100, 5000). Determine the elapsed time using rjags. Determine the elapsed time using runjags.
Write a summary of finding in a separate .docx file. Include a table of your results. Explain the differences in the elapsed times.
Homework 8:
- Read: Chapter 10 Section 10.1 Bayes Factor
- Read: Chapter 12 ROPE
- Read: Chapter 14 Stan
Homework 7:
(due Monday November 16, 2020)
- Read: Chapter 9
- Read the paper A Primer on the Bayesian Approach to Statistical Inference by Stephenson and Stern, see Bayesian.pdf
- Read the paper on Gibbs Sampling. Gibbs.pdf
- Read the paper A Primer on Hierarchical Models. Hierarchical.pdf
Do the following: Complete all of the problems in your R Notebook.
- Find a dataset to perform Bayesian Linear Regresion with, using linear_regression_ver01.Rmd.
- Run the JAGS code for the pumps_ver01.Rmd.
- Do Exercise 9.1 chapter9_problems Hint: When running this code on Windows remove the saveName=fileRoot from the genMCMC and symMCMC function calls and it should run.
- Do Exercise 9.4 the code for this problem is at the bottom of the R Notebook.
Midterm:
(due in Blackboard Friday October 23, 2020)
Homework 6:
(due Monday October 12, 2020)
- Read: Chapter 7
Do the following: Complete all of the problems in your R Notebook.
- Find a function of x and evaluate the area under the curve between two points, a and b, using random sampling. See the code below.
- Do Exercise 7.1 use BernMetrop.zip.
Code for Problem 1.
B <- 10000; a <- ????, b <- ???? # you need to specify a and b
x <- runif(B, a, b)
y <- ???? # apply the funtion to x
mean(y) * ( b - a )
Quiz Practice:
(due Monday October 5, 2020)
Do the following: Complete all of the problems in your R Notebook.
- What is a good probability model for observed 0, 1 data observed 100 times?
- What is the parameter of interest in the model?
- Name the likelihood function that represents the model.
- Name a conjugate prior distribution for the parameter of interest in the model?
- Name the posterior distribution for the parameter of interest given the data?
Homework 5:
(due Monday October 5, 2020)
- Read: Chapter 8, Sections 8.1, 8.2, 8.3
Do the following: Complete all of the problems in your R Notebook.
- Run the R Notebook from the JagsExample.zip. Change the dbeta(1, 1) prior to a more informative prior, dbeta(4,4). Compare the Bayesian estimates of the parameter Theta and compare 95% HDIs (95% Bayesian credible intervals) using the two priors.
Homework 4:
(due Monday September 28, 2020)
- Read: Chapter 6
Using an R Notebook produce your solutions to the following questions. Start by making an R Notebook with file name Lastname_Firstname_Stat481_hw4.Rmd. Then knit the .Rmd file to either Lastname_Firstname_Stat481_hw4.docx or preferably Lastname_Firstname_Stat481_hw4.pdf. Use your own last name and first name in the filename.
At the top of your first page you should include Name, Class, Section, and homework assignment.
The header of your R Notebooks should include
title: "Stat. 481 Homework 4"
author: "Your name"
date: "September 28, 2020"
Upload one file to Blackboard.
AND/OR If you are more comfortable write the solutions on paper by hand, then take a photo or scan your work and upload it to Blackboard.
Do the following: Complete all of the problems in your R Notebook.
- Do Exercise 6.1
- Do Exercise 6.2
- Do Exercise 6.5
Homework 3:
(due Monday September 21, 2020)
- Read: Chapter 5
Using an R Notebook produce your solutions to the following questions. Start by making an R Notebook with file name Lastname_Firstname_Stat481_hw3.Rmd. Then knit the .Rmd file to either Lastname_Firstname_Stat481_hw3.docx or preferably Lastname_Firstname_Stat481_hw3.pdf. Use your own last name and first name in the filename.
At the top of your first page you should include Name, Class, Section, and homework assignment.
The header of your R Notebooks should include
title: "Stat. 481 Homework 3"
author: "Your name"
date: "September 21, 2020"
Upload one file to Blackboard.
AND/OR If you are more comfortable write the solutions on paper by hand, then take a photo or scan your work and upload it to Blackboard.
Do the following: Complete all of the problems in your R Notebook.
- Do Exercise 5.2
- Do Exercise 5.4
Homework 2:
(due Monday September 14, 2020)
- Read: Chapter 3, Chapter 4
Using an R Notebook produce your solutions to the following questions. Start by making an R Notebook with file name Lastname_Firstname_Stat481_hw2.Rmd. Then knit the .Rmd file to either Lastname_Firstname_Stat481_hw2.docx or preferably Lastname_Firstname_Stat481_hw2.pdf. Use your own last name and first name in the filename.
At the top of your first page you should include Name, Class, Section, and homework assignment.
The header of your R Notebooks should include
title: "Stat. 481 Homework 2"
author: "Your name"
date: "September 14, 2020"
Upload one file to Blackboard.
AND/OR If you are more comfortable write the solutions on paper by hand, then take a photo or scan your work and upload it to Blackboard.
Do the following: Complete all of the problems in your R Notebook.
- Do Exercise 4.3.
- From the Additional Exericises, from the Book website, complete problem Chapter 4, Hands-on experience approximating probability density from a large sample, as in Figures 4.2 and 4.3.
- Complete the following exercises. simplebayes.pdf
Homework 1:
(due Monday August 31, 2020)
Using an R Notebook produce your solutions to the following questions. Start by making an R Notebook with file name Lastname_Firstname_Stat481_hw1.Rmd. Then knit the .Rmd file to either Lastname_Firstname_Stat481_hw1.docx or preferably Lastname_Firstname_Stat481_hw1.pdf. Use your own last name and first name in the filename.
At the top of your first page you should include Name, Class, Section, and homework assignment.
The header of your R Notebooks should include
title: "Stat. 481 Homework 1"
author: "Your name"
date: "August 31, 2020"
Upload one file to Blackboard.
Do the following: Complete all of the problems in your R Notebook.
- Do Exercise 2.1
- Do Exercise 2.2
- Do Exercise 3.3
- Run the R programs prog1.R through prog6.R in separate R chunks in your R Notebook.