[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
MCMC with user-defined LnLike
From: |
Eric Hack |
Subject: |
MCMC with user-defined LnLike |
Date: |
Tue, 27 Jul 2004 16:08:59 -0400 |
Hi
Thanks for the documentation. I did not have the proper translation tools.
In an earlier message, I asked:
- Can a user-defined likelihood function be easily implemented in
MCSim?
You wrote:
it depends what you want to
do with it. Assume you want the likelihood for one data point. You
should be able to represent your data
as an input function, taking the observed value at a prescribed
observation time. Then the likelihood
should be representable as a standard function of the parameters,
state and output variables and that data.
Now if you want to compute the total likelihood for a dataset you
have to find a way to (say) form the product
of individual datapoints likelihood. To do that you can setup an
output variable to act as an accumulator:
this_point-like = f(params, this_data)
total_like = total_like * this_point-like
Just make sure that it behave correctly. That should be easy for
discrete-time sims. For integration it's more difficult
because Calc-Deriv (the "model") may be called several times within
an integration step and the product would be formed
too often (to avoid that I tend to use control input function of the
Spikes form).
An alternative is to code the product in the "yourcode.c" file. The
TransformPred function is called after a Monte Carlo
simulation and can be used for that. If you are not using MC
simulations you may need to add calls to TransformPred
elsewhere in the program.
Thanks for these helpful tips. The accumulator was part of the question.
I am also wondering if this likelihood function can be used in MCMC
simulations? I have looked briefly at a paper describing this model, and I
think it is essentially the MVK 2-stage clonal growth cancer model. The
likelihood contribution is different for survivors, fatal tumors, and
incidental tumors. I believe that the contributions work out as follows:
S(t)=exp(-H(t)) for the survivors,
h(t)S(t) for the fatal tumors, and
S(t)F(t) for the incidental tumors,
where S(t) is the survival function, H(t) is the cumulative hazard function,
h(t) is the instantaneous hazard, and F(t) is the cumulative probability of a
malignant transformation. Each type of contribution is based on H(t), a
function of the number of 2nd stage mutations.
Is there an easy way to set this model up in MCSim to do MCMC analysis of the
data? My first guess was to modify the LnLikeData, or add a user distribution
to LnDensity and put the function in 'yourcode.c' or wherever the other
likelihoods are calculated. The thing about adding a distribution to LnDensity
is that I did not know if 'mod' would let me get away with an unknown
distribution name. Can I add it to a list of keywords someplace?
You may be aware of more appropriate distributions that I have not thought of
for these data, so any suggestions are welcome.
Thanks again,
Eric
C. Eric Hack
Toxicology Excellence for Risk Assessment (TERA)
2300 Montana Avenue
Suite 409
Cincinnati, OH 45211
(513) 542 7475 x 19
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- MCMC with user-defined LnLike,
Eric Hack <=