# RE: [R] Proba( Ut+2=1 / ((Ut+1==1) && (Ut==1))) ?

From: Ben Fairbank <BEN_at_ssanet.com>
Date: Tue 26 Apr 2005 - 05:22:03 EST

These two expressions might be what you are looking for --

sum (3 ==
x[c(-length(x),-(length(x)-1))]+x[c(-1,-length(x))]+x[c(-1,-2)]) sum (-3 ==
x[c(-length(x),-(length(x)-1))]+x[c(-1,-length(x))]+x[c(-1,-2)])

Ben Fairbank

-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch

[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of vincent Sent: Monday, April 25, 2005 11:03 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Proba( Ut+2=1 / ((Ut+1==1) && (Ut==1))) ?

First I apologize if my question is quite simple, but i'm very newbie with R.

I have vectors of the form v = c(1,1,-1,-1,-1,1,1,1,1,-1,1)
(longer than this one of course).
The elements are only +1 or -1.

I would like to calculate :
- the frequencies of -1 occurences after 2 consecutives -1 - the frequencies of +1 occurences after 2 consecutives +1

It looks probably something like :
Proba( Ut+2=1 / ((Ut+1==1) && (Ut==1)))

could someone please give me a little hint about how i should/could begin to proceed ?

Thanks
(Thanks also to the R creators/contributors, this soft
seems really great !)

R-help@stat.math.ethz.ch mailing list