Dear R-list member,

I'm using the function pmnorm() (-->library(mnormt)) within a for-loop. Certain parameter values leads to an error message: "(In sqrt(diag(S)) : NaNs produced, In sqrt(1/diag(V)) : NaNs produced, In cov2cor(S) : diag(.) had 0 or NA entries; non-finite result is doubtful)"
obviously because "NaNs" were produced.
Is it possible to tell R that it should overleap the iteration which produce the error message?

Here is an example code (does not lead to an error message):

for (subject in 1:10) {

    p[subject] = pmnorm(x = subject*c(-.3,1), varcov = diag(2))

}

Assume that the 5th iteration (subject=5) leads to the error message. How can I tell R to continue with the 6th iteration?

Thanks a lot for you help and input,
Nicolas

____________


lic. phil. Nicolas A. J. Berkowitsch
Universität Basel
Fakultät für Psychologie
Economic Psychology
Missionsstrasse 62a
CH-4055 Basel

Tel.     +41 61 267 05 75
E-Mail   nicolas.berkowit...@unibas.ch
Web      
http://psycho.unibas.ch/abteilungen/abteilung-details/home/abteilung/economic-psychology/

______________________________________________
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