Hello everyone,
I am trying to use rpy2 to estimate the parameters of a specified function.
But I am failing miserable to understand how I can do this using rpy2. I
have the following R code: alphabeta<-function(alphabeta,x,dicerAcc) {
alpha <-alphabeta[1]
beta <-alphabeta[2]
if (any(alphabeta<0))
return(NA)
sum((alpha*log(beta) + lgamma(alpha + x) + x * log(dicerAcc) -
lgamma(alpha) - (alpha + x) * log(beta+dicerAcc) - lfactorial(x))[dicerAcc
> noiseT]) ab <- optim(c(1,100), alphabeta, control=list(fnscale=-1), x =
x, dicerAcc = dicerAcc)$par
Is there anyway to do this. I would imagine the easy way would be to import
the function from R but I imagine that means I would have to create a
package just for the function which is less than ideal.
Looking forward to your suggestion. Thank you very much in advance,
Bruno Santos
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
rpy-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list