Docsity

Bayesian Statistics - Homework 7 | 22S 138, Assignments of Statistics

Toggle sidebar
bg1
22S:138, Bayesian Statistics
Fall 2005, Homework 7
Due: Mon., 10/24 in class
1. The exponential distribution is commonly used to model data on time from some
starting point until an event occurs. The probability density function for a random
variable Y drawn from an exponential distribution with parameter λis
p(y|λ) = λ e−λy,0<y<∞
Researchers wish to compare 5 medications that reduce fever. These medications
are all different formulations of the same drug (capsule, liquid, tablet, etc.). The
experiment involves 30 patients, each with a temperature of at least 102 degrees. Six
patients are randomly assigned to medication 1, six patients to medication 2, etc.
After the patient takes the medication assigned to him, his temperature is monitored
continuously. The outcome variable of interest is the time in hours from when the
medication is taken until the patient’s temperature goes below 99.5 degrees.
Let yij denote this time for patient jwho received medication i.
The researchers will carry out a Bayesian analysis. They assume that all the times
for patients receiving the same medication, say i, follow an exponential distribution
with the same parameter λi. They believe that the λs for different treatments are
different, but they have no idea of which ones will be larger or smaller.
Below is WinBUGS code for fitting a 3-stage hierarchical model to their data.
model {
for (i in 1:N) {
for (j in 1:M) {
Y[i,j] ~ dexp( lambda[i])
}
lambda[i] ~ dgamma( alpha, beta)
}
alpha ~ dgamma( 1,1)
beta ~ dgamma(1,1)
overall <- alpha / beta
}
(a) Draw a directed graph for this model. You may either do this by hand or use
DoodleBUGS or any graphing software that you know.
(b) Derive expressions proportional to the full conditional distributions for lambda[i],
alpha, and beta. If any of them are standard distributions, identify them by
family and parameters. If any of them are not standard distributions, say so.
2. Suppose another level were added to the hierarchy as follows:
1
model {
for (i in 1:N) {
for (j in 1:M) {
Y[i,j] ~ dexp( lambda[i])
}
lambda[i] ~ dgamma( alpha, beta)
}
alpha ~ dgamma( a1, b1)
beta ~ dgamma(a2, b2 )
a1 ~ dexp(2)
b1 ~ dexp(2)
a2 ~ dexp(2)
b2 ~ dexp(2)
overall <- alpha / beta
}
(a) Will the full conditionals for the lambda[i]s change? Why or why not?
(b) Derive expressions prop ortional to the full conditionals for alpha, beta, a1, and
b1. If p ossible, identify them as standard distributions.
2

Partial preview of the text

Download Bayesian Statistics - Homework 7 | 22S 138 and more Assignments Statistics in PDF only on Docsity!

22S:138, Bayesian Statistics

Fall 2005, Homework 7

Due: Mon., 10/24 in class

  1. The exponential distribution is commonly used to model data on time from some

starting point until an event occurs. The probability density function for a randomvariable Y drawn from an exponential distribution with parameter

λ^

is

p(y

|^ λ

)^ =

λ e

−λy

,^

0 < y <

Researchers wish to compare 5 medications that reduce fever.

These medications

are all different formulations of the same drug (capsule, liquid, tablet, etc.).

The

experiment involves 30 patients, each with a temperature of at least 102 degrees. Sixpatients are randomly assigned to medication 1, six patients to medication 2, etc.After the patient takes the medication assigned to him, his temperature is monitoredcontinuously.

The outcome variable of interest is the time in hours from when the

medication is taken until the patient’s temperature goes below 99.5 degrees.Let

yij

denote this time for patient

j^

who received medication

i.

The researchers will carry out a Bayesian analysis.

They assume that all the times

for patients receiving the same medication, say

i, follow an exponential distribution

with the same parameter

λi

.^ They believe that the

λs for different treatments are

different, but they have no idea of which ones will be larger or smaller.Below is WinBUGS code for fitting a 3-stage hierarchical model to their data. model {for (i in 1:N) {

for (j in 1:M) {

Y[i,j] ~ dexp( lambda[i])

lambda[i] ~ dgamma( alpha, beta) }alpha ~ dgamma( 1,1)beta ~ dgamma(1,1)overall <- alpha / beta}^ (a) Draw a directed graph for this model.

You may either do this by hand or use

DoodleBUGS or any graphing software that you know. (b) Derive expressions proportional to the full conditional distributions for lambda[i],

alpha, and beta.

If any of them are standard distributions, identify them by

family and parameters. If any of them are not standard distributions, say so.

  1. Suppose another level were added to the hierarchy as follows:

model {for (i in 1:N) {

for (j in 1:M) {

Y[i,j] ~ dexp( lambda[i])

lambda[i] ~ dgamma( alpha, beta) } alpha ~ dgamma( a1, b1)beta ~ dgamma(a2, b2 )a1 ~ dexp(2)b1 ~ dexp(2)a2 ~ dexp(2)b2 ~ dexp(2)overall <- alpha / beta}^ (a) Will the full conditionals for the lambda[i]s change? Why or why not?(b) Derive expressions proportional to the full conditionals for alpha, beta, a1, and

b1. If possible, identify them as standard distributions.