Access over 20 million homework & study documents

R project 11122020

Content type
User Generated
Rating
Showing Page:
1/3
Question 1
Assume a generative model with Bernoulli data (X) and a uniform prior (θ):
XBernoulli(θ)XBernoulli(θ)
Θ∼Uniform(0,1)ΘUniform(0,1)
Also, assume you observe data representing two successes and one failure.
Using causact, update your prior for θ and generate a representative sample of 4,000
draws from the posterior distribution (note: 4,000 is the default number of samples when
using the mcmc function to get the posterior). As in the course content, assign the
output of the mcmc function to an object named drawsDF.
Use the two methods (i.e. ggplot() and dagp_plot()) to create two different versions
visualizing the posterior distribution.
Modify the first plot with a title substituting in your name as appropriate:
+ labs(title = "Michael Brailovsky - Posterior")
To prove that you were able to generate the two plots, create a single pdf file with both
plots.
Question 2
Your company has been testing two flavors of coffee using free samples, let's call them
Flavor A and Flavor B. You are planning to only offer one flavor for sale and are
interested in whether your customers prefer Flavor A or Flavor B.
You use a taste testing survey of 60 randomly selected people, and find that 36 people
prefer Flavor B.
Using causact and assuming the above generative DAG with Bernoulli data (X) and a
Beta prior (θ):
determine what your updated probability is that Flavor B is preferred to Flavor A. Iin
other words, what percentage of your posterior draws have a theta that is above 0.5?
(Enter answer as a decimal - i.e. 12% would be entered as 0.120. Round to the nearest
thousandths place)

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/3
Question 3
This csv file: titanic.csv contains information on the survival of 891 of the passengers
on the Titanic. There were more passengers on board at the time of sinking, but their
data is not included here.
The following data description is helpful as these are the two columns of data you will
use for this assignment.
pclass: A proxy for socio-economic status (SES)
1st = Upper
2nd = Middle
3rd = Lower
survive: 1=YES, 0 = NO
Using the below generative DAG, answer the following question:
Question 4
The following code will extract and plot the number of runs scored per game at the
Colorado Rockies baseball field in the 2010-2014 baseball seasons.
library(dplyr)
library(causact)
# extract relevant data
baseDF = causact::baseballData %>% as_tibble() %>%

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/3

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
Question 1 Assume a generative model with Bernoulli data (X) and a uniform prior (θ): X∼Bernoulli(θ)X∼Bernoulli(θ) Θ∼Uniform(0,1)Θ∼Uniform(0,1) Also, assume you observe data representing two successes and one failure. Using causact, update your prior for θ and generate a representative sample of 4,000 draws from the posterior distribution (note: 4,000 is the default number of samples when using the mcmc function to get the posterior). As in the course content, assign the output of the mcmc function to an object named drawsDF. Use the two methods (i.e. ggplot() and dagp_plot()) to create two different versions visualizing the posterior distribution. Modify the first plot with a title substituting in your name as appropriate: + labs(title = "Michael Brailovsky - Posterior") To prove that you were able to generate the two plots, create a single pdf file with both plots. Quest ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Really great stuff, couldn't ask for more.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4