Question

In: Statistics and Probability

The crab data set contains information on the number of "satellites" per female crab. Use a...

The crab data set contains information on the number of "satellites" per female crab. Use a Bayesian model to infer the Poisson parameter.

a.  Write the likelihood function.

b. Derive the posterior distribution using a Gamma prior w/ rate=20 & shape=3

c. Provide the posterior mean, posterior SD and 95 and 99% posterior credibility region (hint: you can use qgamma).

d. Plot the prior and posterior distribution of lambda, in the same plot.

mean = 2.919075

variance = 9.912018

n = 173

Data set: http://users.stat.ufl.edu/~presnell/Courses/sta4504-2000sp/R/Data/crabs.dat

Solutions

Expert Solution

#(d)
par(mfrow=c(2,2))

th=15

var1=1

mu=2.919075

var2=90912018

n=173

x=rgamma(n,th,var1)

s=sum(x)

for(i in 1:length(mu))

{

r=(1/var1)+(n/var2[i])
pr<-function(th)
{

return(dgamma(th,mu[i],sqrt(var2[i])))

}

mx<-function(th)

{

m=((th/var1)+(s/var2[i]))/r

return(m)

}

po<-function(th)

{

return(dgamma(th,mx(th),sqrt((1/r))))

}

plot(pr,xlim=c(0,30),ylab="prior and posterior function",xlab="x-- -- -- ->") curve(po,xlim=c(0,30),ylim=c(0,100),add=TRUE,col="red") legend("topleft",c(paste("Prior~gamma(",mu[i],",",var2[i],")"),"Posterior dist"), lty=c("solid"),col=c("black","grey90"),bty="n")

}


Related Solutions

The data on the left contains nutrition information on the number of Calories and grams of...
The data on the left contains nutrition information on the number of Calories and grams of carbohydrates for 58 sandwiches and similar items on McDonald's menu. 1:) A. Run a regression of Calories (y-variable) on Carbs (x-variable). Be sure to include the scatterplot with the least squares line. B. Interpret the slope of the regression in the context of the problem. C. Interpret the R-square in the context of the problem. D. Predict the number of calories for an item...
The data set shown below contains the number of hurricanes that occurred each year over a​...
The data set shown below contains the number of hurricanes that occurred each year over a​ 14-year period. Some scientists claim that there has been an increasean increase in the number of hurricanes as the years progressed. Complete parts​ a) through​ d). Year 11 22 33 44 55 66 77 88 99 1010 1111 1212 1313 1414 ​# 11 22 22 00 22 33 33 11 11 22 44 11 11 00 ​a) Create a histogram of these data. Choose...
The data set data_ksubs.csv contains information on net financial wealth (nettf a), age of the survey...
The data set data_ksubs.csv contains information on net financial wealth (nettf a), age of the survey respondent (age), annual family income (inc), family size (fsize), and participation in certain pension plans for people in the United States. The wealth and income variables are both recorded in thousands of dollars. In particular, the variable e401k is equal to 1 is the person is eligible for 401k, a retirement savings plan sponsored by the employer, and 0 otherwise. a. Create a scatter...
The data set data_ksubs.csv contains information on net financial wealth (nettf a), age of the survey...
The data set data_ksubs.csv contains information on net financial wealth (nettf a), age of the survey respondent (age), annual family income (inc), family size (fsize), and participation in certain pension plans for people in the United States. The wealth and income variables are both recorded in thousands of dollars. In particular, the variable e401k is equal to 1 is the person is eligible for 401k, a retirement savings plan sponsored by the employer, and 0 otherwise. a. Create a scatter...
1. The following data set contains information on years of formal education and incomes in 2015....
1. The following data set contains information on years of formal education and incomes in 2015. Row    Education    Income in         in Years      2015 Dollars 1          7         22587 2         10         28305 3         12         40196 4         13         49483 5         14         54483 6         16         78073 7         18         99540 8         19        155646 9         21        125310 a. Estimate the regression equation Income = a + b(Education). b. What is the predicted increase in Income for a one-year increase in Education? c. What do you...
The data set in CEOSAL2 contains information on chief executive officers for U.S. corporations. The variable...
The data set in CEOSAL2 contains information on chief executive officers for U.S. corporations. The variable salary is annual compensation, in thousands of dollars, and ceoten is prior number of years as company CEO. Write the steps using R Studio! (a) Find the average salary and the average tenure in the sample. (b) How many CEOs are in their first year as CEO (that is, ceoten = 0)? What is the longest tenure as a CEO? (c) Plot scatter plot...
Use the data in the Mod8-2Data file to answer the following questions. The data contains information...
Use the data in the Mod8-2Data file to answer the following questions. The data contains information from a car seat manufacturer on the age of machine (in months) and the cost of repairs (in 10s of $). Run the regression in Minitab and show the regression line on a scatter plot. Assume a level of significance of 5%. Age Repairs10 110 32.767 113 37.668 114 39.252 134 44.314 93 34.262 141 47.616 115 32.474 115 33.898 115 43.345 142 52.637...
Use RStudio. The carsafety data set in the UsingR package has records of the number of...
Use RStudio. The carsafety data set in the UsingR package has records of the number of passenger deaths in the “Other.deaths” column and the type of vehicle in the type column. Determine which type of vehicle is the deadliest for passengers by looking at difference in variance between groups.
2. The data set (Concrete1.xlsx) contains the compressive strength, in thousands of pounds per square inch...
2. The data set (Concrete1.xlsx) contains the compressive strength, in thousands of pounds per square inch (psi), of 30 samples of concrete taken two and seven days after pouring. (You need to use The Paired Difference Test). (a) At the 0.10 level of significance, is there evidence of a difference in the mean strengths at two days and at seven days? (b) Find the p-value in (a) and interpret its meaning. (c) At the 0.10 level of significance, is there...
Use the accompanying data set on the pulse rates​ (in beats per​ minute) of males to...
Use the accompanying data set on the pulse rates​ (in beats per​ minute) of males to complete parts​ (a) and​ (b) below. 80 82 83 62 93 83 74 77 50 84 59 72 53 90 59 43 64 64 64 79 51 62 55 68 74 82 52 80 80 72 76 59 Find the mean and standard​ deviation, and verify that the pulse rates have a distribution that is roughly normal. Explain why the pulse rates have a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT