Window 7
R 2.15
 
I am writing a simulation which generates sample sized estimates from simulated 
data. When I run the function shown below,
power.t.test(delta=14.02528,sd=1.945226,power=0.8,sig.level=0.05)
 
I get an error message:
 
> power.t.test(delta=14.02528,sd=1.945226,power=0.8,sig.level=0.05)
Error in uniroot(function(n) eval(p.body) - power, c(2, 1e+07)) : 
  f() values at end points not of opposite sign
 
The fact that the function can not return a sample size is OK, however I need 
to trap the error and set the sample size equal to NA. How do I trap the error 
so that when the error occurs I can set sample size equal to NA? 
 
Thanks,
John
 
 
John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)
Confidentiality Statement:
This email message, including any attachments, is for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.  
Any unauthorized use, disclosure or distribution is prohibited.  If you are not 
the intended recipient, please contact the sender by reply email and destroy 
all copies of the original message. 
______________________________________________
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