Re: [R] Calling optim and .C

2008-11-06 Thread Armin Meier
Thanks, your answer just helped me to find the error. Armin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal,

[R] Calling optim and .C

2008-11-05 Thread Armin Meier
Hi all, I want to optimize a function fn using optim. This function fn calls the .C function in it with a function name and arguments given to fn, i.e. something like this pseudocode: fn - function(par, some params for fn) {... .C(Cfunction, ...) ...} optim(par, fn, some params for fn) In my

[R] sampling from Laplace-Normal

2008-11-01 Thread Armin Meier
Hi, I have to draw samples from an asymmetric-Laplace-Normal distribution: f(u|y, x, beta, phi, sigma, tau) \propto exp( - sum( ( abs(lo) + (2*tau-1)*lo )/(2*sigma) ) - 0.5/phi*u^2), where lo = (y - x*beta) and y=(y_1, ..., y_n), x=(x_1, ..., x_n) -- sorry for this huge formula -- A WinBUGS Gibbs

[R] sampling from Laplace-Normal

2008-11-01 Thread Armin Meier
Hi, I have to draw samples from an asymmetric-Laplace-Normal distribution: f(u|y, x, beta, phi, sigma, tau) \propto exp( - sum( ( abs(lo) + (2*tau-1)*lo )/(2*sigma) ) - 0.5/phi*u^2), where lo = (y - x*beta) and y=(y_1, ..., y_n), x=(x_1, ..., x_n) -- sorry for this huge formula -- A WinBUGS Gibbs