Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

HW 6

1.   Rosa  et  al.  (1998)  investigated  a key  claim  of practitioners  of therapeutic touch, namely, that the practitioners can sense a body’s energy field. If this is true, then practitioners should be able to sense which of their hands is near another person’s hand, even without being able to see their hands. The practitioner sat with her hands extended through cutouts in a cardboard screen, which prevented the practitioner from seeing the experimenter. On each trial, the experimenter flipped a coin and held her hand a few centimeters above one or the other of the practitioner’s hands, as dictated by the flip of the coin. The practitioner then responded with her best guess regarding which of her hands was being hovered over. Each trial was scored as correct or wrong.

Each practitioner was tested for 10 trials. There were total of 28 practitioners in the study. Chance performance is 0.5. The question is how much the group differed from chance performance.

We will fit two models to the data in the file HW6-TherapeuticTouchData.csv.

Model 1 :

Yij  ~ Bernoulli(pi), i = 1, … , 28, j = 1, … , 10

pi  = qi

qi ~ Beta(9, 2) (gives the benefit of the doubt and assumes the group is successful)

Model 2 :

Yij  ~ Bernoulli(pi), i = 1, … , 28, j = 1, … , 10

pi  = qi

qi ~ Beta(a, b) (multilevel without any assumption on the group ability) a ~ Exp(1)

b ~ Exp(1)

a)   Fit Model 1 with Stan using 2000 iterations. Report the estimated difference for the contrast  q28    -  q1   (this  is  the  difference  between  the  best  and  worst  performing practitioner).

b)   Repeat part a) with Model 2. In which model is the contrast more pronounced?

c)   Extract samples from Model 2 and estimate the posterior group mode (recall that for Beta(ab) distribution, the mode is equal to ), both with a point value and with a 95% HPDI. What do you conclude are the practitioners as a group reliable or guessing the outcome? (That is, is the estimated value different than the chance value of 0.5, or equivalently, does the interval cover 0.5?)


2.   The data in the file HW6-house.txt represent property taxes (Y), in dollars, and age  (X),  in  years,  of  19  houses.  We  would  like  to  use  Bayesian  quadratic regression to relate Y to X with a model utilizing normal likelihood and improper prior:

Yi  = p( + p#Xi + p2Xi(2) + ei , ei ~ N(0, G2)

(p(, p#, p2, G2) =

a.   Derive the likelihood and then the posterior distribution f(p| G 2, y), where

p = (p(, p#, p2 )  and y = (y 1 , … , yn).

b.   Bonus:    Show    that    the    marginal    posterior    distribution    of   G2     is G2 | y ~ IG 7 , 8, where SSE  = ;y X?′ ;y X?.

c.   Use parts a) and b) to write R code to generate iid Monte Carlo sample of size

1000 from the full posterior density f(p, G 2 |y), then use the generated betas

to estimate the age corresponding to minimum tax.

d.   Suppose you want to avoid the complicated part b) and instead apply an MCMC sampler in place of the independent sampler. Derive the posterior distribution f(G2 | p, y) and repeat part c) but now use a Gibbs sampler to generate the observations from f(p, G2 |y).

3.   Let {Zt} be a sequence of independent normal random variables, each with mean 0 and variance σ2, and let a, b, and c be constants. Which, if any, of the following processes are  stationary?  For  each  stationary process  specify  the  mean  and  autocovariance function.

(a) Xt = a + bZt + cZt−2

(b) Xt = Z1cos(ct) + Z2sin(ct)

(c) Xt = Zt cos(ct) + Z t−1  sin(ct)

(d) Xt = a + bZ0 (e) Xt = Xt- 1 + Zt (f) Xt = Z t Zt−1

4.   Use the milk dataset from Lecture 24.

e.   Detrend and deseason the data. Then obtain the acf and pacf plots on the residuals and comment on what model is appropriate for them.

f.   Try AR(1), AR(2), MA(1) and MA(2) models and compare to decide which one fits detrended and deseasoned data from part a). For each of them obtain the residuals and check the hypothesis they are white noise.

g.   Repeat part b) with different ARMA models.

h.   Finally, fit ARCH(1) and GARCH(1, 1) models. Draw an overall conclusion which model from everything you tried fits the best.

Here is the code to load milk dataset in R:  read.csv('https://raw.githubusercontent.com/ ourcodingclub/CC-time-series/master/monthly_milk.csv')