Question
EM algo, EM alogrithm Complete data vector be a random sample from normal distribution. Suppose Y1 to Ym are observed. Supoose Ym+1 to Yn are
EM algo, EM alogrithm
Complete data vector be a random sample from normal distribution. Suppose Y1 to Ym are observed. Supoose Ym+1 to Yn are missing.
Suppose we can only observe m=15 observation: 1.85, 3.12, 7.20, 4.73, 6.09, 1.84, 3.33, 4.57, 1.28, -0.71, 1.42, -0.16, -1.90, 1.68, 1.85. The remaining n-m = 5 observations are missing. Find mean and variance using EM algoithm.
Can you suggest R codes?
EM.consoredexp<-function(init,x,cen,n,tol=1e-9,iter.max=100){ m<-length(x) t<-0 x.old<-init repeat{ x.new<-(sum(x)+(n-m)*(x.old+cen))/n t<-t+1 if((abs(x.new-x.old) return(list(est=x.new,iteration=t)) } if(t>iter.max){ cat("iteration limit has been reached ") break } x.old<-x.new } }
x<-c(1.85, 3.12, 7.20, 4.73, 6.09, 1.84, 3.33, 4.57, 1.28, -0.71, 1.42, -0.16, -1.90, 1.68, 1.85) cen<-5 EM.consoredexp(0.5,x,5,20)
y<-sapply(x, h.ind, t =5) est<-mean(y) est
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started