0
$\begingroup$

I'm doing the project for my data science exam, I'm not actually a statistician so I had some doubts. This is my data set:y=c(9.259778,9.178891,9.262575,9.212859,9.241963,9.290917,9.178455,9.183814,9.165018,9.291896,9.224782,9.242657,9.250334,9.160302,9.256481,9.260796,9.240498,9.25356,9.218893,9.246804,9.173388,9.167167,9.244065,9.218927,9.165018,9.15876,9.200642,9.214249,9.269913,9.241662,9.278649,9.14827,9.284982,9.154452,9.235653,9.152447,9.264966,9.174357,9.288118,9.256481,9.255262,9.180671,9.263177,9.266747,9.210479,9.210076,9.17756,9.168857,9.275107,9.18953,9.234487,9.255529,9.162257,9.15876,9.171285,9.171285,9.263681,9.184207,9.163909,9.287234,9.314823,9.284948,9.209001,9.223705,9.200642,9.225896,9.159908,9.175491,9.249344,9.283924,9.296693,9.18902,9.256651,9.18847,9.164954,9.178592,9.280818,9.283587,9.136633,9.292565,9.253224,9.202783,9.194269,9.210041,9.241525,9.283587,9.192205,9.154516,9.273521,9.211578,9.269947,9.190727,9.254482,9.179686,9.199604,9.183574,9.256617,9.272744,9.256757,9.241963,9.189398,9.171221,9.200642,9.284914,9.253083,9.229419,9.276587,9.174323,9.24931,9.178592,9.154486,9.217431,9.205828,9.308151,9.17329,9.162496,9.262436,9.192171,9.191123,9.220985,9.245848,9.276281,9.173256,9.204155,9.256617,9.225188,9.249344,9.189098,9.288118,9.175388,9.29727,9.178558,9.267188,9.276583,9.171255,9.279823) I know I have to do a mixture of two Normal distributions, so I used this code for jags model_jags="model{ for (i in 1:length(y)){ y[i]~dnorm(mu[z[i]],prec) z[i]~dcat(omega) } mu[1]~dnorm(1,1/1000) mu[2]~dnorm(1,1/1000) T(mu[1],) prec~dgamma(1/2,1*1/2) sig=sqrt(1/prec) omega~ddirich(c(1,1)) } " params=c("mu","sig","omega","z[1]","z[35]","z[22]","z[10]") mod=jags.model(textConnection(model_jags),data=data_jags,n.chains=3,n.adapt=1000) mod_sim=coda.samples(model=mod,variable.names = params,n.iter=5e3) But in the posterior summary the mu2 is too high(like 33) while mu1 seems to be reasonable so I can't get which can be the mistake in this case. Then the prof told me to simulate some other mixture models in order to compare them in terms of DIC. So did i understand correctly, that i have just to simulate the mixture models with the actual observed parameters(means and variances) but changing weights? And how could i do it in R? Thanks a lot in advance to everyone who'll try to help me.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.