function y = prop_ap(ap, pars,  prior, nobs, scale_ap)
% gamma[2:3] = a and Xbar[2:3] = p 
% gamma[1] = 1-gamma[2]-gamma[3] Xbar[1] = -(Xbar[2]+Xbar[3])
% identification on Bauer's page 15
% f(Z_t|Z_t-1,X_bar,gamma,Phi,Omega,sigma2_tau) is affected by a and p

% ap = ap./scale_ap;
prop.a = ap(1:2);
prop.p = ap(3:4);
% if any(prop.a>0) %|| any(prop.a<-0.5) || ap(3) <-10 || ap(4)>10
%     y = NaN;
%     return
% end
prop.gamma = [1-sum(prop.a); prop.a];
prop.Xbar = [-sum(prop.p); prop.p];
prop.Sigma_tilde = pars.omega - (prop.gamma*prop.gamma')*pars.sigtau2 ;
if invalidCovMat(prop.Sigma_tilde)
    y = NaN;
    return
else
    prop.llkP = llk_P(pars.tau, pars.X, prop.Xbar, pars.Phi, prop.gamma, pars.omega, pars.sigtau2, nobs) ;
    prop.lprior = log(mvnpdf(ap, prior.ap_mean, prior.ap_cov)) + ...
        log(diwish(prop.Sigma_tilde, prior.kappa, prior.Psi));
end
if ~isfinite(prop.lprior)
    y = NaN;
    return
else
    y = prop ;
end


