> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Mary A. Marion
> Sent: Thursday, July 30, 2009 12:56 PM
> To: r-help@r-project.org
> Subject: [R] saving only part of a computation in integrate
> 
> Hello,
> 
> I am using
> Beta <-integrate(dnorm,mean=0,sd=1,-Inf,2.3552)
>  > Beta
> 0.9907436 with absolute error < 4.2e-06
> 
> 1-Beta results in an error
> How can I store into Beta only .9907436?
> 
> Thank you.
> 
> Sincerely,
> Mary A. Marion
> 

Take a look at the results of 

str(Beta)

List of 5
 $ value       : num 0.99
 $ abs.error   : num 4.22e-06
 $ subdivisions: int 4
 $ message     : chr "OK"
 $ call        : language integrate(f = dnorm, lower = -Inf, upper = 2.3552, 
mean = 0,      sd = 1)
 - attr(*, "class")= chr "integrate"

So it would appear that you could do

Beta <-integrate(dnorm,mean=0,sd=1,-Inf,2.3552)$value

Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA  98504-5204
 

______________________________________________
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.

Reply via email to