function imp= eval_imp(chain,pars,sk)

[M P]=size(chain.hmu); m=size(chain.be,2);

hmp = pdf_gaga(chain.hmp,2,1,1);
if sk==1
    ga = pdf_gd(chain.ga,pars.a_ga,pars.b_ga);
else
    ga=0;
end
df = pdf_gd(chain.df,pars.a_df,pars.b_df);
la = pdf_gd(chain.la,pars.a_la,pars.b_la);
ht = pdf_gd(chain.ht,pars.a_ht,pars.b_ht);
aal = pdf_gd(chain.aal,pars.a_aal'*ones(1,M),pars.b_aal'*ones(1,M));
bal = pdf_gd(chain.bal,pars.a_bal'*ones(1,M),pars.b_bal'*ones(1,M));
al = pdf_rb(chain.al,pars.a_al'*ones(1,M),pars.b_al'*ones(1,M));
hb = pdf_nor(chain.hb,pars.mhb,pars.vhb,1);
be=zeros(M,1);

for i=1:m
    be= be + pdf_nor(chain.be(:,i),pars.mbe(i),pars.vbe(i,i),1);
end
if P==1
    mu=pdf_nor(chain.mu,pars.mmu,pars.vmu,1);
    hmu=pdf_nor(chain.hmu,pars.mhmu,pars.vhmu,1);
else
    mu=zeros(M,1); hmu=mu;
    for p=1:P
        mu = mu + pdf_nor(chain.mu(i,p),pars.mmu(p),pars.vmu(p,p),1);
        hmu = hmu + pdf_nor(chain.hmu(i,p),pars.mhmu(p),pars.vhmu(p,p),1);
    end
end

imp.log=hmp + ga + df + la + ht + aal + bal + al + hb + be + mu + hmu;
imp.act = exp(imp.log);