531f10EM1 - mut2 = mut/n cur=mut2 EM =rbind(EM, mut2 ) } EM

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 ############################################################# # STAT 531 EM ############################################################# x= rexp(1) iter = 20 EM=cur= 1 for (i in 1: iter) { theta2 = (2* cur)/(5*cur +1) cur=theta2 EM =rbind(EM,theta2) } EM ############################################################# n=50 m=30 x=rnorm(m, 2, 1) iter = 20 mu0=mean(x) EM=cur =mu0 for (i in 1: iter) { mut = sum(x) + (n-m )*cur
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: mut2 = mut/n cur=mut2 EM =rbind(EM, mut2 ) } EM ############################################################# set.seed(7654321) n=50 m=30 x=rnorm(m, 2, 1) iter = 20 mu0 = mean(x) s0 = var(x) EM=cur =c(mu0 , s0) for (i in 1: iter) { mut = sum(x) + (n-m )*cur[1] st = sum(x^2) + (n-m)*(cur[1]^2 + cur[2]) mut2 = mut/n st2= st/n - mut2^2 EM =rbind(EM, c(mut2, st2)) cur=EM[dim(EM)[1], ] } EM...
View Full Document

This note was uploaded on 02/04/2011 for the course STAT 531 taught by Professor Gaborlukacs during the Spring '11 term at Manitoba.

Ask a homework question - tutors are online