From mathieu.ribatet at epfl.ch  Fri Jun 27 12:53:55 2008
From: mathieu.ribatet at epfl.ch (Mathieu Ribatet)
Date: Fri, 27 Jun 2008 12:53:55 +0200
Subject: [Rd] Problem in conditional looping
In-Reply-To: <1e1cef7f0806262103j1f3c9b5ar64d666f68109d383@mail.gmail.com>
References: <1e1cef7f0806262103j1f3c9b5ar64d666f68109d383@mail.gmail.com>
Message-ID: <4864C6C3.4090109@epfl.ch>

Why don't you consider a "while" loop e.g.

while (Pij < 0)
 ##Then you resample according to your code

Nadeem Shafique a ?crit :
> Respected All,
>
> I am writing a program in R and facing some problem with applying "if statment".
>
> Program first draw random numbers from bivariate normal distribution
>         then compute variable say Pi and Pij from that sample and
> then further computation
> .....
> .....
> .....
> In some samples Pij is appearing with negitive sign and ultimately
> resulted in an negative variance estimator.  Now i want to design the
> program like this if the Pij is negative then go back and draw another
> sample until we get a sample that produces positive Pij and then move
> forward for further processing.
>
> Best Regards,
>
> Nadeem Shafique Butt
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>   

-- 
Institute of Mathematics
Ecole Polytechnique F?d?rale de Lausanne
STAT-IMA-FSB-EPFL, Station 8
CH-1015 Lausanne   Switzerland
http://stat.epfl.ch/
Tel: + 41 (0)21 693 7907



[Rd] Problem in conditional looping
Mathieu Ribatet