MidtermMa

# MidtermMa - MIDTERM EXAM(ISYE8843 FALL 2004 Chengyuan Ma...

This preview shows pages 1–3. Sign up to view the full content.

MIDTERM EXAM (ISYE8843 FALL 2004) Chengyuan Ma School of Electrical and Computer Engineering Georgia Institute of Technology Atlanta, GA 30332, USA [email protected] 1. SOLUTION TO PROBLEM 1 the matlab code for this problem. clear all ; close all ; y1 = [25.8 19.8 28.6 29.4 22.3 33.8 33.8 27.8 29.6] ; y2 = [16.5 23.5 13.5 34.6 16.9 18.8 26.1 18.4 17.2 11.6 20.2] ; y3 = [24.0 29.1 16.0 24.8 27.0 10.9 11.8 23.2 17.7 23.9 24.6 24.0 27.2 23.7] ; % set random generator seed randn(’seed’,1) y1_mean = mean(y1) ; n1 = 9 ; s1_2 = var(y1) ; y2_mean = mean(y2) ; n2 = 11 ; s2_2 = var(y2) ; y3_mean = mean(y3) ; n3 = 14 ; s3_2 = var(y3) ; % set the parameters to be simulated Mu_1 = [] ; Mu_2 = [] ; Mu_3 = [] ; Psi = [] ; Tau2 = [] ; Sigma2 = [] ; Sigma1_2 = [] ; Sigma2_2 = [] ; Sigma3_2 = [] ; % set the parameters k = 3 ;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
a0 = 1 ; c0 = 1 ; d0 = 1 ; f0 = 1 ; g0 = 0.1 ; psi0 = 10 ; zeta0 = 0.1 ; M = 5000 ; burn = 1000 ; % generate initial values tau2 = 1 / rand_gamma(c0/2, d0/2) ; sigma2 = rand_gamma(f0/2, g0/2) ; sigma1_2 = 1 / rand_gamma(a0/2, a0 * sigma2 / 2) ; sigma2_2 = 1 / rand_gamma(a0/2, a0 * sigma2 / 2) ; sigma3_2 = 1 / rand_gamma(a0/2, a0 * sigma2 / 2) ; psi = randn(1,1) * sqrt(tau2/zeta0) + psi0 ; % Starting simulation for ii = 1 : M mu1 = randn(1,1) * sqrt(1/(n1/sigma1_2 + 1/tau2)) + . .. (n1 * y1_mean/sigma1_2 + psi/tau2)/(n1/sigma1_2 + 1/tau2) ; mu2 = randn(1,1) * sqrt(1/(n2/sigma2_2 + 1/tau2)) + . .. (n2 * y2_mean/sigma2_2 + psi/tau2)/(n2/sigma2_2 + 1/tau2) ; mu3 = randn(1,1) * sqrt(1/(n3/sigma3_2 + 1/tau2)) + . .. (n3 * y3_mean/sigma3_2 + psi/tau2)/(n3/sigma3_2 + 1/tau2) ; psi = randn(1,1) * sqrt(tau2/(k + zeta0)) + . .. (mu1 + mu2 + mu3 + zeta0 * psi0)/(k + zeta0); tau2 = 1 / rand_gamma((c0 + k + 1)/2, . .. (d0 + (mu1 - psi)ˆ2 + (mu2 - psi)ˆ2 + .
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 10/23/2011 for the course ISYE 8843 taught by Professor Vidakovic during the Spring '11 term at Georgia Tech.

### Page1 / 13

MidtermMa - MIDTERM EXAM(ISYE8843 FALL 2004 Chengyuan Ma...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online