This may be far-fetched: In Bayesian analysis to find the marginal posterior distribution of a parameter it requires integration out of the so-called nuisance parameters. Is there in R (like an equivalent to the deriv function) but to find the expression of the integration (or an anti-derivative)? Like for example I want to integrate out mu in the normal distribution, I would introduce (note:punctuation marks are made up): integral(prod[i to n] 1/sqrt(2*pi*s^2)*exp(-(xi-mu)/2*s^2), dmu) and it would give me: 1/(sqrt(n)*(2*pi*s^2)^((n-1)/2))*exp(-sum[i to n]((xi-xbar)^2)/2*s^2) ? -- View this message in context: http://www.nabble.com/Bayesian-Integration-%28stat-question%29-tp14549095p14549095.html Sent from the R help mailing list archive at Nabble.com.
Yacas and Ryacas does exactly what I want. Actually I had asked previously a question about algebra (not integration precisely) and guys here have pointed out package Ryacas. Sorry to disturb. francogrex wrote:> > This may be far-fetched: > In Bayesian analysis to find the marginal posterior distribution of a > parameter it requires integration out of the so-called nuisance > parameters. Is there in R (like an equivalent to the deriv function) but > to find the expression of the integration (or an anti-derivative)? Like > for example I want to integrate out mu in the normal distribution, I would > introduce (note:punctuation marks are made up): > integral(prod[i to n] 1/sqrt(2*pi*s^2)*exp(-(xi-mu)/2*s^2), dmu) > and it would give me: > 1/(sqrt(n)*(2*pi*s^2)^((n-1)/2))*exp(-sum[i to n]((xi-xbar)^2)/2*s^2) > ? >-- View this message in context: http://www.nabble.com/Bayesian-Integration-%28stat-question%29-tp14549095p14550219.html Sent from the R help mailing list archive at Nabble.com.