Hamiltonian Monte Carlo -- Unknown Posterior
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I was using Hamiltonian Monte Carlo (HMC) to perform a model simulation. The model is for the timecourse fitting of two metabolites, and it has 6 parameters for a set of ODEs (see code). I assume they follow a multivariate normal distribution, but with unknown mean and covariance matrix. I also assume that the residual error follows a normal distribution. The problem is that HMC requires taking the derivative of the log posterior density. How can I derive the gradient analytically without knowing the mean and covariance? Many thanks!
function PLmat = model_ode(x,timevec,tofit)
kpl=x(1);
rho=x(2);
Z=x(3);
alpha=x(4);
beta=x(5);
t0=x(6);
P0 = tofit(1,1); %initial value 1
L0 = tofit(1,2); %initial value 2
f=Z*gampdf(timevec-t0,alpha,beta)/sum(f); %input function
[~,PLmat] = ode15s(@(t,y)ODE(t,y,timevec,f,Z,rho,kpl),timevec,[P0;L0]);
end
function dydt = ODE(t,y,ft,f,Z,rho,kpl)
fin=interp1(ft,f,t);
dydt = zeros(2,1);
dydt(1)=-rho*y(1)-kpl*y(1)+fa;
dydt(2)=-rho*y(2)+kpl*y(1);
end
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Monte-Carlo en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!