Hi Can we get the result of an intigration without the absolute error? for example f1<-function(x1){(1/gamma(alpha))*x1^(alpha-1)*exp(-x1)*log(x1)} I1<-integrate(f1, 0, (max(cc)-tau1+(theta2/theta1)*tau1)/theta2) I1 0.08007414 with absolute error < 7.2e-05 I need the answer 0.08007414 withou the other part(with absolute error <7.2e-05) how can we do that? thank you and take care Laila [[alternative HTML version deleted]]
Hi Laila, Here is a suggestion: res <- integrate(dnorm, -1.96, 1.96) res # 0.9500042 with absolute error < 1.0e-11 res[[1]] # [1] 0.9500042 res$value # [1] 0.9500042 HTH, Jorge On Sun, Nov 1, 2009 at 3:02 PM, Laila Alkhalfan <> wrote:> Hi > Can we get the result of an intigration without the absolute error? > for example > f1<-function(x1){(1/gamma(alpha))*x1^(alpha-1)*exp(-x1)*log(x1)} > I1<-integrate(f1, 0, (max(cc)-tau1+(theta2/theta1)*tau1)/theta2) > I1 > 0.08007414 with absolute error < 7.2e-05 > I need the answer 0.08007414 withou the other part(with absolute error > <7.2e-05) > how can we do that? > thank you and take care > Laila > > [[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]]
You just need to extract the list component named "value": I1$value Ravi. ____________________________________________________________________ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvaradhan at jhmi.edu ----- Original Message ----- From: Laila Alkhalfan <laila412 at gmail.com> Date: Sunday, November 1, 2009 3:03 pm Subject: [R] intigrate function and absolute error To: r-help at r-project.org> Hi > Can we get the result of an intigration without the absolute error? > for example > f1<-function(x1){(1/gamma(alpha))*x1^(alpha-1)*exp(-x1)*log(x1)} > I1<-integrate(f1, 0, (max(cc)-tau1+(theta2/theta1)*tau1)/theta2) > I1 > 0.08007414 with absolute error < 7.2e-05 > I need the answer 0.08007414 withou the other part(with absolute error > <7.2e-05) > how can we do that? > thank you and take care > Laila > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > > PLEASE do read the posting guide > and provide commented, minimal, self-contained, reproducible code.