Hi I am facing a problem of restricting an intercept of systems of equations. Y1=f(X1,X2,X3) Y2=(X1,X2,X4) I want to restrict an intercept of equation 2 equal to coefficient of X2 of equation 1.
Please help Dereje ________________________________ From: Naser Jamil <jamilnase...@gmail.com> To: r-help@r-project.org Sent: Tuesday, October 2, 2012 10:23 AM Subject: [R] Integration in R Dear R-users, I am facing problem with integrating in R a likelihood function which is a function of four parameters. It's giving me the result at the end but taking more than half an hour to run. I'm wondering is there any other efficient way deal with. The following is my code. I am ready to provide any other description of my function if you need to move forward. ------------------------------------------------------------------------------------------------------------------------------------ library(cubature) dose<-c(2,3,5) y0<-c(2,1,0) y1<-c(1,1,1) y2<-c(0,1,2) lf<-function (x) { v<-1 for (i in 1:length(dose)) { psi0<-1/((1+exp(x[1]+x[2]*dose[i]))*(1+exp(x[3]+x[4]*dose[i]))) psi1<-exp(x[1]+x[2]*dose[i])/((1+exp(x[1]+x[2]*dose[i]))*(1+exp(x[3]+x[4]*dose[i]))) v<-v*(psi0^y0[i])*(psi1^y1[i])*((1-psi0-psi1)^y2[i]) } return(v) } adaptIntegrate(lf, lowerLimit = c(-20, 0,-20,0), upperLimit = c(0,10,0,10)) --------------------------------------------------------------------------------------------------------------------------------- Thanks for your attention. Kind regards, Jamil. [[alternative HTML version deleted]] ______________________________________________ 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, self-contained, reproducible code. [[alternative HTML version deleted]]
______________________________________________ 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, self-contained, reproducible code.