[R] PS to Taking Integral and Optimization using Integrate() and Optim()

2011-06-08 Thread MARYAM ZOLGHADR
Hello again. Thank you for the comments. I have written these codes. iy=function(x) { res=NULL ress=0 for (i in (1:2)) { for (xx in x[i]) { fy=function(y) (exp(-exp(y+log(xx)))*(-exp(y+log(xx)))^2)/(1-exp(-exp(y+log(xx res=c(res,integrate(fy,-6.907,-1.246)$value) ress=ress+res } } return(ress

[R] Taking Integral and Optimization using Integrate, Optim and maxNR

2011-06-06 Thread MARYAM ZOLGHADR
Dear All, Hello! I have some questoins in R programming as follows: Question 1- How to take the integral of this function with respect to y, such that x would appear in the output after taking integral. f(x,y)=(0.1766*exp(-exp(y+lnx))*-exp(y+lnx))/(1-exp(-exp(y+lnx))) y in (-6.907,-1.246) It