Question: Use the following code to generate a working dataset: N < - 3 0 0 0 0 J < - 3 pJ < - c

Use the following code to generate a working dataset:
N <-30000
J <-3
pJ <- c(0.1,0.3,0.6)
## b has a multinomial distribution with parameters n=1, p1.. pJ
b <- t(rmultinom(N,1,pJ ))
lambda <- c(1,2,3)
##
Y <- rexp(N, lambda[1])* b[,1]+
rexp(N, lambda[2])* b[,2]+
rexp(N, lambda[3])* b[,3]
Find estimates of pj s and \lambda j s using the EM algorithm in R

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!