[R] Help with Integration Output
bps0002 at auburn.edu
Sat Sep 24 17:23:52 CEST 2011
It is not simply the answer, it is a list
str(integrate(dnorm, -1.96, 1.96))
List of 5
$ value : num 0.95
$ abs.error : num 1.05e-11
$ subdivisions: int 1
$ message : chr "OK"
$ call : language integrate(f = dnorm, lower = -1.96, upper = 1.96)
- attr(*, "class")= chr "integrate"
Is this what you want (?):
1 + (integrate(dnorm, -1.96, 1.96)[])
> I need to do a calculation in R which involves adding the estimate of a
> numerical integration with another number - however, if I add the number
> the output of the intergrate function (which when run on its own provides
> with a number with error), I get the message 'non-numeric argument to
> operator'. How would I be able to avoid this and use the estimate?
> eg: I have the code integrate(dnorm, -1.96, 1.96), which gives the output
> 0.9500042 with absolute error < 1.0e-11, but if I put in integrate(dnorm,
> -1.96, 1.96)+1, I don't get 1.9500042 - how would I?
> Thanks very much, Chris.
> View this message in context:
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
View this message in context: http://r.789695.n4.nabble.com/Help-with-Integration-Output-tp3839532p3839552.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help